Java Tutorial

by Dinesh Thakur Category: Swing

Anonymous inner classes can also be used to provide a similar facility as that provided by inner classes.

 
by Dinesh Thakur Category: Swing

Scroll bars are horizontally or vertically oriented bars which allow the user to select items between a specified minimum and maximum values. Each end of the scroll bar has an arrow which can be clicked to change the current value of the scroll bar. The slider box indicates the current value of the scroll bar which can be dragged by the user to a new position. Scrollbar is an object of ScrollBar class.

 
by Dinesh Thakur Category: Swing

showMessageDialog Displays a modal dialog with a button labeled "OK". It can be easily specify the message, icon, and title that will display the dialogue.

A message dialog box displays plain messages to the user and is created by using the static method showMessageDialog () of JOptionPane. The general form of showMessageDialog () method is:

 
by Dinesh Thakur Category: Swing

Lists are supported in Swings by the JList class. It is a very popular control as it allows the user to present a list of items in an easier and efficient manner. It also allows hiding the long list of items by making the lists scrollable. JList has been inherited from a long list of classes.

 
by Dinesh Thakur Category: Swing
 
 
by Dinesh Thakur Category: Swing

The CardLayout constitutes a more enhanced manager that can group multiple containers in the form of cards each showing a time, or that is, only one container at a time is visible. This layout manager is based on the idea of ​​the tabs. Each container can have its layout specific, allowing different layout managers are used in a same window space.

 
by Dinesh Thakur Category: Swing

Every program with a Swing GUI must contain atleast one top level swing container and JFrame is the most commonly used top level container for creating GUI applications.

 
by Dinesh Thakur Category: Swing

In order to add a component to a container, first create an instance of the desired component and then call the add () method of the Container class to add it to a window. The add() method has many forms and one of these is,

 
by Dinesh Thakur Category: Swing
 
by Dinesh Thakur Category: Swing

The option dialog box provides the feature of all the above three discussed dialog boxes. It is created by using the static method showOptionDialog () of JOptionPane. The general form of showOptionDialog () method is

 
by Dinesh Thakur Category: Swing

A button, also known as push button, is an active control that has a 3-dimensional appearance. It triggers an event when it is clicked or activated. Swing also provides an ability to associate an icon, a string, or both with the buttons. A push button is an object of JButton class.

 
by Dinesh Thakur Category: Swing
 
by Dinesh Thakur Category: Swing

Item events occur when a user selects a choice item, a checkbox menu item or a list item. Objects representing item events are created from the ItemEvent class.

 
by Dinesh Thakur Category: Swing

Frame is the most common container used to create top-level window having title, border and window-management buttons. It can also be used to create secondary windows for an application. A frame is an object of JFrame class.

 
by Dinesh Thakur Category: Swing
 
by Dinesh Thakur Category: Swing

A label is a simple control which is used to display text (non-editable) on the window. Since it does not possess any user interactive feature, it is considered as a passive control. A label is an object of

 
by Dinesh Thakur Category: Swing

Progress bar is a user friendly control which is used to indicate the current status of some time consuming tasks such as software installation etc. It indicates the progress of a task by showing the percentage of completion using a color bar. The progress bar can be of two types namely, horizontal progress bar and vertical progress bar. In horizontal progress bar, the progress is indicated by filling the bar from left to right and in vertical progress bar, the progress is indicated by filling the bar from top to bottom. ·

 
by Dinesh Thakur Category: Swing
 
by Dinesh Thakur Category: Swing
 


About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.