To refer to a Swing class using its short name-without referring to the package, in other words-you must make it available with an import statement or use a catchall statement such as the following: import javax.swing.* Swing components are part of the javax.swing package, a standard part of the Java Class Library. Java offers a distinctive look and feel called Nimbus that’s unique to the language. Each of these styles is called a look and feel because it describes both the appearance of the interface and how its components function when they are used. Swing enables the creation of a Java program with an interface that adopts the style of the native operating system, such as Windows or Linux, or a style that’s unique to Java. Learning to create graphical applications with these packages is good practice for utilizing a class library in Java, which is something you’ll do often in your own projects. Swing is the most extensive set of related classes introduced thus far in the book. Scrolling panes: Panels for components too big for a user interface that can be accessed in full by using a scrollbar Image icons: Graphics added to buttons, labels, and other components Text fields and text areas: Windows that accept keyboard input of one line or multiple linesĭrop-down lists: Groups of related items that are selected from drop-down menus or scrolling windowsĬheck boxes and radio buttons: Small squares or circles that can be selected or deselected Labels: Text or graphics that provide information In this lesson, you will use Swing to create applications that feature these GUI components:įrames: Windows with a title bar menu bar and Maximize, Minimize, and Close buttonsĬontainers: Components that hold other componentsīuttons: Clickable rectangles with text or graphics indicating their purpose 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. 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. Sams Teach Yourself Java in 21 Days (Covers Java 11/12), 8th Edition
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |