Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As with learning any GUI software, experimentation is best. Try messing with BorderLayouts with nested JPanels.</p> <p>Ultimately, you use JPanel with a BorderLayout (Flow Layout is OK but really when resizing the window, it epically fails). See <a href="http://download.oracle.com/javase/tutorial/uiswing/layout/border.html" rel="nofollow">http://download.oracle.com/javase/tutorial/uiswing/layout/border.html</a> to learn more about BorderLayouts.</p> <p>Now for your layout scheme it should be something along the lines of:</p> <ol> <li>Top Level Container: JFrame</li> <li>JFrame contains a JPanel (Call this JPanel 1) with a BorderLayout.</li> <li>The three buttons should be in a SEPARATE jPanel (JPanel 2). JPanel 1 should add the three buttons as BorderLayout.CENTER. In this way, the window will resize if the button changes its width and/or hright.</li> <li>The JLabel should be added as BorderLayout.LINE_START.</li> </ol> <p>The tutorial at: <a href="http://download.oracle.com/javase/tutorial/uiswing/layout/border.html" rel="nofollow">http://download.oracle.com/javase/tutorial/uiswing/layout/border.html</a> should help you with this. But in general, use the following:</p> <ul> <li>Use JPanel and nest JPanels as necessary</li> <li>BorderLayout.CENTER will accomodate size changes---this is the key! (Experiment with this)</li> <li>JFrame should only be used as a top level container (for more complex GUIs, this is true).</li> </ul> <p>If you require more flexibility, check out JGoodies: <a href="http://www.jgoodies.com/" rel="nofollow">http://www.jgoodies.com/</a> . This is more along the lines of creating forms.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload