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 box, radio button and menu …

Java Button Example with ActionListener Event Handling Read More »

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 randomly, here we use java.util.Random …

Java Create Random Color Read More »

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. When Red button is clicked, …

Java make Button Invisible Read More »