0

I'm trying to add a JButton, but it aligns horizontally with a progress bar. How do I align the JButton on the line below?
Also, I'm trying to group all the components in separate groups, I'm not sure how to do this though. Does anyone know?

Like this, I think this is from the Docs but I can't get it to work. Nothing is displayed.

tckmn
  • 57,719
  • 27
  • 114
  • 156
John Smith
  • 39
  • 1
  • 8

1 Answers1

1

For simple splitting of a JFrame you can use a GridLayout with 2 rows and 2 columns.

frame.setLayout(new GridLayout(2,2,3,3)); //3,3 are gaps
frame.add(grid);
//add components here...
imulsion
  • 8,820
  • 20
  • 54
  • 84
  • +1, I liked this idea, if I understood the question correctly :-) I can not see the image, since the `imgur` server is down on my side :( – nIcE cOw Sep 01 '13 at 14:09
  • 1
    @nIcEcOw the image is just some basic GUI components that the OP needs aligning - don't worry about it, not essential for understanding the question :) – imulsion Sep 01 '13 at 14:11
  • Okay since you vouching for it, I am too satisfied now :-) – nIcE cOw Sep 01 '13 at 14:14