Java Swing ( Java Foundation Classes ) Examples


The javax.swing.JFrame is an extended version of java.awt.Frame which comes under JFC (Java Foundation Classes). It has a method to close when user close frame.


The javax.swing.JApplet is an extended version of java.Applet which comes under JFC (Java Foundation Classes). It is wrotten in Java Programming language which can be run in any Java enabled browser or appletviewer tool of JDK.


Border is capable border around the swing components/controls. The setBorder() is used to set border to the components.You can share the same border in various components using javax.swing.BorderFactory.


The javax.swing.JDialog is an extended version of java.awt.Dialog. It is a container where you can add controls.It is used to take information from the user.


The Event handling describes how can you trap the different kind of events in Java GUI program. The java.awt.event package provide the classes ,interfaces and adapter classes to handle events in Java. The java.awt.AWTEvent class is root event class for all AWT events. Events are fired by event sources.An event listener registers an event source to trap the events of event type.


The layout managers are used to position the components. It implements the java.awt.LayoutManager interface.Java has various predefined classes of layout managers. All layout managers make use of the setLayout() method to set the layout of a container.If the setLayout() method is not used, then the default layout of the container is set.


A menu provides a space-saving way to let the user choose one of several options. Other components with which the user can make a one-of-many choice.


It makes easy to pop up a standard dialog box that prompts users for a value or informs them of something.


The javax.swing.JTable is used to display and edit regular two-dimensional tables of cells.It has many facilities that make it possible to customize its rendering and editing but provides defaults for these features so that simple tables can be set up easily.


A component that facilitate to the user to switch between a group of containers/components by clicking on a tab with a given title.


javax.swing.JToolBar provides a component that is useful for displaying commonly used Actions or controls. Toolbar can drag and drop into a seperate window.


A control that contains the hierarchical data in the form of controls. It is like Windows Explorer.