Results 1 to 3 of 3
- 08-23-2010, 08:40 PM #1
Senior Member
- Join Date
- Aug 2009
- Posts
- 294
- Rep Power
- 0
Adding JButton to JInternalFrame, grid doesnt work..
Hey!
Im making this SQL manager GUI software.
Mainly for my own use, but If I succed I'll ofcourse give it out fo free :)
Anyways, I got a problem.
I got this jInternalFrame
And then I do this:
Java Code:JButton b = new JButton(name); b.setSize(240, 20); b.setVisible(true); JLayeredPane c = (JLayeredPane) DB.getLayeredPane(); GridBagConstraints c1 = new GridBagConstraints(); c1.gridy = initDatabases; c1.ipadx = 100; c1.fill = GridBagConstraints.HORIZONTAL; System.out.println(initDatabases); c.add(b,c1); c.validate(); initDatabases++;
And the DB (jInternalFrame) is suppose to have GridBagLayout
But it doesnt work because as I have added 3 buttons
Then they should be after eachother, moving down 1 grid for each button.
BUT that doesnt work :(
Idk why but they all end up on same position..
Do you know why? Please reply if you do :)
-
From what I can tell in this small code snippet, you don't appear to be using GridBagLayout correctly, in particular the GridBagConstraints. Where are you setting the gridx, height, width, weight, etc...
Have you gone through the GridBagLayout tutorials?
Myself, I try to avoid using this layout unless necessary.
- 08-23-2010, 09:05 PM #3
Senior Member
- Join Date
- Aug 2009
- Posts
- 294
- Rep Power
- 0
Similar Threads
-
PrintWriter doesnt work :(
By Addez in forum New To JavaReplies: 11Last Post: 01-17-2010, 06:59 PM -
mysql connect button doesnt work quite right
By 711groove in forum New To JavaReplies: 0Last Post: 12-13-2009, 08:01 AM -
Dll Call doesnt work
By INFACT in forum New To JavaReplies: 1Last Post: 10-04-2009, 10:31 PM -
Getting a grid with cell properties to work.
By GAZ082 in forum AWT / SwingReplies: 2Last Post: 02-11-2009, 09:17 PM -
java doesnt allow vista to work
By 10rosas in forum New To JavaReplies: 5Last Post: 12-22-2008, 05:23 PM
Bookmarks