-2

I've searched and searched about this topic, but have found nothing. How would I organize things like buttons and text fields in a Java JFrame?

EDIT: Sorry, this was incredibly vague. I've seen the Layout Managers but I want to be able to put the components in a specific place, not where the Layout Managers want to put it. Maybe I've overlooked something, but with the BorderLayout it puts buttons across the entire window, despite my attempt to use a setPrefferedSize(new Dimension(x,y).

jjjhfam
  • 13
  • 2
  • 3
    Have a look at layouts: http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html – maskacovnik Jul 06 '15 at 22:38
  • 3
    `"I've searched and searched about this topic, but have found nothing."` Sorry, but this means that you will want to work to improve your searching skills. Seriously. I mean a basic [organize components in a JFrame](https://www.google.com/webhp?sourceid=chrome-instant&rlz=1C1LEND_enUS445US445&ion=1&espv=2&ie=UTF-8#q=organize%20components%20in%20a%20jframe) Google search will bring you all you need to know. That's just a search using the terms that you've used in asking this question. – Hovercraft Full Of Eels Jul 06 '15 at 22:41
  • I'm sorry, my original question was extremely vague. I have edited. – jjjhfam Jul 08 '15 at 21:50
  • The answer depends on what you want the GUI to look like, but you can nest JPanels with different Swing layout managers to get various GUIs. – Gilbert Le Blanc Jul 08 '15 at 23:18
  • I just researched that a bit, and think that will work. Thanks! – jjjhfam Jul 08 '15 at 23:25

1 Answers1

0

LayoutManagers! Also, use NetBeans IDE to draw your GUI. Has nice drag-and-drop lists of widgets.

The link above is a visual guide.

Community
  • 1
  • 1
Andrei
  • 7,509
  • 7
  • 32
  • 63