The accessibility package provides assistance to users who have trouble with traditional user interfaces. Accessibility tools can be used in conjunction with devices such as audible text readers or braille keyboards to allow direct access to the Swing components. All Swing components support accessibility, so this book dedicates an entire chapter Chapter 25 to accessibility design and use.
The 2D API contains classes for implementing various painting styles, complex shapes, fonts, and colors. Drag and Drop DnD is one of the more common metaphors used in graphical interfaces today.
The DnD API allows users to implement droppable elements that transfer information between Java applications and native applications. Although DnD is not part of Swing, it is crucial to a commercial-quality application. We tackle this topic in Chapter Figure enumerates the various components of the Java Foundation Classes.
Swing is actually built on top of the core AWT libraries. Because Swing does not contain any platform-specific native code, you can deploy the Swing distribution on any platform that implements the Java 1.
In fact, if you have JDK 1. If you use a JDK version prior to 1. In JDK 1. Figure Swing contains many more graphical components than its immediate predecessor, AWT 1. Many are components that were scribbled on programmer wishlists since Java first debuted—including tables, trees, internal frames, and a plethora of advanced text components. In addition, Swing contains many design advances over AWT. For example, Swing introduced an Action class that makes it easier to coordinate GUI components with their functionality.
Swing depends extensively on the event-handling mechanism of AWT 1. Each Swing component also contains a variable number of exportable properties. These components form the Swing Graphical User Interface widget toolkit for Java programming language. Java Swing components provide an interactive experience with the application.
In this article, we will look at a few Swing components commonly used in desktop application development. JFrame is the very first component in the Java Swing Component hierarchy. It can be created in two ways:. JLabel is a component which displays a readable text or an image in the Swing Container User interface.
The application user cannot edit the text rendered in the JLabel. However, the application itself, through action events, can change the text. JTextField is a swing component that allows users to input one line of text. For JTextField to be accessible and editable, enable property must be set to true. JTextField can be initialized by calling the JTextField constructor and passing a parameter of integer type.
The integer parameter passed in the constructor does not limit the number of characters a user can key in the text field. However, it sets the width of the text field box; i. JButton is one of the swing components which gives swing the property of platform independence. It is implemented in an application by calling any of its class constructors. JButton in most applications contains text or an image which communicates to the user what the button does.
NetBeans is an IDE for developing applications using different languages. Java programming language is one of those many languages which NetBeans supports. Best of Techopedia weekly. News and Special Offers occasional. Java Swing. Techopedia Explains Java Swing. What Does Java Swing Mean? Techopedia Explains Java Swing Swing offers customization of the look and feel of every component in an application without making significant changes to the application code.
Share this Term. Tech moves fast! Stay ahead of the curve with Techopedia! Join nearly , subscribers who receive actionable tech insights from Techopedia.
0コメント