![]() ![]() In javax.swing package and its sub-packages, swing classes are described. It is used to build Java's graphical user interface. Swing is an official Java GUI tool kit published by Sun Microsystems that offers the look and feel of contemporary Java GUI. Swing Framework includes a number of classes that provide GUI components that are more strong and versatile than AWT. Then you need to add it to the frame by using the method - add(Component's Object) You can add the following method also for resizing the frame - setResizable(true) JButton allows an icon, string or both associated with a button. JTextField : JTextFields allow editing of a single line of text. Creating a JFrame in java There are 2 ways we can create a JFrame Window. By instantiating JFrame class. By extending JFrame class. Creating JFrame window by Instantiating JFrame class import javax.swing.* //importing swing package import java.awt.* //importing awt package public class First Points to note: Import the javax.swing and java.awt package to use the classes and methods of Swing. While creating a frame (either by instantiating or extending Frame class), the following two attributes are a must for visibility of the frame: setSize(int width, int height) setVisible(true) When you create objects of other components like Buttons, TextFields, etc. JLabel : JLabel has descended from JComponent, and is used to create text labels. JButton : JButton class provides the functioning of push button. Like Window it uses BorderLayout by default. JWindow : This is Swing's version of Window and has descended directly from Window class. The component which is added to the Frame, is referred to as its Content. JPanel is descended directly from JComponent. JFrame : JFrame is Swing's version of Frame and is descended directly from Frame class. Java Swing belongs to the Java Classes Foundation (JFC). Features of JFC Swing GUI components. Look and Feel support. Java 2D. AWT and Swing HierarchyIntroduction to Swing Classes: JPanel : JPanel is Swing's version of AWT class Panel and uses the same default layout, FlowLayout. It is used to build Java's graphical user interface. In javax.swing package and its sub-packages, swing classes are described. Main Features of Swing Toolkit Platform Independent Customizable Extensible Configurable Lightweight Rich Controls Pluggable Look and FeelSwing and JFC JFC is an abbreviation for Java Foundation classes that includes a set of characteristics to build Graphical User Interfaces (GUI) and add wealthy graphical characteristics and interactivity to Java apps. Subsection 13.2.Java Tutorial By KnowledgeHut Swing Framework includes a number of classes that provide GUI components that are more strong and versatile than AWT. The library package javax.swing provides a set of lightweight (all-Java language) components that work the same on all platforms. A program that uses Swing components will have the same look and feel on a Mac, Windows, or Unix platform. Such programs are much more portable than those which rely on AWT components and the underlying platform. Because they are rendered entirely by Java code, Swing components make it possible to design GUIs that are truly platform independent. The Swing library makes it possible to write GUI programs entirely in Java. The Swing GUI components are part of the Java Foundation Classes (JFC), a collection of classes that do not depend as much on the underlying platform. ![]() The more advanced Java Swing library was first introduced in JDK 1.1 and was extensively revised in JDK 1.2. The Abstract Windowing Toolkit (AWT) has been part of Java since the original 1.0 version of the JDK 1.0. ![]() Ever since the release of version 1.2 of the Java Development Kit (JDK) in 2000, Java has contained two distinct libraries of GUI components. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |