A JSpinner with min and max buttons

前端 未结 3 766
梦谈多话
梦谈多话 2021-01-24 23:11

I\'m looking for a JSpinner-like component that would provide built-in buttons that would immediately set the spinner value to the minimum or the maximum of the jspinner model.

3条回答
  •  南笙
    南笙 (楼主)
    2021-01-24 23:40

    I think it would be simple to implemt it by yourself

    1) I would create a class that extend JPanel.

    class MyPanel extends JPanel
    

    2) In this class you have to define where your slider and buttons have to be placed and the actions correlated to the button.

    public MyPanel(){
      super();
      // set the layout
      JSlider slider = new Slider();
      this.add(slider);
      // ..
      JButton button1 = new JButton();
      //
    }
    

    3) You can add to your application JPanel instances of the class the you have implemented.

提交回复
热议问题