Garis besar topik

  • Most computer users today expect software to feature a graphical user interface (GUI) with a variety of widgets such as text boxes, sliders, and scrollbars. The Java Class Library includes Swing, a set of packages that enable Java programs to offer a sophisticated GUI and collect user input with the mouse, keyboard, and other input devices.

    In this lesson, you will use Swing to create applications that feature these GUI components:

    • Frames: Windows with a title bar; menu bar; and Maximize, Minimize, and Close buttons

    • Containers: Components that hold other components

    • Buttons: Clickable rectangles with text or graphics indicating their purpose

    • Labels: Text or graphics that provide information

    • Text fields and text areas: Windows that accept keyboard input of one line or multiple lines

    • Drop-down lists: Groups of related items that are selected from drop-down menus or scrolling windows

    • Check boxes and radio buttons: Small squares or circles that can be selected or deselected

    • Image icons: Graphics added to buttons, labels, and other components

    • Scrolling panes: Panels for components too big for a user interface that can be accessed in full by using a scrollbar

    Swing is the most extensive set of related classes introduced thus far in the book. Learning to create graphical applications with these packages is good practice for utilizing a class library in Java, which is something yo do often in your own projects