Button

Java Button Example with ActionListener Event Handling

A simple Java Button Example given to understand how to create components and link to event handling mechanism. User interface (communication-point) with a running Java program can be in two ways – using keyboard input and the other with GUI. Java supports GUI environment through GUI components like button, check…

Java Create Random Color

We know using java.awt.Color class, different colors (nearly 16 million shades) can be created and applied to graphics or components. Using java.util.Random class, various colors can be produced randomly and applied to any component. In the following program, each button click gives different color to the frame. For generating colors…

Java Button Applet

The GUI components can be placed in a frame or an applet (as both are containers). We have seen many programs with frame and now let us write an applet with GUI, say button. While developing applet GUI, the class should extend Applet instead of Frame. The constructor is replaced…

Java Changing Button Label

After learning the GUI creation through 8 steps, for more command over button event handling, apart this one, another two programs are given – Making Button Enabled and Making Button Invisible. In this program, the same button label toggles between Bharath and India. When Bharath is clicked, the button label…

Java make Button Invisible

After learning GUI creation through 8 steps, for more command over button event handling, apart this one, another two programs are given – Changing Button Label and Making Button Enabled. Example on Java make Button Invisible In the following program, three buttons are created with labels Red, Green and Blue.…

Java make Button Enabled

After learning GUI creation through 8 steps, for more command over button event handling, apart this one, another two programs are given – Changing Button Label and Making Button Invisible. In the following program, three buttons are created with labels Red, Green and Blue. When Red button is clicked, the…

Java AWT Button Learn GUI 8 Steps

The java.awt package comes with many GUI components of which Button is the most important and most frequently used. A button functionality (what for it is) can be known by its label like OK or Cancel etc. A mouse click on the button generates an action. Following is the class…