[JAVA] Bureau: curseur Gui

Goal
Gui slider

Gui_Slider.java


import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;

public class Gui_Slider {
    private JFrame frame;

    /**
     * Launch the application.
     */
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    Gui_Slider window = new Gui_Slider();
                    window.frame.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    /**
     * Create the application.
     */
    public Gui_Slider() {
        initialize();
    }

    /**
     * Initialize the contents of the frame.
     */
    private void initialize() {
        frame = new JFrame();
        frame.setBounds(100, 100, 450, 300);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().setLayout(null);

        JLabel lblNewLabel = new JLabel("Test");
        lblNewLabel.setBounds(14, 20, 57, 19);
        frame.getContentPane().add(lblNewLabel);

        JLabel lblNewLabel1 = new JLabel("");
        lblNewLabel1.setBounds(307, 20, 57, 19);
        frame.getContentPane().add(lblNewLabel1);

        JSlider slider = new JSlider();
        slider.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent e) {
                lblNewLabel1.setText(slider.getValue()+"");
            }
        });
        slider.setValue(1);
        slider.setMinimum(1);
        slider.setBounds(93, 13, 200, 26);
        frame.getContentPane().add(slider);
    }
}
Result
![gui_slider.JPG](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/276243/75bb74a3-f421-c8f4-b28d-ec66cdb26606.jpeg)

Recommended Posts

Bureau: curseur Gui
Bureau: bouton Gui
Bureau: OpenCV Sharpness Gui
Bureau: Gui afficher l'image
Bureau: OpenCV Gui modifie la luminosité
Bureau: OpenCV Gui change chaque pixel
Bureau: RoiForRectangle RoiForRectangle
Bureau: GaussianBlurFix
Bureau: OpenCV_OpenCV_GaussianBlur
Bureau: OpenCV_BoxFilterBlur
Bureau: OpenCV_FaceEyeNoseDetectorQuicklyByWebCam
Bureau: OpenCV Gui Change Alpha et Gamma Value