Section 16.8. Review


16.8. Review

When programming in Swing, we create the GUI objects and then let Swing do the work of managing all the interactions. We created:

  • Containers to hold GUI objects, such as JFrame for our outermost window, JPanel for an assortment of objects, and JScrollPane for viewing larger objects through a scrollable window.

  • Labels (JLabel class) to hold either a short bit of text, or an image, or both; it can even take snippets of HTML, for fancier formatting and coloring of text.

  • Buttons (JButton class) to which we attached actionsthe code fragments that get called when the buttons get pushed; a button could have text and/or an image displayed in it.

  • Actionswhether for buttons or selections (or other triggers yet to be discussed), an action is the code that runs when the event (e.g., button press) occurs.

  • Text fields (JTextField class) to take small amounts of user input; our application didn't need the other types of text fields (JTextArea and JTextPane) useful for much more extensive user input.

  • A JTable instance and its associated TableModel, SelectionModel, and TableCellRenderer which provide tremendous flexibility and control over table behavior and contents.

  • A JDialog instance with custom content, to allow for multiple user inputs; the dialog comes and goes with its visibility; since it's a modal dialog, when it is visible, it "hogs" all the user interactions; it is possible to make nonmodal dialogs, but our application didn't need to.

  • LayoutManagers for our JFrame and JPanels, used to place objects within a container with various algorithms for placement and expansion.



    Java Application Development with Linux
    Java Application Development on Linux
    ISBN: 013143697X
    EAN: 2147483647
    Year: 2004
    Pages: 292

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net