public int getMinimum() { return bar.getMinimum(); } public int getOrientation() {
@Override public int getMinimum() { return bar.getMinimum(); }
public int getMinimum() { return bar.getMinimum(); } public int getOrientation() {
public void selectLine(int index) { //int ys = panel.getFontMetrics(getFont()).getHeight() + 2; //int y = ys * (index + 1) + 2; // absolute y coordinate //int totalHeight = ys * panel.getLineCount(); Scrollbar ss = null; Component[] components = panel.getComponents(); for (int i=0; i<components.length; i++) { if (components[i] instanceof Scrollbar) { Scrollbar s = (Scrollbar) components[i]; if (s.getOrientation() == Scrollbar.VERTICAL) { ss = s; } } } //int height = panel.getHeight(); // convert absolute y value to scrollbar and relative y coordinates int min = ss.getMinimum(); int scrollValue = min + index; ss.setValue(scrollValue); panel.adjustmentValueChanged(null); }
public void selectLine(int index) { //int ys = panel.getFontMetrics(getFont()).getHeight() + 2; //int y = ys * (index + 1) + 2; // absolute y coordinate //int totalHeight = ys * panel.getLineCount(); Scrollbar ss = null; Component[] components = panel.getComponents(); for (int i=0; i<components.length; i++) { if (components[i] instanceof Scrollbar) { Scrollbar s = (Scrollbar) components[i]; if (s.getOrientation() == Scrollbar.VERTICAL) { ss = s; } } } //int height = panel.getHeight(); // convert absolute y value to scrollbar and relative y coordinates int min = ss.getMinimum(); int scrollValue = min + index; ss.setValue(scrollValue); panel.adjustmentValueChanged(null); }
GUI( final ImagePlus imp ) { window = imp.getWindow(); canvas = imp.getCanvas(); scrollBar = ( Scrollbar )( ( Panel )window.getComponent( 1 ) ).getComponent( 1 ); scrollBarValue = scrollBar.getValue(); scrollBarVisible = scrollBar.getVisibleAmount(); scrollBarMin = scrollBar.getMinimum(); scrollBarMax = scrollBar.getMaximum(); ij = IJ.getInstance(); }
GUI( final ImagePlus imp ) { window = imp.getWindow(); canvas = imp.getCanvas(); scrollBar = ( Scrollbar )( ( Panel )window.getComponent( 1 ) ).getComponent( 1 ); scrollBarValue = scrollBar.getValue(); scrollBarVisible = scrollBar.getVisibleAmount(); scrollBarMin = scrollBar.getMinimum(); scrollBarMax = scrollBar.getMaximum(); ij = IJ.getInstance(); }
@Override void postInitSwingComponent() { super.postInitSwingComponent(); Scrollbar sb = getAWTComponent(); setValues(sb.getValue(), sb.getVisibleAmount(), sb.getMinimum(), sb.getMaximum()); setLineIncrement(sb.getUnitIncrement()); setPageIncrement(sb.getBlockIncrement()); }