Introduction
In this section, you will learn about the event handling for a swing component named Slide bar. This section provides a complete solution for the appropriate functionality by providing a program.
Program Description:
This program gives you two slide bar and a image inside the frame. One slide bar is arranged as horizontal while another one is as vertical. And the image is stayed in between both slide bar. When you drag the horizontal slide bar then the image will be increased or decreased from left and right according to the value of the slide bar while when you drag the vertical slide bar then the image will be increased or creased from top and bottom according to the value of the slide bar.
Code Description:
In this program, you will see that the complete code has been written under the DynamicIconText class. This class has a main method in which there are two slide bars have been created by using JSlider class and it's constructor. Constructor of JSlider class is has four parameters as follows:
There are some APIs are explained below these are used in the following program:
getValue(): This method is used for getting value of the slide bar. This method returns a integer value.
Here is the code of this program:
import javax.swing.*;
|
Output this program:

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Event on Slide bar In Java View All Comments
Post your Comment