17
Java GUI BASICS and more Presented by Med Rafik Megdiche

Java GUI Basics

Embed Size (px)

Citation preview

Page 1: Java GUI Basics

Java GUI BASICSand more

Presented by Med Rafik Megdiche

Page 2: Java GUI Basics

Hierarchy of a JAVA GUI

Page 3: Java GUI Basics

Window (Jframe, JDialog)

Menu Bar Content pane(JPanel)

Layout(FlowLayout)

Components (JLabel)

Page 4: Java GUI Basics

Intermediate Containers (JPanel)

• JPanel is used primarily for holding components

•Exemple :

JPanel content = new JPanel();

setContentPane(content);

pack();

Page 5: Java GUI Basics

Layout Manager

•Manage the size and position of component

•Group children into suitable layout

Page 6: Java GUI Basics

No manager

•Simple application

•No flexibility

•Absolute coordinates

Page 7: Java GUI Basics

FlowLayout (Default)

• Simply lays out components in a single row

• Starting a new row if its container is not sufficiently wide

Page 8: Java GUI Basics

GridLayout

Page 9: Java GUI Basics

BorderLayout

Page 10: Java GUI Basics
Page 11: Java GUI Basics

Listeners

• Attached to components and their methods are called when the component is used

Page 12: Java GUI Basics

Event Listeners

• ActionListener

• AdjustementListener

• ComponentListener

• ContainerListener

• FocusListener

• ItemListener

• KeyListener

• MouseMotionListener

• TextListener

• WindowListener

Page 13: Java GUI Basics
Page 14: Java GUI Basics

Events are divided into two groups

• represent window-system occurrences or low-level input.

Low-level events

• Everything else

• Preferable

semantic events

Page 15: Java GUI Basics

Look and feel

Page 16: Java GUI Basics

Thank you for your attention

Page 17: Java GUI Basics

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/