Java Code Examples for javax.swing.plaf.metal.MetalSliderUI

The following examples show how to use javax.swing.plaf.metal.MetalSliderUI. 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: dragonwell8_jdk   Source File: Test6657026.java    License: GNU General Public License v2.0 5 votes vote down vote up
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");
    }
}
 
Example 2
Source Project: TencentKona-8   Source File: Test6657026.java    License: GNU General Public License v2.0 5 votes vote down vote up
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");
    }
}
 
Example 3
Source Project: jdk8u60   Source File: Test6657026.java    License: GNU General Public License v2.0 5 votes vote down vote up
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");
    }
}
 
Example 4
Source Project: openjdk-jdk8u   Source File: Test6657026.java    License: GNU General Public License v2.0 5 votes vote down vote up
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");
    }
}
 
Example 5
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");
    }
}
 
Example 6
Source Project: openjdk-jdk9   Source File: Test6657026.java    License: GNU General Public License v2.0 5 votes vote down vote up
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");
    }
}
 
Example 7
Source Project: jdk8u-jdk   Source File: Test6657026.java    License: GNU General Public License v2.0 5 votes vote down vote up
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");
    }
}
 
Example 8
Source Project: hottub   Source File: Test6657026.java    License: GNU General Public License v2.0 5 votes vote down vote up
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");
    }
}
 
Example 9
Source Project: openjdk-8-source   Source File: Test6657026.java    License: GNU General Public License v2.0 5 votes vote down vote up
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");
    }
}
 
Example 10
Source Project: openjdk-8   Source File: Test6657026.java    License: GNU General Public License v2.0 5 votes vote down vote up
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");
    }
}
 
Example 11
Source Project: jdk8u_jdk   Source File: Test6657026.java    License: GNU General Public License v2.0 5 votes vote down vote up
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");
    }
}
 
Example 12
Source Project: jdk8u-jdk   Source File: Test6657026.java    License: GNU General Public License v2.0 5 votes vote down vote up
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");
    }
}
 
Example 13
Source Project: jdk8u-dev-jdk   Source File: Test6657026.java    License: GNU General Public License v2.0 5 votes vote down vote up
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");
    }
}
 
Example 14
Source Project: java-swing-tips   Source File: MainPanel.java    License: MIT License 5 votes vote down vote up
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));
}