public int getOrientation() { return bar.getOrientation(); } public int getUnitIncrement() {
public int getOrientation() { return bar.getOrientation(); } public int getUnitIncrement() {
@Override public int getOrientation() { return bar.getOrientation(); }
@Override JScrollBar initSwingComponent() { Scrollbar sb = getAWTComponent(); int orientation = sb.getOrientation(); int swingOrientation; if (orientation == Scrollbar.HORIZONTAL) { swingOrientation = JScrollBar.HORIZONTAL; } else { assert orientation == Scrollbar.VERTICAL; swingOrientation = JScrollBar.VERTICAL; } return new JScrollBar(swingOrientation); }
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); }