Example usage for javax.swing BoundedRangeModel toString

List of usage examples for javax.swing BoundedRangeModel toString

Introduction

In this page you can find the example usage for javax.swing BoundedRangeModel toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:test.uk.co.modularaudio.util.swing.lwtc.TestShowLWTCSliderComparison.java

public void go(final int orientation) throws Exception {

    final JSlider testSwingJSlider = new JSlider(orientation);
    testSwingJSlider.setOpaque(false);//from ww  w .j  av  a 2  s .co m

    final BoundedRangeModel defaultSwingSliderModel = testSwingJSlider.getModel();
    log.debug("Default swing slider model is " + defaultSwingSliderModel.toString());

    final JFrame f = new JFrame();

    f.getContentPane().setBackground(Color.decode("#3a5555"));

    final MigLayoutStringHelper msg = new MigLayoutStringHelper();
    //      msg.addLayoutConstraint( "debug" );
    msg.addLayoutConstraint("fill");
    msg.addLayoutConstraint("insets 0");
    msg.addLayoutConstraint("gap 0");
    if (orientation == SwingConstants.VERTICAL) {
        msg.addColumnConstraint("[][grow][grow][]");
        msg.addRowConstraint("[][grow][]");
    } else {
        msg.addColumnConstraint("[][grow][]");
        msg.addRowConstraint("[][grow][grow][]");
    }
    f.setLayout(msg.createMigLayout());

    f.add(new JLabel("o"), "center");
    f.add(new JLabel("o"), "center");
    if (orientation == SwingConstants.VERTICAL) {
        f.add(new JLabel("o"), "center");
    }
    f.add(new JLabel("o"), "center,wrap");

    f.add(new JLabel("o"), "center");
    if (orientation == SwingConstants.VERTICAL) {
        f.add(verticalKnobContainer, "center, grow");
        f.add(testSwingJSlider, "center, grow");
    } else {
        f.add(horizontalKnobContainer, "center, grow");
    }
    f.add(new JLabel("o"), "center,wrap");

    if (orientation == SwingConstants.HORIZONTAL) {
        f.add(new JLabel("o"), "center");
        f.add(testSwingJSlider, "center, grow");
        f.add(new JLabel("o"), "center, wrap");
    }

    f.add(new JLabel("o"), "center");
    if (orientation == SwingConstants.VERTICAL) {
        f.add(new JLabel("o"), "center");
    }
    f.add(new JLabel("o"), "center");
    f.add(new JLabel("o"), "center");

    f.pack();

    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    SwingUtilities.invokeLater(new Runnable() {

        @Override
        public void run() {
            f.setVisible(true);
        }
    });
}