Java GUI Basics

2,331 views
2,031 views

Published on

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,331
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
126
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Java GUI Basics

  1. 1. Java GUI BASICS and more Presented by Med Rafik Megdiche
  2. 2. Hierarchy of a JAVA GUI
  3. 3. Window (Jframe, JDialog)Menu Bar Content pane(JPanel) Layout Components (FlowLayout) (JLabel)
  4. 4. Intermediate Containers (JPanel)• JPanel is used primarily for holding components• Exemple : JPanel content = new JPanel(); setContentPane(content); pack();
  5. 5. Layout Manager• Manage the size and position of component• Group children into suitable layout
  6. 6. No manager• Simple application• No flexibility• Absolute coordinates
  7. 7. FlowLayout (Default)• Simply lays out components in a single row• Starting a new row if its container is not sufficiently wide
  8. 8. GridLayout
  9. 9. BorderLayout
  10. 10. Listeners• Attached to components and their methods are called when the component is used
  11. 11. • ActionListener • AdjustementListener • ComponentListener Event • ContainerListener • FocusListener • ItemListenerListeners • KeyListener • MouseMotionListener • TextListener • WindowListener
  12. 12. Events are divided into two groupsLow-level • represent window-system events occurrences or low-level input.semantic • Everything else events • Preferable
  13. 13. Look and feel
  14. 14. Thank you for your attention
  15. 15. 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/

×