Presentation is loading. Please wait.

Presentation is loading. Please wait.

Session 3 Module 5: Swing Advanced Controls Module 6: Internationalization.

Similar presentations


Presentation on theme: "Session 3 Module 5: Swing Advanced Controls Module 6: Internationalization."— Presentation transcript:

1 Session 3 Module 5: Swing Advanced Controls Module 6: Internationalization

2 Advanced Controls and Internationalization / Session3 / 2 of 27 Module 3 Review

3 Advanced Controls and Internationalization / Session3 / 3 of 27 Module 4 Review

4 Advanced Controls and Internationalization / Session3 / 4 of 27 Module 5: Swing Advanced Controls  Objectives

5 Advanced Controls and Internationalization / Session3 / 5 of 27 javax.swing.JColorChooser class Swatches: sample colors HSB: Hue, Saturation, Brightness RGB: Red Green Blue Constructors: JColorChooser() JColorChooser(java.awt.Color initColor) Methods: ColorSelectionModel getSelectionModel() Color getColor() void setColor (Color c) Color showDialog(Component container,String title,Color initColor) Event handling: javax.swing.event.ChangeEvent javax.swing.event.ChangeListener public void stateChanged(ChangeEvent e)

6 Advanced Controls and Internationalization / Session3 / 6 of 27 javax.swing.JList class JList displays a groups of items in one or more columns. JList does not support scrolling inherently. Add JList to a JScrollPane to support scrolling functionality. Constructors JList() JList ( Object[] dataItems) JList ( Vector vectorItems) Common used Methods Event handling: ListSelectionEvent ListSelectionListener public void valueChanged(ListSelectionEvent e)

7 Advanced Controls and Internationalization / Session3 / 7 of 27 javax.swing.JComboBox class Common used methods Event handling: ActionEvent ActionListener public void actionPerformed(ActionEvent e) ItemEvent ItemListener public void itemStateChanged(ItemEvent e)

8 Advanced Controls and Internationalization / Session3 / 8 of 27 javax.swingJTable class Column Headers data Event handling: MouseEvent MouseListener public void mouseClicked( MouseEvent e) Common used methods

9 Advanced Controls and Internationalization / Session3 / 9 of 27 javax.swing.JTree class Event Handling javax.swing.event.TreeSelectionEvent javax.swing.event.TreeSelectionListener public void valueChanged(TreeSelectionEvent e) javax.swing.event.TreeExpansionEvent javax.swing.event.TreeExpansionListener public void treeExpanded(TreeExpansionEvent e) public void treeCollapsed(TreeExpansionEvent e) javax.swing.event.TreeWillExpandEvent javax.swing.event.TreeWillExpandListener public void treeWillExpand(TreeWillExpandEvent e) public void treeWillCollapse(TreeWillExpandEvent e)

10 Advanced Controls and Internationalization / Session3 / 10 of 27 Event Handling ChangeEvent ChangeListener public void stateChanged(ChangeEvent e javax.swing.JTabbedPane class Constructors JTabbedPane() JTabbedPane( int direction)

11 Advanced Controls and Internationalization / Session3 / 11 of 27 javax.swing.JSplitPane class Constructors: JSplitPane() // side by side, no continuous layout JSplitPane(int direction ) JSplitPane(int direction, boolean continuous) JSplitPane(int direction, boolean continuous, Component comp1, Component comp2)

12 Advanced Controls and Internationalization / Session3 / 12 of 27 Module 5 Summary

13 Advanced Controls and Internationalization / Session3 / 13 of 27 Module 6: Internationalization

14 Advanced Controls and Internationalization / Session3 / 14 of 27 Need of Internationalization X Internationalization Component Captions Formatting numbers Formatting date and time Messages Where should you use internationalization?

15 Advanced Controls and Internationalization / Session3 / 15 of 27 Unicode

16 Advanced Controls and Internationalization / Session3 / 16 of 27 Creating a Properties File Examples

17 Advanced Controls and Internationalization / Session3 / 17 of 27 Defining Locale: Locale Class Example:

18 Advanced Controls and Internationalization / Session3 / 18 of 27 ResourceBundle Class public static ResourceBundle getBundle (String propertiesFileName, Locale obj) Fetching the text from ResourceBundle

19 Advanced Controls and Internationalization / Session3 / 19 of 27 Classes for formatting

20 Advanced Controls and Internationalization / Session3 / 20 of 27 Class java.text.NumberFormat: Format numbers, currencies, percentages Abstract class static NumberFormat getInstance() // default locale static NumberFormat getInstance(Locale inLocale) static NumberFormat getNumberInstance() static NumberFormat getNumberInstance(Locale inLocale) static NumberFormat getIntegerInstance() static NumberFormat getIntegerInstance(Locale inLocale) static NumberFormat getCurrencyInstance() static NumberFormat getCurrencyInstance(Locale inLocale ) static NumberFormat getPercentInstance() static NumberFormat getPercentInstance(Locale inLocale) String format(double number) String format(long number) get/set minimumFractionDigits get/set maximunFractionDigits get/set minimumIntegerDigits

21 Advanced Controls and Internationalization / Session3 / 21 of 27 public asbtract class java.text.DateFormat

22 Advanced Controls and Internationalization / Session3 / 22 of 27 Class public java.text.SimpleDateFormat

23 Advanced Controls and Internationalization / Session3 / 23 of 27 Class public java.text.SimpleDateFormat

24 Advanced Controls and Internationalization / Session3 / 24 of 27 Class java.text.MessageFormat

25 Advanced Controls and Internationalization / Session3 / 25 of 27 Procedure to use MessageFormat class

26 Advanced Controls and Internationalization / Session3 / 26 of 27 MessageFormat class

27 Advanced Controls and Internationalization / Session3 / 27 of 27 Module 6 Summary


Download ppt "Session 3 Module 5: Swing Advanced Controls Module 6: Internationalization."

Similar presentations


Ads by Google