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


Java BasicSliderUI类代码示例

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


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

示例1: bug6401380

import javax.swing.plaf.basic.BasicSliderUI; //导入依赖的package包/类
public bug6401380() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    slider = new JSlider();
    slider.setMajorTickSpacing(0);
    slider.setMaximum(50);
    slider.setMinorTickSpacing(10);
    slider.setPaintLabels(true);
    slider.setPaintTicks(true);
    slider.setSnapToTicks(true);

    // MetalSliderUI overrides scrollDueToClickInTrack() method
    // so this test doens't work for Metal
    slider.setUI(new BasicSliderUI(slider));

    add(slider);
    setSize(200, 200);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:bug6401380.java

示例2: TrackableSlider

import javax.swing.plaf.basic.BasicSliderUI; //导入依赖的package包/类
/**
 * Simple constructor.
 * 
 * @param slider
 *            The associated slider.
 */
public TrackableSlider(JSlider slider, ButtonModel transitionModel) {
	this.slider = slider;
	this.transitionModel = transitionModel;

	SliderUI sliderUI = slider.getUI();
	if (sliderUI instanceof BasicSliderUI) {
		try {
			this.thumbRectField = BasicSliderUI.class
					.getDeclaredField("thumbRect");
			this.thumbRectField.setAccessible(true);
		} catch (Exception exc) {
			this.thumbRectField = null;
		}
	}

	this.stateTransitionTracker = new StateTransitionTracker(
			this.slider, this.transitionModel);
}
 
开发者ID:Depter,项目名称:JRLib,代码行数:25,代码来源:SubstanceIconFactory.java

示例3: fixWinSliderUI

import javax.swing.plaf.basic.BasicSliderUI; //导入依赖的package包/类
public static void fixWinSliderUI(JSlider s) {

		if(System.getProperty("os.name").toLowerCase().contains("win")) {
			s.setUI(new BasicSliderUI(s){
				protected Dimension getThumbSize() {

					Dimension old = super.getThumbSize();

					return new Dimension(old.width*2, old.height);
				}
			});
		}
	}
 
开发者ID:CalebKussmaul,项目名称:GIFKR,代码行数:14,代码来源:ViewUtils.java

示例4: getAnimationPanel

import javax.swing.plaf.basic.BasicSliderUI; //导入依赖的package包/类
/**
 * Returns the frames-per-second slider for the animation dialog.
 */
final JPanel getAnimationPanel() {
    // lazily create the label
    if (this.animationPanel == null) {
        JLabel label = new JLabel("Animation Speed");
        label.setAlignmentX(Component.CENTER_ALIGNMENT);
        final JSlider slider = new JSlider(SwingConstants.HORIZONTAL, 1, 10, 2) {
            @Override
            public void updateUI() {
                setUI(BasicSliderUI.createUI(this));
            }
        };
        slider.setMajorTickSpacing(9);
        slider.setMinorTickSpacing(1);
        slider.setSnapToTicks(true);
        slider.setPaintTicks(true);
        slider.setPaintLabels(true);
        slider.setFocusable(false);
        slider.addChangeListener(new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
                int speed = slider.getValue();
                setSpeed(speed);
            }
        });
        slider.setAlignmentX(Component.CENTER_ALIGNMENT);
        this.animationPanel = new JPanel();
        this.animationPanel.setLayout(new BoxLayout(this.animationPanel, BoxLayout.Y_AXIS));
        this.animationPanel.add(label);
        this.animationPanel.add(slider);
    }
    return this.animationPanel;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:36,代码来源:ExploreAction.java

示例5: getThumbRectField

import javax.swing.plaf.basic.BasicSliderUI; //导入依赖的package包/类
private static Rectangle getThumbRectField() {
    try {
        SliderUI ui = slider.getUI();

        Field field = BasicSliderUI.class.getDeclaredField("thumbRect");

        field.setAccessible(true);

        return (Rectangle) field.get(ui);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:14,代码来源:bug6848475.java

示例6: MThumbSliderAdditionalUI

import javax.swing.plaf.basic.BasicSliderUI; //导入依赖的package包/类
public MThumbSliderAdditionalUI(BasicSliderUI ui) {
    this.ui = ui;
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:4,代码来源:MultiThumbSlider.java

示例7: createTrackListener

import javax.swing.plaf.basic.BasicSliderUI; //导入依赖的package包/类
protected BasicSliderUI.TrackListener createTrackListener(final JSlider s) {
    return new TrackListener();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:AquaSliderUI.java

示例8: run

import javax.swing.plaf.basic.BasicSliderUI; //导入依赖的package包/类
private void run() throws InterruptedException, InvocationTargetException {
    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            for (UIManager.LookAndFeelInfo lookAndFeelInfo : UIManager.getInstalledLookAndFeels()) {
                try {
                    UIManager.setLookAndFeel(lookAndFeelInfo.getClassName());
                } catch (Exception e) {
                    fail(e.getMessage());
                }

                BufferedImage image = new BufferedImage(300, 200, BufferedImage.TYPE_INT_ARGB);

                // Test 1
                JSlider slider = new JSlider(0, Integer.MAX_VALUE - 1, 0);

                slider.setMajorTickSpacing((Integer.MAX_VALUE - 1) / 4);
                slider.setPaintTicks(true);

                ((BasicSliderUI) slider.getUI()).paintTicks(image.getGraphics());

                // Test 2
                slider = new JSlider(0, Integer.MAX_VALUE - 1, 0);

                slider.setMinorTickSpacing((Integer.MAX_VALUE - 1) / 4);
                slider.setPaintTicks(true);

                ((BasicSliderUI) slider.getUI()).paintTicks(image.getGraphics());

                // Test 3
                slider = new JSlider(0, Integer.MAX_VALUE - 1, 0);

                slider.setOrientation(JSlider.VERTICAL);
                slider.setMajorTickSpacing((Integer.MAX_VALUE - 1) / 4);
                slider.setPaintTicks(true);

                ((BasicSliderUI) slider.getUI()).paintTicks(image.getGraphics());

                // Test 4
                slider = new JSlider(0, Integer.MAX_VALUE - 1, 0);

                slider.setOrientation(JSlider.VERTICAL);
                slider.setMinorTickSpacing((Integer.MAX_VALUE - 1) / 4);
                slider.setPaintTicks(true);

                ((BasicSliderUI) slider.getUI()).paintTicks(image.getGraphics());

                countDownLatch.countDown();
            }
        }
    });

    if (countDownLatch.await(3000, TimeUnit.MILLISECONDS)) {
        System.out.println("bug6794831 passed");
    } else {
        fail("bug6794831 failed");
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:58,代码来源:bug6794831.java

示例9: run

import javax.swing.plaf.basic.BasicSliderUI; //导入依赖的package包/类
private void run() throws InterruptedException {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            for (UIManager.LookAndFeelInfo lookAndFeelInfo : UIManager.getInstalledLookAndFeels()) {
                try {
                    UIManager.setLookAndFeel(lookAndFeelInfo.getClassName());
                } catch (Exception e) {
                    fail(e.getMessage());
                }

                BufferedImage image = new BufferedImage(300, 200, BufferedImage.TYPE_INT_ARGB);

                // Test 1
                JSlider slider = new JSlider(0, Integer.MAX_VALUE - 1, 0);

                slider.setMajorTickSpacing((Integer.MAX_VALUE - 1) / 4);
                slider.setPaintTicks(true);

                ((BasicSliderUI) slider.getUI()).paintTicks(image.getGraphics());

                // Test 2
                slider = new JSlider(0, Integer.MAX_VALUE - 1, 0);

                slider.setMinorTickSpacing((Integer.MAX_VALUE - 1) / 4);
                slider.setPaintTicks(true);

                ((BasicSliderUI) slider.getUI()).paintTicks(image.getGraphics());

                // Test 3
                slider = new JSlider(0, Integer.MAX_VALUE - 1, 0);

                slider.setOrientation(JSlider.VERTICAL);
                slider.setMajorTickSpacing((Integer.MAX_VALUE - 1) / 4);
                slider.setPaintTicks(true);

                ((BasicSliderUI) slider.getUI()).paintTicks(image.getGraphics());

                // Test 4
                slider = new JSlider(0, Integer.MAX_VALUE - 1, 0);

                slider.setOrientation(JSlider.VERTICAL);
                slider.setMinorTickSpacing((Integer.MAX_VALUE - 1) / 4);
                slider.setPaintTicks(true);

                ((BasicSliderUI) slider.getUI()).paintTicks(image.getGraphics());

                countDownLatch.countDown();
            }
        }
    });

    if (countDownLatch.await(3000, TimeUnit.MILLISECONDS)) {
        System.out.println("bug6794831 passed");
    } else {
        fail("bug6794831 failed");
    }
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:58,代码来源:bug6794831.java


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