List of usage examples for javax.swing JScrollBar setBlockIncrement
@BeanProperty(preferred = true, description = "The scrollbar's block increment.") public void setBlockIncrement(int blockIncrement)
From source file:Main.java
public Main() { setLayout(new BorderLayout()); JScrollBar hbar = new JScrollBar(JScrollBar.HORIZONTAL, 30, 20, 0, 300); JScrollBar vbar = new JScrollBar(JScrollBar.VERTICAL, 30, 40, 0, 300); hbar.setUnitIncrement(2);// w w w . j a v a 2 s . co m hbar.setBlockIncrement(1); hbar.addAdjustmentListener(new MyAdjustmentListener()); vbar.addAdjustmentListener(new MyAdjustmentListener()); add(hbar, BorderLayout.SOUTH); add(vbar, BorderLayout.EAST); add(label, BorderLayout.CENTER); }
From source file:MainClass.java
public MainClass() { super(true);/*from ww w. j a v a 2 s . c o m*/ setLayout(new BorderLayout()); JScrollBar hbar = new JScrollBar(JScrollBar.HORIZONTAL, 30, 20, 0, 300); JScrollBar vbar = new JScrollBar(JScrollBar.VERTICAL, 30, 40, 0, 300); hbar.setUnitIncrement(2); hbar.setBlockIncrement(1); hbar.addAdjustmentListener(new MyAdjustmentListener()); vbar.addAdjustmentListener(new MyAdjustmentListener()); add(hbar, BorderLayout.SOUTH); add(vbar, BorderLayout.EAST); add(label, BorderLayout.CENTER); }
From source file:SwingScrollBarExample.java
public SwingScrollBarExample() { super(true);// w w w .j a v a 2 s . c om label = new JLabel(); setLayout(new BorderLayout()); JScrollBar hbar = new JScrollBar(JScrollBar.HORIZONTAL, 30, 20, 0, 300); JScrollBar vbar = new JScrollBar(JScrollBar.VERTICAL, 30, 40, 0, 300); hbar.setUnitIncrement(2); hbar.setBlockIncrement(1); hbar.addAdjustmentListener(new MyAdjustmentListener()); vbar.addAdjustmentListener(new MyAdjustmentListener()); add(hbar, BorderLayout.SOUTH); add(vbar, BorderLayout.EAST); add(label, BorderLayout.CENTER); }
From source file:com.att.aro.ui.view.waterfalltab.WaterfallPanel.java
/** * Setting the time range for the graph. * @param low/* ww w. j a va2s .com*/ * @param high */ private void setTimeRange(double low, double high) { double lTime = low; double hTime = high; boolean zoomInEnabled = true; boolean zoomOutEnabled = true; JScrollBar scrollBarr = getHorizontalScroll(); if (hTime > traceDuration) { double delta = hTime - traceDuration; lTime = lTime - delta; hTime = hTime - delta; if (lTime < 0) { lTime = 0.0; } } if (hTime - lTime <= 1.0) { hTime = lTime + 1.0; zoomInEnabled = false; } if ((hTime - lTime) < traceDuration) { zoomOutEnabled = true; } else { zoomOutEnabled = false; } // logger.log(Level.FINE, "Range set to {0} - {1}", new Object[] {low, high}); scrollBarr.setValue((int) lTime); scrollBarr.setVisibleAmount((int) Math.ceil(hTime - lTime)); scrollBarr.setBlockIncrement(scrollBarr.getVisibleAmount()); // Enable zoom buttons appropriately zoomOutButton.setEnabled(zoomOutEnabled); zoomInButton.setEnabled(zoomInEnabled); }
From source file:savant.view.variation.swing.VariationModule.java
public void visibleRangeChanged(String ref, Range r) { if (r.getLength() > ResolutionSettings.getVariantLowToHighThreshold()) { showMessage(ZOOM_MESSAGE);/* w ww. jav a2 s .co m*/ } else { try { // Detach the adjustment listeners so that setting the maximum doesn't fire an event. for (JScrollBar sb : scrollers) { sb.removeAdjustmentListener(scrollerListener); } for (JScrollBar sb : scrollers) { sb.setMaximum(LocationController.getInstance().getMaxRangeEnd()); sb.setValue(r.getFrom()); sb.setVisibleAmount(r.getLength()); sb.setBlockIncrement(r.getLength()); sb.repaint(); } } finally { // Reattach the adjustment listeners. for (JScrollBar sb : scrollers) { sb.addAdjustmentListener(scrollerListener); } } } rangeField.setText(String.format("%s:%d-%d", ref, r.getFrom(), r.getTo())); }