/** * Sets the value added or subtracted to the scrollbar value when the * user selects the scroll by a "unit" amount control. * * @param lineIncrement The new unit increment amount. * * @deprecated This method is deprecated in favor of * <code>setUnitIncrement()</code>. */ public void setLineIncrement(int lineIncrement) { if (lineIncrement < 0) throw new IllegalArgumentException("Unit increment less than zero."); if (lineIncrement == 0) lineIncrement = 1; if (lineIncrement == this.lineIncrement) return; this.lineIncrement = lineIncrement; ScrollbarPeer peer = (ScrollbarPeer) getPeer(); if (peer != null) peer.setLineIncrement(this.lineIncrement); }
/** * Sets the value added or subtracted to the scrollbar value when the * user selects the scroll by a "block" amount control. * * @param pageIncrement The new block increment amount. * * @deprecated This method is deprecated in favor of * <code>setBlockIncrement()</code>. */ public void setPageIncrement(int pageIncrement) { if (pageIncrement < 0) throw new IllegalArgumentException("Block increment less than zero."); if (pageIncrement == 0) pageIncrement = 1; if (pageIncrement == this.pageIncrement) return; this.pageIncrement = pageIncrement; ScrollbarPeer peer = (ScrollbarPeer) getPeer(); if (peer != null) peer.setPageIncrement(this.pageIncrement); }
public static boolean attachFakePeer(Component comp) { if (comp == null || comp.isDisplayable() || comp instanceof javax.swing.JComponent || comp instanceof javax.swing.RootPaneContainer) return false; FakePeer peer = null; if (comp instanceof Label) peer = getFakePeer(LabelPeer.class, new FakeLabelPeer((Label) comp)); else if (comp instanceof Button) peer = getFakePeer(ButtonPeer.class, new FakeButtonPeer((Button) comp)); else if (comp instanceof Panel) peer = getFakePeer(new Class[] {ContainerPeer.class, PanelPeer.class}, new FakePanelPeer((Panel) comp)); else if (comp instanceof TextField) peer = getFakePeer(new Class[] {TextFieldPeer.class, TextComponentPeer.class}, new FakeTextFieldPeer((TextField) comp)); else if (comp instanceof TextArea) peer = getFakePeer(new Class[] {TextAreaPeer.class, TextComponentPeer.class}, new FakeTextAreaPeer((TextArea) comp)); else if (comp instanceof TextComponent) peer = getFakePeer(TextComponentPeer.class, new FakeTextComponentPeer((TextComponent) comp)); else if (comp instanceof Checkbox) peer = getFakePeer(CheckboxPeer.class, new FakeCheckboxPeer((Checkbox) comp)); else if (comp instanceof Choice) peer = getFakePeer(ChoicePeer.class, new FakeChoicePeer((Choice) comp)); else if (comp instanceof List) peer = getFakePeer(ListPeer.class, new FakeListPeer((List) comp)); else if (comp instanceof Scrollbar) peer = getFakePeer(ScrollbarPeer.class, new FakeScrollbarPeer((Scrollbar) comp)); else if (comp instanceof ScrollPane) peer = getFakePeer(new Class[] {ContainerPeer.class, ScrollPanePeer.class}, new FakeScrollPanePeer((ScrollPane) comp)); else if (comp instanceof Canvas) peer = getFakePeer(CanvasPeer.class, new FakeCanvasPeer((Canvas) comp)); else return false; attachFakePeer(comp, peer); return true; }
/** * @deprecated As of JDK version 1.1, * replaced by <code>setUnitIncrement(int)</code>. */ @Deprecated public synchronized void setLineIncrement(int v) { int tmp = (v < 1) ? 1 : v; if (lineIncrement == tmp) { return; } lineIncrement = tmp; ScrollbarPeer peer = (ScrollbarPeer)this.peer; if (peer != null) { peer.setLineIncrement(lineIncrement); } }
/** * @deprecated As of JDK version 1.1, * replaced by <code>setBlockIncrement()</code>. */ @Deprecated public synchronized void setPageIncrement(int v) { int tmp = (v < 1) ? 1 : v; if (pageIncrement == tmp) { return; } pageIncrement = tmp; ScrollbarPeer peer = (ScrollbarPeer)this.peer; if (peer != null) { peer.setPageIncrement(pageIncrement); } }
/** * Sets the unit increment for this scroll bar. * * @param v the increment value * * @deprecated As of JDK version 1.1, * replaced by {@code setUnitIncrement(int)}. */ @Deprecated public synchronized void setLineIncrement(int v) { int tmp = (v < 1) ? 1 : v; if (lineIncrement == tmp) { return; } lineIncrement = tmp; ScrollbarPeer peer = (ScrollbarPeer)this.peer; if (peer != null) { peer.setLineIncrement(lineIncrement); } }
/** * Sets the block increment for this scroll bar. * * @param v the block increment * @deprecated As of JDK version 1.1, * replaced by {@code setBlockIncrement()}. */ @Deprecated public synchronized void setPageIncrement(int v) { int tmp = (v < 1) ? 1 : v; if (pageIncrement == tmp) { return; } pageIncrement = tmp; ScrollbarPeer peer = (ScrollbarPeer)this.peer; if (peer != null) { peer.setPageIncrement(pageIncrement); } }
/** * Sets the current value, visible amount, minimum, and maximum for this * scrollbar. These values are adjusted to be internally consistent * if necessary. * * @param value The new value for this scrollbar. * @param visibleAmount The new visible amount for this scrollbar. * @param minimum The new minimum value for this scrollbar. * @param maximum The new maximum value for this scrollbar. */ public synchronized void setValues(int value, int visibleAmount, int minimum, int maximum) { if (visibleAmount <= 0) visibleAmount = 1; if (maximum <= minimum) maximum = minimum + 1; if (value < minimum) value = minimum; if (visibleAmount > maximum - minimum) visibleAmount = maximum - minimum; // According to documentation, the actual maximum // value is (maximum - visibleAmount) if (value > maximum - visibleAmount) value = maximum - visibleAmount; ScrollbarPeer peer = (ScrollbarPeer) getPeer(); if (peer != null && (this.value != value || this.visibleAmount != visibleAmount || this.minimum != minimum || this.maximum != maximum)) peer.setValues(value, visibleAmount, minimum, maximum); this.value = value; this.visibleAmount = visibleAmount; this.minimum = minimum; this.maximum = maximum; }