I'm trying to use BoxLayout instead of my GridLayout code:
setLayout (new GridLayout (5, 2));
except I noticed that when you do BoxLayout you need to do something like:
setLayout (new BoxLayout(container, BoxLayout.Y_AXIS));
However, I don't call the JFrame something, like how it would be called:
JFrame label = new JFrame ();
it basically just works in the constructor.. I'm obviously a beginner in Java but do have some understanding. Because I don't call the JFrame and simply write:
add (controlPanel);
add (outputPanel);
What do I put into the target part of the BoxLayout? I do want it to be on the Y axis but I'm not sure what to put in the field before it instead of the "container" thanks :)
Simply use JFrame's content pane as target.
setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));