11 JComponent

9
SWING CLASS Object Oriented Programming

description

OOP

Transcript of 11 JComponent

  • SWING CLASS Object Oriented Programming

    Advanced Object-Oriented Concepts (Part 1)

  • JComponent ClassAll Swing components except top-level containers whose names begin with Jdescend from the JComponent class (e.g., JPanel, JScrollPane, and JButton).

    Events and Event Handling*

    Advanced Object-Oriented Concepts (Part 1)

  • JComponent ClassThe JComponent class provides the following functionality to its descendants: Tool tipsPainting and bordersApplication-wide pluggable look and feelCustom propertiesSupport for layoutSupport for accessibilitySupport for drag and dropDouble bufferingKey bindings

    Events and Event Handling*

    Advanced Object-Oriented Concepts (Part 1)

  • JLabel ClassA JLabel object can display either text or an image, or both. It cannot react to input events but is instead commonly used to provide a label identifier for a nearby object that does.The JLabel class uses three constants to align the component horizontally.JLabel.LEFTJLabel.RIGHTJLabel.CENTER

    Events and Event Handling*

    Advanced Object-Oriented Concepts (Part 1)

  • JTextComponent ClassThe JTextComponent class provides a base class for Swing components that handle editable text. It provides the functionalities for entering and editing text informationnearly all the features of a text editor. JTextComponent has three direct subclassesJTextField, JTextArea, and JEditorPane.

    Events and Event Handling*

    Advanced Object-Oriented Concepts (Part 1)

  • JTextComponent ClassJTextField provides a component for entering and editing a single line of text.A JTextArea object displays multiple lines of text in a single font and style and optionally allows the user to edit the text. JTextArea does not handle scrolling, but implements the swing Scrollableinterface.

    Events and Event Handling*

    Advanced Object-Oriented Concepts (Part 1)

  • JList ClassJList class is used to display a list of items, such as list of students, a list of files, and so forth. A JList object is constructed in a manner similar to the way a JComboBox object is constructed, that is, by passing an array of String.

    Events and Event Handling*

    Advanced Object-Oriented Concepts (Part 1)

  • JComboBox ClassThe JComboBox is a component that combines two features: display area showing an option, and a list box containing additional options.

    Events and Event Handling*

    Advanced Object-Oriented Concepts (Part 1)

  • JScrollPane ClassThe JScrollPane container can hold components that require more display area than they have been allocated.

    Events and Event Handling*

    Advanced Object-Oriented Concepts (Part 1)

    *