0

I'm trying to figure out how to work with the layoutmanager in swing and honestly... I'm realy having a hard time.

Is there a most common used layout or does it realy depends on which context you have. For example I need to create the following layout :

enter image description here

Which layout should I use ?

  • 3
    It really depends on which context you have. – khelwood Jan 14 '16 at 15:30
  • *Which layout should I use ?* What do you want your GUI to look like? You can have more than one layout in a complicated Swing GUI. To answer your other question, the FlowLayout is the JPanel default and the BorderLayout is the JFrame default. Because these layouts are the defaults, they're probably the most used. – Gilbert Le Blanc Jan 14 '16 at 15:35
  • duplicate - http://stackoverflow.com/questions/1832432/which-swing-layouts-do-you-recommend?rq=1 ? – Betlista Jan 14 '16 at 16:27

2 Answers2

0

It really depends on which context you have. That's why there are so many differnt Layouts to chose from.

Sometimes there's many ways to build a specific design, sometimes a specific Layout will make the design very easy - but learning how the different JRE-included Layouts work is time well spent if you target Swing applications.

In your current case I'd probably use BorderLayout for the Dialog, put a JLabel in CENTER with icon and (two lines of) text and add the Buttons in another JPanel in SOUTH...

Jan
  • 13,738
  • 3
  • 30
  • 55
0

I would suggest you should use border layout for above case https://docs.oracle.com/javase/tutorial/uiswing/layout/border.html

Pankaj Pandey
  • 1,015
  • 6
  • 10