Presentation is loading. Please wait.

Presentation is loading. Please wait.

Layout Managers 2011.02.25. Outline Java GUI API Layout Managers [Sample code] ShowFlowLayout.java 、 ShowGripLayout.java 、 ShowBorderLayout.java.

Similar presentations


Presentation on theme: "Layout Managers 2011.02.25. Outline Java GUI API Layout Managers [Sample code] ShowFlowLayout.java 、 ShowGripLayout.java 、 ShowBorderLayout.java."— Presentation transcript:

1 Java @Ch12. Layout Managers 2011.02.25

2 Outline Java GUI API Layout Managers [Sample code] ShowFlowLayout.java 、 ShowGripLayout.java 、 ShowBorderLayout.java TestImageIcon.java

3 Java GUI API GUI: Graphical User Interface GUI classes can be classified into three group: 1. container classes 2. component classes 3. helper classes

4 Container classes: ex: JFrame, Jpanel, Japplet Component classes ex: JButton, JTextFiels, JTextArea, JComboBox, Jlist, JRadioButton Helper classes ex: Graphics, Color, Font, FontMetrics, Dimension

5 程式範例 :  MyFrameWithComponents.java

6 Layout Managers FlowLayout: ( 水流 ) 最簡單的 layout 方式, 方向由左到右 GridLayout: ( 格子 ) 以指定行與列的矩陣方式排列 BorderLayout: ( 邊緣 ) 分為五種邊緣, North,West,East,South, 指定其一

7 程式範例 :  ShowFlowLayout.java  ShowGripLayout.java  ShowBorderLayout.java

8 Image Icon Java currently supports three image formats: GIF 、 JPEG 、 PNG ImageIcon icon = new ImageIcon(“image/us.gif”); An image icon can be displayed in a label or a button using: new JLabel(imageIcon) new JButton(imageIcon)

9 程式範例 :  TestImageIcon.java

10 程式練習 :


Download ppt "Layout Managers 2011.02.25. Outline Java GUI API Layout Managers [Sample code] ShowFlowLayout.java 、 ShowGripLayout.java 、 ShowBorderLayout.java."

Similar presentations


Ads by Google