List of usage examples for java.awt.event AdjustmentEvent getValue
public int getValue()
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()); }/* w w w . ja va 2s.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()); }/*w w w. ja va 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:Main.java
private static void dumpInfo(AdjustmentEvent e) { System.out.println("Value: " + e.getValue()); String type = null;/* w w w . java 2 s .c o m*/ switch (e.getAdjustmentType()) { case AdjustmentEvent.TRACK: type = "Track"; break; case AdjustmentEvent.BLOCK_DECREMENT: type = "Block Decrement"; break; case AdjustmentEvent.BLOCK_INCREMENT: type = "Block Increment"; break; case AdjustmentEvent.UNIT_DECREMENT: type = "Unit Decrement"; break; case AdjustmentEvent.UNIT_INCREMENT: type = "Unit Increment"; break; } System.out.println("Type: " + type); }
From source file:Main.java
private static void dumpInfo(AdjustmentEvent e) { System.out.println("\tValue: " + e.getValue()); String type = null;//w ww . j ava 2 s . c o m switch (e.getAdjustmentType()) { case AdjustmentEvent.TRACK: type = "Track"; break; case AdjustmentEvent.BLOCK_DECREMENT: type = "Block Decrement"; break; case AdjustmentEvent.BLOCK_INCREMENT: type = "Block Increment"; break; case AdjustmentEvent.UNIT_DECREMENT: type = "Unit Decrement"; break; case AdjustmentEvent.UNIT_INCREMENT: type = "Unit Increment"; break; } System.out.println("\tType: " + type); }
From source file:Main.java
public void adjustmentValueChanged(AdjustmentEvent e) { System.out.println(" New Value is " + e.getValue() + " "); }
From source file:Main.java
Main() { JFrame f = new JFrame(); f.setLayout(new FlowLayout()); f.setSize(280, 300);//from ww w . ja va 2 s .com f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); scrollBarVertical.setPreferredSize(new Dimension(20, 200)); scrollbarHorizontal.setPreferredSize(new Dimension(200, 20)); scrollbarHorizontal.setValue(50); scrollBarVertical.addAdjustmentListener(new AdjustmentListener() { public void adjustmentValueChanged(AdjustmentEvent ae) { if (scrollBarVertical.getValueIsAdjusting()) return; System.out.println("Value of vertical scroll bar: " + ae.getValue()); } }); scrollbarHorizontal.addAdjustmentListener(new AdjustmentListener() { public void adjustmentValueChanged(AdjustmentEvent ae) { System.out.println("Value of horizontal scroll bar: " + ae.getValue()); } }); f.add(scrollBarVertical); f.add(scrollbarHorizontal); f.setVisible(true); }
From source file:org.fhaes.fhrecorder.view.GraphPanel.java
/** * Constructor for the Graphics Panel. Sets up layout and settings of all components. *///from w w w.j a va 2 s . com public GraphPanel() { data = FileController.getYearSummaryList(); setLayout(new MigLayout("", "[grow,right]", "[fill][300px,grow,fill][][]")); JButton customizeButton = new JButton("Customize"); customizeButton.setIcon(Builder.getImageIcon("configure.png")); customizeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { showCustomizeWindow(); } }); zoomOutButton = new JButton(""); zoomOutButton.setIcon(Builder.getImageIcon("zoom_out.png")); zoomOutButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { setZoomLevel(zoomLevel + 1); } }); add(zoomOutButton, "flowx,cell 0 0"); zoomInButton = new JButton(""); zoomInButton.setIcon(Builder.getImageIcon("zoom_in.png")); zoomInButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { setZoomLevel(zoomLevel - 1); } }); add(zoomInButton, "cell 0 0"); add(customizeButton, "cell 0 0,alignx right"); rigidArea = Box.createRigidArea(new Dimension(20, 20)); rigidArea.setMaximumSize(new Dimension(200, 20)); rigidArea.setMinimumSize(new Dimension(1, 20)); add(rigidArea, "cell 0 1"); colorPane = new ColorBarGraph(data); colorPane.addMouseWheelListener(new MouseWheelListener() { @Override public void mouseWheelMoved(MouseWheelEvent e) { int notches = e.getWheelRotation(); setZoomLevel(zoomLevel + notches); } }); add(colorPane, "cell 0 1,growx"); scrollBar = new JScrollBar(); scrollBar.setMinimum(0); scrollBar.setMaximum(data.size()); scrollBar.addAdjustmentListener(new AdjustmentListener() { @Override public void adjustmentValueChanged(AdjustmentEvent event) { setChartsFirstCategoryIndex(event.getValue()); } }); overlayPane = new GraphSummaryOverlay(data); overlayPane.addMouseWheelListener(new MouseWheelListener() { @Override public void mouseWheelMoved(MouseWheelEvent e) { int notches = e.getWheelRotation(); setZoomLevel(zoomLevel + notches); } }); add(overlayPane, "cell 0 2,growx"); scrollBar.setOrientation(JScrollBar.HORIZONTAL); add(scrollBar, "cell 0 3,growx"); refreshCharts(false); }
From source file:edu.pdi2.visual.ThresholdSignature.java
private void scrollBarAdjustmentValueChanged(AdjustmentEvent evt) { Integer index = (Integer) evt.getSource(); valueLabels[index].setText(Integer.toString(evt.getValue())); banda[index] = evt.getValue();/*w w w.j a v a 2 s.c om*/ plot(); }
From source file:SplineAnim.java
public void adjustmentValueChanged(AdjustmentEvent e) { int value = e.getValue(); duration = 6000 - (500 * value);/* ww w . ja v a 2 s . co m*/ animAlpha.setIncreasingAlphaDuration(duration); }
From source file:Main.java
public void adjustmentValueChanged(AdjustmentEvent evt) { Adjustable source = evt.getAdjustable(); if (evt.getValueIsAdjusting()) { return;/*from ww w. j a v a 2 s . c o m*/ } int orient = source.getOrientation(); if (orient == Adjustable.HORIZONTAL) { System.out.println("from horizontal scrollbar"); } else { System.out.println("from vertical scrollbar"); } int type = evt.getAdjustmentType(); switch (type) { case AdjustmentEvent.UNIT_INCREMENT: System.out.println("Scrollbar was increased by one unit"); break; case AdjustmentEvent.UNIT_DECREMENT: System.out.println("Scrollbar was decreased by one unit"); break; case AdjustmentEvent.BLOCK_INCREMENT: System.out.println("Scrollbar was increased by one block"); break; case AdjustmentEvent.BLOCK_DECREMENT: System.out.println("Scrollbar was decreased by one block"); break; case AdjustmentEvent.TRACK: System.out.println("The knob on the scrollbar was dragged"); break; } int value = evt.getValue(); }