Programming Examples

Are you a Programmer or Application Developer or a DBA? Take a cup of coffee, sit back and spend few minutes here :)

Tag Archive for ‘ImageIcon’

JToolBar – Floating & Docking

Java Swing JToolbar Example

This example has two toolbars in it. One is in the top part of the Frame window and other one is in the bottom part. Each of the toolbar contains three buttons on it and each button is assigned with one image icon. Very first button in the top toolbar shows a message when the user clicks it. When we proceed with the example, we will also learn how to use floating toolbar and study rollover behaviour.

Continue Reading →

JCheckBoxMenuItem & Checked

Java Swing JCheckBox MenuItem Example

The example has a menu called fruits. When the user clicks the Fruits menu, they can see four Checkbox menu items along with Image Icons. At the bottom of the screen, there is a text field which reports all the checked check boxes. In the above picture, Banana & Cherry check boxes are checked and hence the text field shows Banana and Cherry in it. When the user clicks a menu item, a check mark appears in the check box, and it disappears when the user clicks it again.

Continue Reading →

JButton Rollover Image

JButton RollOver Icon

In the example below, we have three Java Swing JButtons. All these buttons display a normal image when the JFrame displays. Each button will display three image icons based on the mouse action. The images for Normal, button pressed and mouse-enter are shown in the above screen. Let us proceed with the example and start coding.

Continue Reading →