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


Java MetalSliderUI类代码示例

本文整理汇总了Java中javax.swing.plaf.metal.MetalSliderUI的典型用法代码示例。如果您正苦于以下问题:Java MetalSliderUI类的具体用法?Java MetalSliderUI怎么用?Java MetalSliderUI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: test

import javax.swing.plaf.metal.MetalSliderUI; //导入依赖的package包/类
private static void test(JSlider slider) {
    MetalSliderUI ui = (MetalSliderUI) slider.getUI();
    int actual = ui.getTickLength();
    if (actual != 11) {
        throw new Error(actual + ", but expected 11");
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:Test6657026.java

示例2: MainPanel

import javax.swing.plaf.metal.MetalSliderUI; //导入依赖的package包/类
private MainPanel() {
    super(new BorderLayout(5, 5));

    JSlider slider1 = new JSlider(0, 100, 0);
    slider1.setUI(new TriSliderUI());
    slider1.setMajorTickSpacing(10);
    slider1.setMinorTickSpacing(5);
    slider1.setPaintTicks(true);
    slider1.setPaintLabels(true);

    JSlider slider2 = new JSlider(0, 100, 0);
    slider2.setUI(new MetalSliderUI() {
        @Override protected void paintHorizontalLabel(Graphics g, int v, Component l) {
            // [JDK-5099681] Windows/Motif L&F: JSlider should use foreground color for ticks. - Java Bug System
            // https://bugs.openjdk.java.net/browse/JDK-5099681
            JLabel lbl = (JLabel) l;
            lbl.setForeground(Color.GREEN);
            super.paintHorizontalLabel(g, v, lbl);
        }
    });
    // slider2.setBackground(Color.BLACK);
    slider2.setForeground(Color.BLUE);
    slider2.setMajorTickSpacing(10);
    slider2.setMinorTickSpacing(5);
    slider2.setPaintTicks(true);
    slider2.setPaintLabels(true);

    Box box = Box.createVerticalBox();
    box.add(Box.createVerticalStrut(5));
    box.add(makeTitledPanel("TriangleSliderUI", slider1));
    box.add(Box.createVerticalStrut(5));
    box.add(makeTitledPanel("HorizontalLabelColor", slider2));
    box.add(Box.createVerticalGlue());
    add(box);
    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    setPreferredSize(new Dimension(320, 240));
}
 
开发者ID:aterai,项目名称:java-swing-tips,代码行数:38,代码来源:MainPanel.java

示例3: setLogSliderUI

import javax.swing.plaf.metal.MetalSliderUI; //导入依赖的package包/类
private void setLogSliderUI() {
	if (this.getUI() instanceof MetalSliderUI) {
		this.setUI(new LogMetalSliderUI(this));
	} else {
		this.setUI(new LogBasicSliderUI(this));
	}
}
 
开发者ID:BrainTech,项目名称:svarog,代码行数:8,代码来源:LogarithmicJSlider.java


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