hw7Fall10 - JSplitPane class(defined in javax.swing package-An object of the JSplitPane class is a pane split vertical direction or horizontal direction

hw7Fall10 - JSplitPane class(defined in javax.swing...

This preview shows page 1 - 3 out of 3 pages.

JSplitPane class (defined in javax.swing package) -An object of the JSplitPane class is a pane split vertical direction or horizontal direction. Suppose that we have component objects comp1 and comp2. If we want to add them using vertical split, we can do: JSplitPane sPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, comp1, comp2);
Font class (java.awt package) One of the Font’s constructor is define as: Font(String name, int style, int size) Style can be Font.PLAIN, Font.BOLD, Font.ITALIC, or combination of them. Example: Font font1 = new Font("TimesRoman", Font.PLAIN, 16); If comp is a component object, we can set its font as follows: comp.setFont(font1);
A GUI Example using JRadioButton: // QuoteOptions.java // It demonstrates the use of radio buttons. import javax.swing.*; public class QuoteOptions extends JApplet { private final int WIDTH = 300, HEIGHT = 100; public void init() { QuoteGUI gui = new QuoteGUI(); getContentPane().add(gui); setSize(WIDTH,HEIGHT); } } // end of QuoteOptions class // QuoteGUI.java // Represents the user interface for the QuoteOptions // program.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture