Friday, August 30, 2013

JSpinner

http://stackoverflow.com/questions/16632104/jspinner-with-display-format-numbers-only-and-manual-edit
http://www.jroller.com/dpmihai/entry/documentfilter


To access the buttons:

jSpinner1.setUI(new MyUI());

class MyUI extends javax.swing.plaf.basic.BasicSpinnerUI {

        protected Component createNextButton() {
            JButton btnUp = (JButton) super.createNextButton();
            btnUp.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                   
                    System.out.println("Going up");
                }
            });
            return btnUp;
        }

        protected Component createPreviousButton() {
            JButton btnDown = (JButton) super.createPreviousButton();
            btnDown.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                    System.out.println("Going down");
                }
            });
            return btnDown;
        }
    }

No comments:

Post a Comment