Java Code Examples for javax.swing.plaf.basic.BasicSliderUI

The following examples show how to use javax.swing.plaf.basic.BasicSliderUI. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: openjdk-jdk9   Source File: bug6401380.java    License: GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 2
Source Project: dragonwell8_jdk   Source File: bug6848475.java    License: GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 3
Source Project: TencentKona-8   Source File: bug6848475.java    License: GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 4
Source Project: jdk8u60   Source File: bug6848475.java    License: GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 5
Source Project: openjdk-jdk8u   Source File: bug6848475.java    License: GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 6
Source Project: GIFKR   Source File: ViewUtils.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
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);
				}
			});
		}
	}
 
Example 7
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);
    }
}
 
Example 8
Source Project: openjdk-jdk9   Source File: bug6848475.java    License: GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 9
Source Project: jdk8u-jdk   Source File: bug6848475.java    License: GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 10
Source Project: hottub   Source File: bug6848475.java    License: GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 11
Source Project: openjdk-8-source   Source File: bug6848475.java    License: GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 12
Source Project: openjdk-8   Source File: bug6848475.java    License: GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 13
Source Project: jdk8u_jdk   Source File: bug6848475.java    License: GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 14
Source Project: jdk8u-jdk   Source File: bug6848475.java    License: GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 15
Source Project: jdk8u-dev-jdk   Source File: bug6848475.java    License: GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 16
Source Project: dragonwell8_jdk   Source File: AquaSliderUI.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected BasicSliderUI.TrackListener createTrackListener(final JSlider s) {
    return new TrackListener();
}
 
Example 17
Source Project: dragonwell8_jdk   Source File: bug6794831.java    License: GNU General Public License v2.0 4 votes vote down vote up
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");
    }
}
 
Example 18
Source Project: TencentKona-8   Source File: AquaSliderUI.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected BasicSliderUI.TrackListener createTrackListener(final JSlider s) {
    return new TrackListener();
}
 
Example 19
Source Project: TencentKona-8   Source File: bug6794831.java    License: GNU General Public License v2.0 4 votes vote down vote up
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");
    }
}
 
Example 20
Source Project: jdk8u60   Source File: AquaSliderUI.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected BasicSliderUI.TrackListener createTrackListener(final JSlider s) {
    return new TrackListener();
}
 
Example 21
Source Project: jdk8u60   Source File: bug6794831.java    License: GNU General Public License v2.0 4 votes vote down vote up
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");
    }
}
 
Example 22
Source Project: openjdk-jdk8u   Source File: AquaSliderUI.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected BasicSliderUI.TrackListener createTrackListener(final JSlider s) {
    return new TrackListener();
}
 
Example 23
Source Project: openjdk-jdk8u   Source File: bug6794831.java    License: GNU General Public License v2.0 4 votes vote down vote up
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");
    }
}
 
Example 24
protected BasicSliderUI.TrackListener createTrackListener(final JSlider s) {
    return new TrackListener();
}
 
Example 25
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");
    }
}
 
Example 26
Source Project: openjdk-jdk9   Source File: AquaSliderUI.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected BasicSliderUI.TrackListener createTrackListener(final JSlider s) {
    return new TrackListener();
}
 
Example 27
Source Project: openjdk-jdk9   Source File: bug6794831.java    License: GNU General Public License v2.0 4 votes vote down vote up
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");
    }
}
 
Example 28
Source Project: jdk8u-jdk   Source File: AquaSliderUI.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected BasicSliderUI.TrackListener createTrackListener(final JSlider s) {
    return new TrackListener();
}
 
Example 29
Source Project: jdk8u-jdk   Source File: bug6794831.java    License: GNU General Public License v2.0 4 votes vote down vote up
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");
    }
}
 
Example 30
Source Project: hottub   Source File: AquaSliderUI.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected BasicSliderUI.TrackListener createTrackListener(final JSlider s) {
    return new TrackListener();
}