Java 类javax.swing.plaf.basic.BasicSliderUI 实例源码

项目:openjdk-jdk10    文件:bug6401380.java   
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);
}
项目:openjdk9    文件:bug6401380.java   
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);
}
项目:JRLib    文件:SubstanceIconFactory.java   
/**
 * 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);
}
项目:GIFKR    文件:ViewUtils.java   
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);
                }
            });
        }
    }
项目:JavaGraph    文件:ExploreAction.java   
/**
 * 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;
}
项目:jdk8u-jdk    文件:bug6848475.java   
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);
    }
}
项目:openjdk-jdk10    文件:bug6848475.java   
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);
    }
}
项目:openjdk9    文件:bug6848475.java   
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);
    }
}
项目:jdk8u_jdk    文件:bug6848475.java   
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);
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:bug6848475.java   
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);
    }
}
项目:infobip-open-jdk-8    文件:bug6848475.java   
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);
    }
}
项目:jdk8u-dev-jdk    文件:bug6848475.java   
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);
    }
}
项目:jdk7-jdk    文件:bug6848475.java   
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);
    }
}
项目:openjdk-source-code-learn    文件:bug6848475.java   
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);
    }
}
项目:OLD-OpenJDK8    文件:bug6848475.java   
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);
    }
}
项目:JAVA_UNIT    文件:bug6848475.java   
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);
    }
}
项目:openjdk-jdk7u-jdk    文件:bug6848475.java   
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);
    }
}
项目:openjdk-icedtea7    文件:bug6848475.java   
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);
    }
}
项目:sumo    文件:MultiThumbSlider.java   
public MThumbSliderAdditionalUI(BasicSliderUI ui) {
    this.ui = ui;
}
项目:OpenJSharp    文件:AquaSliderUI.java   
protected BasicSliderUI.TrackListener createTrackListener(final JSlider s) {
    return new TrackListener();
}
项目:jdk8u-jdk    文件:AquaSliderUI.java   
protected BasicSliderUI.TrackListener createTrackListener(final JSlider s) {
    return new TrackListener();
}
项目:jdk8u-jdk    文件:bug6794831.java   
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");
    }
}
项目:openjdk-jdk10    文件:AquaSliderUI.java   
protected BasicSliderUI.TrackListener createTrackListener(final JSlider s) {
    return new TrackListener();
}
项目:openjdk-jdk10    文件:bug6794831.java   
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");
    }
}
项目:openjdk9    文件:AquaSliderUI.java   
protected BasicSliderUI.TrackListener createTrackListener(final JSlider s) {
    return new TrackListener();
}
项目:openjdk9    文件:bug6794831.java   
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");
    }
}
项目:jdk8u_jdk    文件:AquaSliderUI.java   
protected BasicSliderUI.TrackListener createTrackListener(final JSlider s) {
    return new TrackListener();
}
项目:jdk8u_jdk    文件:bug6794831.java   
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");
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:AquaSliderUI.java   
protected BasicSliderUI.TrackListener createTrackListener(final JSlider s) {
    return new TrackListener();
}
项目:lookaside_java-1.8.0-openjdk    文件:bug6794831.java   
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");
    }
}
项目:infobip-open-jdk-8    文件:AquaSliderUI.java   
protected BasicSliderUI.TrackListener createTrackListener(final JSlider s) {
    return new TrackListener();
}
项目:infobip-open-jdk-8    文件:bug6794831.java   
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");
    }
}
项目:jdk8u-dev-jdk    文件:AquaSliderUI.java   
protected BasicSliderUI.TrackListener createTrackListener(final JSlider s) {
    return new TrackListener();
}
项目:jdk8u-dev-jdk    文件:bug6794831.java   
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");
    }
}
项目:jdk7-jdk    文件:bug6794831.java   
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");
    }
}
项目:openjdk-source-code-learn    文件:bug6794831.java   
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");
    }
}
项目:OLD-OpenJDK8    文件:AquaSliderUI.java   
protected BasicSliderUI.TrackListener createTrackListener(final JSlider s) {
    return new TrackListener();
}
项目:OLD-OpenJDK8    文件:bug6794831.java   
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");
    }
}
项目:JAVA_UNIT    文件:bug6794831.java   
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");
    }
}
项目:openjdk-jdk7u-jdk    文件:AquaSliderUI.java   
protected BasicSliderUI.TrackListener createTrackListener(final JSlider s) {
    return new TrackListener();
}