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 ‘JButton’

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 →

JButton and ActionListener

JButton Example

It is a simple example which has only two components in it. One is JButton and the other one JLabel. When user clicks the Flip Mode button, the Label changes its caption from Read Mode to Write Mode. Upon clicking the button again, the label restores its original caption Read Mode. So during each click, the Label will alternate between the text Read Mode & Write Mode. Let us proceed with the coding:

Continue Reading →