aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Java GUI - AWT (Window, Panel, Frame) When do you use what? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Java GUI - AWT (Window, Panel, Frame) When do you use what?" Watch "Java GUI - AWT (Window, Panel, Frame) When do you use what?" New topic
Author

Java GUI - AWT (Window, Panel, Frame) When do you use what?

Ronald Vermeij
Ranch Hand

Joined: Sep 05, 2009
Posts: 37
Hallo All,
I have a hard time figuring out when I use what GUI-element as a BASIS for a GUI.
java.lang.Object
-java.awt.Component
--java.awt.Container
---java.awt.Window
----java.awt.Frame AND ----java.awt.Panel

- the "Panel thing" I have figured out:
This is can be used to arrange buttons, choices, list, textboxes in a pre-determined order and shape
Entire panels then, can be combined into a single GUI screen with the help of a layout manager like (flow, border, grid, gridbag...)

Question: Can you give me some "rules of the tumb" regarding what GUI element to choose in which situations?
- When do you choose a WINDOW as basis of a GUI?
- When do you choose a FRAME as basis of a GUI?

thanks for sharing your GUI wisdom with me
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2182
    
    7
Rarely would you use any of those components. Most people these days would use Swing components (JFrame, JWindow, JPanel).

General rule is an application would have a single JFrame. If you need child windows to gather information or display properties of your application then you use modal JDialogs. A JFrame appears on the task bar, a JDialog doesn't. Rarely would you use a JWindow. One case would be when you don't want to display borders and you don't need any input from the user (like a splash screen), just a "Close" button.

I suggest you take a look at the Swing tutorial for the basics.
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3646
    
  16

Let's not forget you can use Windows for full screen rendering.
Ronald Vermeij
Ranch Hand

Joined: Sep 05, 2009
Posts: 37
Rob Camick wrote:Rarely would you use any of those components. Most people these days would use Swing components (JFrame, JWindow, JPanel).
General rule is an application would have a single JFrame. If you need child windows to gather information or display properties of your application then you use modal JDialogs. A JFrame appears on the task bar, a JDialog doesn't.
Hello Rob,
I've started with the AWT toolkit, just to get my Java-GUI Basics covered and trying to understand how everything interlock with eachother like buttons+evenlisteners, choice+ItemstateChangers etc...


Rarely would you use a JWindow. One case would be when you don't want to display borders and you don't need any input from the user (like a splash screen), just a "Close" button.
So when I want a fullscreen, borderless gui, i choose a (J)window?


I suggest you take a look at the Swing tutorial for the basics.
Thanks for this link Rob...

Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3646
    
  16

Yes, you can use a (J)Window for those purposes.

I would highly recommend going straight to Swing, and checking out the tutorial Rob gave you. Swing is very much alike AWT, so after you've learned Swing, you'll understand most of AWT as well.

There's a big difference in the way components are drawn though, for example. Swing makes all of this relatively easy, with its heavy use of so called 'lightweight' components.

Most of Swing's event handling comes straight out of AWT.

After you're familiar with working with Swing, and making decent GUI applications with it, would I go back and find out how AWT works exactly, and how Swing builds on top of it. It's easier to understand if you have already worked with making GUIs.
Ronald Vermeij
Ranch Hand

Joined: Sep 05, 2009
Posts: 37
Stephan van Hulst wrote:Yes, you can use a (J)Window for those purposes.

I would highly recommend going straight to Swing, and checking out the tutorial Rob gave you. Swing is very much alike AWT, so after you've learned Swing, you'll understand most of AWT as well.

There's a big difference in the way components are drawn though, for example. Swing makes all of this relatively easy, with its heavy use of so called 'lightweight' components.

Most of Swing's event handling comes straight out of AWT.

After you're familiar with working with Swing, and making decent GUI applications with it, would I go back and find out how AWT works exactly, and how Swing builds on top of it. It's easier to understand if you have already worked with making GUIs.


Thanks Stephan:
I've already started sniffing around in the Swing Tutorial that Rob gave me yesterday. Another reason why I started with AWT-GUI-Building is that I am learning Java from my first original book i've bought some 13 years ago - "Sunsoft Java WorkShop in 21 days" (and never finished it back then :-( ) and a recently purchased 2nd hand copy of "The Complete Java training Course" by Deitel and Deitel. Those beautiful books are filled with AWT only knowledge.

Beside that, I have surfed and found a lot of Swing tutorials only, which I now will use to expand my java-gui-builders knowledge.
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3646
    
  16

Good luck!
Ronald Vermeij
Ranch Hand

Joined: Sep 05, 2009
Posts: 37
Stephan van Hulst wrote:Good luck!

Thanks Stephan
Manny Ruiz
Ranch Hand

Joined: Dec 01, 2010
Posts: 40
nm
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java GUI - AWT (Window, Panel, Frame) When do you use what?