Search in sources :

Example 6 with SynthLookAndFeel

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");
        }
    });
}
Also used : SynthLookAndFeel(javax.swing.plaf.synth.SynthLookAndFeel) Method(java.lang.reflect.Method) BasicTabbedPaneUI(javax.swing.plaf.basic.BasicTabbedPaneUI)

Example 7 with SynthLookAndFeel

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());
        }
    });
}
Also used : SynthLookAndFeel(javax.swing.plaf.synth.SynthLookAndFeel) SynthSliderUI(javax.swing.plaf.synth.SynthSliderUI) BufferedImage(java.awt.image.BufferedImage) SynthContext(javax.swing.plaf.synth.SynthContext)

Example 8 with SynthLookAndFeel

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");
            }
        }
    });
}
Also used : SynthLookAndFeel(javax.swing.plaf.synth.SynthLookAndFeel)

Example 9 with SynthLookAndFeel

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");
            }
        }
    });
}
Also used : SynthScrollBarUI(javax.swing.plaf.synth.SynthScrollBarUI) SynthLookAndFeel(javax.swing.plaf.synth.SynthLookAndFeel)

Aggregations

SynthLookAndFeel (javax.swing.plaf.synth.SynthLookAndFeel)9 BufferedImage (java.awt.image.BufferedImage)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 Method (java.lang.reflect.Method)1 BasicComboPopup (javax.swing.plaf.basic.BasicComboPopup)1 BasicTabbedPaneUI (javax.swing.plaf.basic.BasicTabbedPaneUI)1 NimbusLookAndFeel (javax.swing.plaf.nimbus.NimbusLookAndFeel)1 SynthContext (javax.swing.plaf.synth.SynthContext)1 SynthScrollBarUI (javax.swing.plaf.synth.SynthScrollBarUI)1 SynthSliderUI (javax.swing.plaf.synth.SynthSliderUI)1 TableCellRenderer (javax.swing.table.TableCellRenderer)1 SunToolkit (sun.awt.SunToolkit)1