use of javax.swing.plaf.synth.SynthLookAndFeel in project jdk8u_jdk by JetBrains.
the class bug7010561 method main.
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel(new SynthLookAndFeel());
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
JTabbedPane tabbedPane = new JTabbedPane();
tabbedPane.addTab("Tab 1", new JLabel("Tab 1"));
// Ensure internal TabbedPane fields are initialized
tabbedPane.doLayout();
BasicTabbedPaneUI basicTabbedPaneUI = (BasicTabbedPaneUI) tabbedPane.getUI();
try {
Method method = BasicTabbedPaneUI.class.getDeclaredMethod("getTabLabelShiftY", int.class, int.class, boolean.class);
method.setAccessible(true);
for (int i = 0; i < 4; i++) {
int res = ((Integer) method.invoke(basicTabbedPaneUI, TAB_PLACEMENT[i], 0, IS_SELECTED[i])).intValue();
if (res != RETURN_VALUE[i]) {
throw new RuntimeException("Test bug7010561 failed on index " + i);
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
System.out.println("Test bug7010561 passed");
}
});
}
use of javax.swing.plaf.synth.SynthLookAndFeel in project jdk8u_jdk by JetBrains.
the class bug6923305 method main.
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel(new SynthLookAndFeel());
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JSlider slider = new JSlider();
slider.setUI(new SynthSliderUI(slider) {
@Override
protected void paintTrack(SynthContext context, Graphics g, Rectangle trackBounds) {
throw new RuntimeException("Test failed: the SynthSliderUI.paintTrack was invoked");
}
});
slider.setPaintTrack(false);
slider.setSize(slider.getPreferredSize());
BufferedImage bufferedImage = new BufferedImage(slider.getWidth(), slider.getHeight(), BufferedImage.TYPE_INT_ARGB);
slider.paint(bufferedImage.getGraphics());
}
});
}
use of javax.swing.plaf.synth.SynthLookAndFeel in project jdk8u_jdk by JetBrains.
the class bug6918861 method main.
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel(new SynthLookAndFeel());
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JSlider slider = new JSlider();
HackedSynthSliderUI ui = new HackedSynthSliderUI(slider);
slider.setUI(ui);
if (ui.counter != 111) {
throw new RuntimeException("Some installers of SynthSliderUI weren't invoked");
}
slider.setUI(null);
if (ui.counter != 0) {
throw new RuntimeException("Some uninstallers of SynthSliderUI weren't invoked");
}
}
});
}
use of javax.swing.plaf.synth.SynthLookAndFeel in project jdk8u_jdk by JetBrains.
the class bug6924059 method main.
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel(new SynthLookAndFeel());
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
new JScrollBar().setUI(new SynthScrollBarUI() {
protected void configureScrollBarColors() {
super.configureScrollBarColors();
isMethodCalled = true;
}
});
if (!isMethodCalled) {
throw new RuntimeException("The configureScrollBarColors was not called");
}
}
});
}
Aggregations