List of usage examples for javax.swing JScrollBar JScrollBar
public JScrollBar(int orientation)
minimum = 0 maximum = 100 value = 0 extent = 10
From source file:Main.java
public static void main(String args[]) throws Exception { ChangeListener changeListener = new BoundedChangeListener(); JScrollBar anotherJScrollBar = new JScrollBar(JScrollBar.HORIZONTAL); BoundedRangeModel model = anotherJScrollBar.getModel(); model.addChangeListener(changeListener); System.out.println(model.getMaximum()); JFrame frame = new JFrame("ScrollBars R Us"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(anotherJScrollBar, BorderLayout.NORTH); frame.setSize(300, 200);//from w ww. j ava2 s .c o m frame.setVisible(true); }
From source file:Main.java
public static void main(String args[]) throws Exception { ChangeListener changeListener = new BoundedChangeListener(); JScrollBar anotherJScrollBar = new JScrollBar(JScrollBar.HORIZONTAL); BoundedRangeModel model = anotherJScrollBar.getModel(); model.addChangeListener(changeListener); model.setMinimum(10);/*from ww w .ja v a 2s. c o m*/ JFrame frame = new JFrame("ScrollBars R Us"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(anotherJScrollBar, BorderLayout.NORTH); frame.setSize(300, 200); frame.setVisible(true); }
From source file:Main.java
public static void main(String args[]) throws Exception { ChangeListener changeListener = new BoundedChangeListener(); JScrollBar anotherJScrollBar = new JScrollBar(JScrollBar.HORIZONTAL); BoundedRangeModel model = anotherJScrollBar.getModel(); model.addChangeListener(changeListener); model.removeChangeListener(changeListener); JFrame frame = new JFrame("ScrollBars R Us"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(anotherJScrollBar, BorderLayout.NORTH); frame.setSize(300, 200);/*from www .ja v a 2 s. c o m*/ frame.setVisible(true); }
From source file:Main.java
public static void main(String args[]) throws Exception { ChangeListener changeListener = new BoundedChangeListener(); JScrollBar anotherJScrollBar = new JScrollBar(JScrollBar.HORIZONTAL); BoundedRangeModel model = anotherJScrollBar.getModel(); model.addChangeListener(changeListener); model.setValue(1);// ww w. ja va 2 s. c o m JFrame frame = new JFrame("ScrollBars R Us"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(anotherJScrollBar, BorderLayout.NORTH); frame.setSize(300, 200); frame.setVisible(true); }
From source file:Main.java
public static void main(String args[]) throws Exception { ChangeListener changeListener = new BoundedChangeListener(); JScrollBar anotherJScrollBar = new JScrollBar(JScrollBar.HORIZONTAL); BoundedRangeModel model = anotherJScrollBar.getModel(); model.addChangeListener(changeListener); System.out.println(model.getValueIsAdjusting()); JFrame frame = new JFrame("ScrollBars R Us"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(anotherJScrollBar, BorderLayout.NORTH); frame.setSize(300, 200);/* w ww. j a v a2s.c o m*/ frame.setVisible(true); }
From source file:Main.java
public static void main(String args[]) throws Exception { ChangeListener changeListener = new BoundedChangeListener(); JScrollBar anotherJScrollBar = new JScrollBar(JScrollBar.HORIZONTAL); BoundedRangeModel model = anotherJScrollBar.getModel(); model.addChangeListener(changeListener); model.setMaximum(10);/*from w w w . ja v a 2 s . c o m*/ JFrame frame = new JFrame("ScrollBars R Us"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(anotherJScrollBar, BorderLayout.NORTH); frame.setSize(300, 200); frame.setVisible(true); }
From source file:ScrollBarSample.java
public static void main(String args[]) { AdjustmentListener adjustmentListener = new AdjustmentListener() { public void adjustmentValueChanged(AdjustmentEvent adjustmentEvent) { System.out.println("Adjusted: " + adjustmentEvent.getValue()); }//from w w w . j a va2 s . c o m }; JScrollBar oneJScrollBar = new JScrollBar(JScrollBar.HORIZONTAL); oneJScrollBar.addAdjustmentListener(adjustmentListener); JFrame frame = new JFrame("ScrollBars R Us"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(oneJScrollBar, BorderLayout.NORTH); frame.setSize(300, 200); frame.setVisible(true); }
From source file:MainClass.java
public static void main(String args[]) throws Exception { AdjustmentListener adjustmentListener = new AdjustmentListener() { public void adjustmentValueChanged(AdjustmentEvent adjustmentEvent) { System.out.println("Adjusted: " + adjustmentEvent.getValue()); }/* ww w . j av a 2 s . c o m*/ }; JScrollBar oneJScrollBar = new JScrollBar(JScrollBar.HORIZONTAL); oneJScrollBar.addAdjustmentListener(adjustmentListener); JFrame frame = new JFrame("ScrollBars R Us"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(oneJScrollBar, BorderLayout.NORTH); frame.setSize(300, 200); frame.setVisible(true); }
From source file:TextSlider.java
public static void main(String args[]) { JFrame frame = new JFrame("Text Slider"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final JTextField textField = new JTextField(); JScrollBar scrollBar = new JScrollBar(JScrollBar.HORIZONTAL); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); BoundedRangeModel brm = textField.getHorizontalVisibility(); scrollBar.setModel(brm);/*w ww .j a v a2 s .c om*/ panel.add(textField); panel.add(scrollBar); final TextSlider ts = new TextSlider(); textField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("Text: " + textField.getText()); } }); frame.add(panel, BorderLayout.NORTH); frame.setSize(300, 100); frame.setVisible(true); }
From source file:BoundedChangeListener.java
public static void main(String args[]) { ChangeListener changeListener = new BoundedChangeListener(); JScrollBar aJScrollBar = new JScrollBar(JScrollBar.HORIZONTAL); BoundedRangeModel model = aJScrollBar.getModel(); model.addChangeListener(changeListener); JFrame frame = new JFrame("ScrollBars R Us"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(aJScrollBar, BorderLayout.NORTH); frame.setSize(300, 200);//from w ww . j av a 2s . c om frame.setVisible(true); }