当前位置: 首页>>代码示例>>Java>>正文


Java JScrollBar.HORIZONTAL属性代码示例

本文整理汇总了Java中javax.swing.JScrollBar.HORIZONTAL属性的典型用法代码示例。如果您正苦于以下问题:Java JScrollBar.HORIZONTAL属性的具体用法?Java JScrollBar.HORIZONTAL怎么用?Java JScrollBar.HORIZONTAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.swing.JScrollBar的用法示例。


在下文中一共展示了JScrollBar.HORIZONTAL属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

public void run() {
    if (this.bar == null) {
        this.bar = new JScrollBar(JScrollBar.HORIZONTAL, 50, 10, 0, 100);
        this.bar.setPreferredSize(new Dimension(400, 20));

        JFrame frame = new JFrame();
        frame.add(this.bar);
        frame.pack();
        frame.setVisible(true);
    }
    else if (40 != this.bar.getValue()) {
        System.out.println("name = " + UIManager.getLookAndFeel().getName());
        System.out.println("value = " + this.bar.getValue());
    }
    else {
        SwingUtilities.getWindowAncestor(this.bar).dispose();
        this.bar = null;
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:Test7163696.java

示例2: getScrollDirection

@Override
public int getScrollDirection(JScrollBarOperator oper) {
    Point toPoint = SwingUtilities.
            convertPoint(comp, x, y, getViewport().getView());
    int to = (orientation == JScrollBar.HORIZONTAL) ? toPoint.x : toPoint.y;
    int ln = (orientation == JScrollBar.HORIZONTAL) ? width : height;
    int lv = (orientation == JScrollBar.HORIZONTAL) ? getViewport().getWidth() : getViewport().getHeight();
    int vl = oper.getValue();
    if (to < vl) {
        return ScrollAdjuster.DECREASE_SCROLL_DIRECTION;
    } else if ((to + ln - 1) > (vl + lv)
            && to > vl) {
        return ScrollAdjuster.INCREASE_SCROLL_DIRECTION;
    } else {
        return ScrollAdjuster.DO_NOT_TOUCH_SCROLL_DIRECTION;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:JScrollPaneOperator.java

示例3: createFakeHSB

private JScrollBar createFakeHSB(final JScrollBar hsb) {
    return new JScrollBar(JScrollBar.HORIZONTAL) {

        @Override
        public Dimension getPreferredSize() {
            Dimension dim = hsb.getPreferredSize();
            return new Dimension(dim.width, 2*dim.height);
        }

    };
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:OutlineView.java

示例4: getClickPoint

private Point getClickPoint(JScrollBarOperator oper, JButtonOperator lessButton, JButtonOperator moreButton, int value) {
    int lenght = (oper.getOrientation() == JScrollBar.HORIZONTAL)
            ? oper.getWidth() - lessButton.getWidth() - moreButton.getWidth()
            : oper.getHeight() - lessButton.getHeight() - moreButton.getHeight();
    int subpos = (int) (((float) lenght / (oper.getMaximum() - oper.getMinimum())) * value);
    if (oper.getOrientation() == JScrollBar.HORIZONTAL) {
        subpos = subpos + lessButton.getWidth();
    } else {
        subpos = subpos + lessButton.getHeight();
    }
    subpos = subpos + MINIMAL_DRAGGER_SIZE / 2 + 1;
    return ((oper.getOrientation() == JScrollBar.HORIZONTAL)
            ? new Point(subpos, oper.getHeight() / 2)
            : new Point(oper.getWidth() / 2, subpos));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:JScrollBarDriver.java

示例5: installUI

@Override
public void installUI(JComponent c) {
	super.installUI(c);
	if ((scrollbar.getOrientation() == JScrollBar.HORIZONTAL)) {
		c.setPreferredSize(new Dimension(15, c.getPreferredSize().height));
	} else {
		c.setPreferredSize(new Dimension(c.getPreferredSize().width, 15));
	}
	// c.setMaximumSize(new Dimension(10, Integer.MAX_VALUE));
}
 
开发者ID:kmarius,项目名称:xdman,代码行数:10,代码来源:XDMScrollBarUI.java

示例6: createHorizontalScrollBar

@Override
public JScrollBar createHorizontalScrollBar() {
    return new XAWTScrollBar(JScrollBar.HORIZONTAL);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:XTextAreaPeer.java

示例7: initOperators

private void initOperators() {
    if (minButtOperator != null
            && maxButtOperator != null) {
        return;
    }
    ComponentChooser chooser = new ComponentChooser() {
        @Override
        public boolean checkComponent(Component comp) {
            return comp instanceof JButton;
        }

        @Override
        public String getDescription() {
            return "";
        }

        @Override
        public String toString() {
            return "JScrollBarOperator.initOperators.ComponentChooser{description = " + getDescription() + '}';
        }
    };
    ComponentSearcher searcher = new ComponentSearcher((Container) getSource());
    searcher.setOutput(output.createErrorOutput());
    JButton butt0 = (JButton) searcher.findComponent(chooser, 0);
    JButton butt1 = (JButton) searcher.findComponent(chooser, 1);

    if (butt0 == null || butt1 == null) {
        minButtOperator = null;
        maxButtOperator = null;
        return;
    }

    JButton minButt, maxButt;

    if (((JScrollBar) getSource()).getOrientation() == JScrollBar.HORIZONTAL) {
        if (butt0.getX() < butt1.getX()) {
            minButt = butt0;
            maxButt = butt1;
        } else {
            minButt = butt1;
            maxButt = butt0;
        }
    } else if (butt0.getY() < butt1.getY()) {
        minButt = butt0;
        maxButt = butt1;
    } else {
        minButt = butt1;
        maxButt = butt0;
    }
    minButtOperator = new JButtonOperator(minButt);
    maxButtOperator = new JButtonOperator(maxButt);

    minButtOperator.copyEnvironment(this);
    maxButtOperator.copyEnvironment(this);

    minButtOperator.setOutput(output.createErrorOutput());
    maxButtOperator.setOutput(output.createErrorOutput());

    Timeouts times = timeouts.cloneThis();
    times.setTimeout("AbstractButtonOperator.PushButtonTimeout",
            times.getTimeout("JScrollBarOperator.OneScrollClickTimeout"));

    minButtOperator.setTimeouts(times);
    maxButtOperator.setTimeouts(times);

    minButtOperator.setVisualizer(new EmptyVisualizer());
    maxButtOperator.setVisualizer(new EmptyVisualizer());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:68,代码来源:JScrollBarOperator.java


注:本文中的javax.swing.JScrollBar.HORIZONTAL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。