Hi every body, I have two questions please: 1. if I had a JPanel and this panel contains labels, textfields, comboboxes, checkboxes.... which layout manager should I use in this case: GridBagLayout or null layout? 2. I have a button, when clicked, it must shows a custom dialog (this dialog will contains textfields and radiobuttons, and the user must fill these fields). when the use fills this fields, how to return this data(lets say, for display pupose)?
Personnaly I would never use the null layout. Not knowing exactly how your gui is supposed to look I can't just say use GribBagLayout. It should be able to do what you want but there are other possibilities based on what is needed.
Given the choices, I'd say: 1. Never use null layout 2. Why not go with GridBagLayout - it will give you everything you need in terms of a custom layout. As far as returning the data, Create a constructor in your custom JDialog in which you pass a reference to the parent. Then when the use is done filling out the JDialog the JDialog can call the method that you want to perform to update the GUI, lets just say the method is called updateScreen(). Then, you would do parent.updateScreen()
An egg is a chicken's house!
Then YOU must do the pig's work! Read this tiny ad. READ IT!
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth