Results 1 to 2 of 2
Thread: Jtable size of JPane
- 02-10-2012, 02:48 PM #1
Member
- Join Date
- Feb 2012
- Posts
- 25
- Rep Power
- 0
Jtable size of JPane
I am trying to make the jtable the size of the jpane with a maximum number of rows. Any help on this?
Java Code:public void createMainGUI () { double screenheight = screenSize.height * 0.95; double screenwidth = screenSize.width * 0.98; //Menu menubar.add(File); File.add(NewTransaction); File.add(Exit); //Table Object[] columnNames = {"Date", "Last Name", "Sport", "# of Years", "Vegetarian"}; Object[][] data = { {"Kathy", "Smith", "Snowboarding", new Integer(5), new Boolean(false)}, {"John", "Doe", "Rowing", new Integer(3), new Boolean(true)}, {"Sue", "Black", "Knitting", new Integer(2), new Boolean(false)}, {"Jane", "White", "Speed reading", new Integer(20), new Boolean(true)}, {"Joe", "Brown", "Pool", new Integer(10), new Boolean(false)} }; JTable Transaction = new JTable(data, columnNames); JScrollPane scrollPane = new JScrollPane(Transaction); Transaction.setBorder(BorderFactory.createLineBorder(Color.BLACK,1)); //Panel settings Mainpane.addTab("Transactions", jp1); Mainpane.addTab("Settings", jp2); //TabPane jp1.add(scrollPane); //Bottom Panel Bottompanel.add(BLbl); Bottompanel.add(XLbl); //MainFrame mainframe.setJMenuBar(menubar); mainframe.getContentPane().add(Mainpane, BorderLayout.NORTH); mainframe.add(Bottompanel,BorderLayout.PAGE_END); mainframe.setVisible(true); mainframe.setSize((int) screenwidth, (int) screenheight ); } }
- 02-10-2012, 08:52 PM #2
Re: Jtable size of JPane
What's a jtable? What's a jpane? Java is case sensitive; and there's no class jpane with any combination of lower and upper case.
And in your code, follow Java coding conventions. Variable names should not start with a capital letter.
Code Conventions for the Java Programming Language: Contents
dbWhy do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
How to set the size of a JComboBox?
By nickburris in forum New To JavaReplies: 1Last Post: 01-02-2012, 01:21 AM -
Adding New JTable in JTable
By anilkumar_vist in forum New To JavaReplies: 0Last Post: 01-27-2010, 08:27 AM -
Setting frame size to the size of an image
By Yoruichi in forum AWT / SwingReplies: 5Last Post: 04-22-2009, 04:37 PM -
Size of JTable
By andre1011 in forum Advanced JavaReplies: 3Last Post: 04-15-2009, 04:55 AM -
Jtable duplicates through Hashtable (JTable condition problem) my assignment plz help
By salmanpirzada1 in forum Advanced JavaReplies: 2Last Post: 05-15-2008, 10:15 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks