13-Basic-Swing

13-Basic-Swing - 2006 Marty Hall Basic Swing Better GUI...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
2 J2EE Training: http://courses.coreservlets.com/ Servlets, JSP, Struts, JSF, Hibernate, AJAX, Java 5, etc. Developed and taught by well-known author and developer. At public venues or onsite at your location. © 2006 Marty Hall Basic Swing Better GUI Controls 3 Developed and taught by well-known author and developer. At public venues or onsite at your location. © 2006 Marty Hall For live Java training, please see training courses at http://courses.coreservlets.com/. Servlets, JSP, Struts, JSF, AJAX, Java 5, etc. Taught by the author of Core Servlets and JSP , More Servlets and JSP , and this tutorial. Available at public venues, or customized versions can be held on-site at your organization.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 J2EE training: http://courses.coreservlets.com Agenda New features Basic approach Summary of Swing components Starting points JApplet, JFrame Swing equivalent of AWT components JLabel, JButton, JPanel, JSlider New Swing components JColorChooser, JInternalFrame, JOptionPane, JToolBar, JEditorPane Other simple components JCheckBox, JRadioButton, JTextField, JTextArea, JFileChooser 5 J2EE training: http://courses.coreservlets.com New Features Many more built-in controls Image buttons, tabbed panes, sliders, toolbars, color choosers, HTML text areas, lists, trees, and tables. Increased customization of components Border styles, text alignments, and basic drawing features. Images can be added to almost any control. A pluggable “look and feel” Not limited to “native” look. Many miscellaneous small features Built-in double buffering, tool-tips, dockable toolbars, keyboard accelerators, custom cursors, etc. Model-view-controller architecture Can change internal representation of trees, lists, tables.
Background image of page 2
6 J2EE training: http://courses.coreservlets.com Swing vs. AWT Programming Naming convention All Swing component names begin with a capital J and follow the format J Xxx . E.g., JFrame, JPanel, JApplet, JDialog, JButton. Many are just AWT names with a J. Lightweight components Most Swing components are lightweight : formed by drawing in the underlying window. Use of paintComponent for drawing Custom drawing code is in paintComponent, not paint. Double buffering turned on by default. New Look and Feel as default With Swing, you have to explicitly set the native look. Don't mix Swing and AWT in same window 7 J2EE training: http://courses.coreservlets.com Windows Look and Feel
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 J2EE training: http://courses.coreservlets.com Motif Look and Feel 9 J2EE training: http://courses.coreservlets.com Java Look and Feel
Background image of page 4
10 J2EE training: http://courses.coreservlets.com Setting Native Look and Feel Most applications should use native look, not default “Java” look Changing is tedious, so use static method public class WindowUtilities { public static void setNativeLookAndFeel () { try { UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName()); } catch(Exception e) { System.out.println("Error setting native LAF: " + e); } } ...
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/16/2009 for the course CSCI 571 taught by Professor Papa during the Summer '07 term at USC.

Page1 / 25

13-Basic-Swing - 2006 Marty Hall Basic Swing Better GUI...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online