Download - Java GUI Basics
Java GUI BASICSand more
Presented by Med Rafik Megdiche
Hierarchy of a JAVA GUI
Window (Jframe, JDialog)
Menu Bar Content pane(JPanel)
Layout(FlowLayout)
Components (JLabel)
Intermediate Containers (JPanel)
• JPanel is used primarily for holding components
•Exemple :
JPanel content = new JPanel();
setContentPane(content);
pack();
Layout Manager
•Manage the size and position of component
•Group children into suitable layout
No manager
•Simple application
•No flexibility
•Absolute coordinates
FlowLayout (Default)
• Simply lays out components in a single row
• Starting a new row if its container is not sufficiently wide
GridLayout
BorderLayout
Listeners
• Attached to components and their methods are called when the component is used
Event Listeners
• ActionListener
• AdjustementListener
• ComponentListener
• ContainerListener
• FocusListener
• ItemListener
• KeyListener
• MouseMotionListener
• TextListener
• WindowListener
Events are divided into two groups
• represent window-system occurrences or low-level input.
Low-level events
• Everything else
• Preferable
semantic events
Look and feel
Thank you for your attention
Useful Links
• http://www.cril.univ-artois.fr/~lecoutre/teaching/poo/cours/pdf/interfacesGraphiques.pdf
• http://isabelle.thieblemont.pagesperso-orange.fr/java/
• http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/