-
Notifications
You must be signed in to change notification settings - Fork 4
Java GUIs
Anthony Christe edited this page Oct 16, 2013
·
6 revisions
- AWT - basic widgets and windows
- Swing - provides native look and feel, platform independent, advanced widgets (tabs, scroll panes, tables, trees)
- JavaFX - rich internet applications across platforms (sound familiar?)
- SWT - started at IBM, now maintained by Eclipse, non-portable using JNI, better performance?
- Using Top Level Containers
- To appear on screen, every component must be part of a GUI hierarchy
- Each component can be contained only once
- Menu bars can be added to top level containers
- JFrame is generally used as top level container
- Most of the GUI work is done in children containers such as JPanels
- JComponents are the building blocks of a Swing application
- Provides UI widgets (buttons, text areas, scroll bars, tabs, menus, trees, progress bars, etc)
- JPanels provide an empty canvas to place JComponents onto
- It's possible to include as many JPanels in an application as you need
- JPanels can be embedded into other JPanels
- JComponents can be added manually to a JPanels by x, y location
- JComponents can be sized manually on a JPanel
- But.... it's better to let Swing handle the layout of components, but how?
- Let Swing handle the layout of your components
- Allows for automatic resizing of windows
- Sub-components can also automatically be resized
- Visual Guide to Swing Layouts