Java Code Examples for javax.swing.plaf.synth.SynthLookAndFeel

The following examples show how to use javax.swing.plaf.synth.SynthLookAndFeel. 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: bug6918861.java    License: GNU General Public License v2.0 6 votes vote down vote up
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");
            }
        }
    });
}
 
Example 2
Source Project: dragonwell8_jdk   Source File: bug6923305.java    License: GNU General Public License v2.0 6 votes vote down vote up
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());
        }
    });
}
 
Example 3
Source Project: dragonwell8_jdk   Source File: bug6913768.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new SynthLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            JFrame frame = new JFrame();

            JTable table = new JTable(new Object[][]{{"1", "2"}, {"3", "4"}},
                    new Object[]{"col1", "col2"});

            frame.getContentPane().add(new JScrollPane(table));
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(300, 200);
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        }
    });
}
 
Example 4
Source Project: openjdk-8   Source File: bug6918861.java    License: GNU General Public License v2.0 6 votes vote down vote up
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");
            }
        }
    });
}
 
Example 5
Source Project: TencentKona-8   Source File: bug6924059.java    License: GNU General Public License v2.0 6 votes vote down vote up
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");
            }
        }
    });
}
 
Example 6
Source Project: openjdk-jdk9   Source File: bug6918861.java    License: GNU General Public License v2.0 6 votes vote down vote up
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");
            }
        }
    });
}
 
Example 7
Source Project: TencentKona-8   Source File: bug6923305.java    License: GNU General Public License v2.0 6 votes vote down vote up
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());
        }
    });
}
 
Example 8
Source Project: hottub   Source File: bug6913768.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new SynthLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            JFrame frame = new JFrame();

            JTable table = new JTable(new Object[][]{{"1", "2"}, {"3", "4"}},
                    new Object[]{"col1", "col2"});

            frame.getContentPane().add(new JScrollPane(table));
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(300, 200);
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        }
    });
}
 
Example 9
Source Project: TencentKona-8   Source File: bug7143614.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static void validate() throws Exception {
    Method getSelectedUIMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUI");

    getSelectedUIMethod.setAccessible(true);

    Method getSelectedUIStateMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUIState");

    getSelectedUIStateMethod.setAccessible(true);

    if (getSelectedUIMethod.invoke(null) != componentUI) {
        throw new RuntimeException("getSelectedUI returns invalid value");
    }
    if (((Integer) getSelectedUIStateMethod.invoke(null)).intValue() !=
            (SynthConstants.SELECTED | SynthConstants.FOCUSED)) {
        throw new RuntimeException("getSelectedUIState returns invalid value");
    }

}
 
Example 10
Source Project: jdk8u-dev-jdk   Source File: bug7143614.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static void validate() throws Exception {
    Method getSelectedUIMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUI");

    getSelectedUIMethod.setAccessible(true);

    Method getSelectedUIStateMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUIState");

    getSelectedUIStateMethod.setAccessible(true);

    if (getSelectedUIMethod.invoke(null) != componentUI) {
        throw new RuntimeException("getSelectedUI returns invalid value");
    }
    if (((Integer) getSelectedUIStateMethod.invoke(null)).intValue() !=
            (SynthConstants.SELECTED | SynthConstants.FOCUSED)) {
        throw new RuntimeException("getSelectedUIState returns invalid value");
    }

}
 
Example 11
Source Project: openjdk-jdk9   Source File: bug6913768.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new SynthLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            JFrame frame = new JFrame();

            JTable table = new JTable(new Object[][]{{"1", "2"}, {"3", "4"}},
                    new Object[]{"col1", "col2"});

            frame.getContentPane().add(new JScrollPane(table));
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(300, 200);
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        }
    });
}
 
Example 12
Source Project: jdk8u_jdk   Source File: bug7143614.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static void validate() throws Exception {
    Method getSelectedUIMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUI");

    getSelectedUIMethod.setAccessible(true);

    Method getSelectedUIStateMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUIState");

    getSelectedUIStateMethod.setAccessible(true);

    if (getSelectedUIMethod.invoke(null) != componentUI) {
        throw new RuntimeException("getSelectedUI returns invalid value");
    }
    if (((Integer) getSelectedUIStateMethod.invoke(null)).intValue() !=
            (SynthConstants.SELECTED | SynthConstants.FOCUSED)) {
        throw new RuntimeException("getSelectedUIState returns invalid value");
    }

}
 
Example 13
Source Project: openjdk-8-source   Source File: bug6918861.java    License: GNU General Public License v2.0 6 votes vote down vote up
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");
            }
        }
    });
}
 
Example 14
Source Project: jdk8u60   Source File: bug6923305.java    License: GNU General Public License v2.0 6 votes vote down vote up
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());
        }
    });
}
 
Example 15
Source Project: jdk8u60   Source File: bug6913768.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new SynthLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            JFrame frame = new JFrame();

            JTable table = new JTable(new Object[][]{{"1", "2"}, {"3", "4"}},
                    new Object[]{"col1", "col2"});

            frame.getContentPane().add(new JScrollPane(table));
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(300, 200);
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        }
    });
}
 
Example 16
Source Project: jdk8u60   Source File: bug7143614.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static void validate() throws Exception {
    Method getSelectedUIMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUI");

    getSelectedUIMethod.setAccessible(true);

    Method getSelectedUIStateMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUIState");

    getSelectedUIStateMethod.setAccessible(true);

    if (getSelectedUIMethod.invoke(null) != componentUI) {
        throw new RuntimeException("getSelectedUI returns invalid value");
    }
    if (((Integer) getSelectedUIStateMethod.invoke(null)).intValue() !=
            (SynthConstants.SELECTED | SynthConstants.FOCUSED)) {
        throw new RuntimeException("getSelectedUIState returns invalid value");
    }

}
 
Example 17
Source Project: jdk8u-jdk   Source File: bug6918861.java    License: GNU General Public License v2.0 6 votes vote down vote up
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");
            }
        }
    });
}
 
Example 18
Source Project: openjdk-jdk8u   Source File: bug6924059.java    License: GNU General Public License v2.0 6 votes vote down vote up
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");
            }
        }
    });
}
 
Example 19
Source Project: openjdk-8-source   Source File: bug6924059.java    License: GNU General Public License v2.0 6 votes vote down vote up
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");
            }
        }
    });
}
 
Example 20
Source Project: openjdk-8   Source File: bug7143614.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static void validate() throws Exception {
    Method getSelectedUIMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUI");

    getSelectedUIMethod.setAccessible(true);

    Method getSelectedUIStateMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUIState");

    getSelectedUIStateMethod.setAccessible(true);

    if (getSelectedUIMethod.invoke(null) != componentUI) {
        throw new RuntimeException("getSelectedUI returns invalid value");
    }
    if (((Integer) getSelectedUIStateMethod.invoke(null)).intValue() !=
            (SynthConstants.SELECTED | SynthConstants.FOCUSED)) {
        throw new RuntimeException("getSelectedUIState returns invalid value");
    }

}
 
Example 21
Source Project: openjdk-jdk9   Source File: bug6924059.java    License: GNU General Public License v2.0 6 votes vote down vote up
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");
            }
        }
    });
}
 
Example 22
Source Project: openjdk-jdk8u   Source File: bug6913768.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new SynthLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            JFrame frame = new JFrame();

            JTable table = new JTable(new Object[][]{{"1", "2"}, {"3", "4"}},
                    new Object[]{"col1", "col2"});

            frame.getContentPane().add(new JScrollPane(table));
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(300, 200);
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        }
    });
}
 
Example 23
Source Project: openjdk-8-source   Source File: bug6923305.java    License: GNU General Public License v2.0 6 votes vote down vote up
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());
        }
    });
}
 
Example 24
Source Project: openjdk-jdk9   Source File: bug8040328.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    SynthLookAndFeel lookAndFeel = new SynthLookAndFeel();
    lookAndFeel.load(new ByteArrayInputStream(synthXml.getBytes("UTF8")),
            bug8040328.class);
    UIManager.setLookAndFeel(lookAndFeel);
    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            final JFrame frame = new JFrame();
            try {
                frame.setUndecorated(true);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.setVisible(true);
                test(frame);
            } finally {
                frame.dispose();
            }
        }
    });
    System.out.println("ok");
}
 
Example 25
Source Project: hottub   Source File: bug6923305.java    License: GNU General Public License v2.0 6 votes vote down vote up
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());
        }
    });
}
 
Example 26
Source Project: jdk8u-jdk   Source File: bug6924059.java    License: GNU General Public License v2.0 6 votes vote down vote up
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");
            }
        }
    });
}
 
Example 27
Source Project: openjdk-jdk9   Source File: bug7143614.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static void validate() throws Exception {
    Method getSelectedUIMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUI");

    getSelectedUIMethod.setAccessible(true);

    Method getSelectedUIStateMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUIState");

    getSelectedUIStateMethod.setAccessible(true);

    if (getSelectedUIMethod.invoke(null) != componentUI) {
        throw new RuntimeException("getSelectedUI returns invalid value");
    }
    if (((Integer) getSelectedUIStateMethod.invoke(null)).intValue() !=
            (SynthConstants.SELECTED | SynthConstants.FOCUSED)) {
        throw new RuntimeException("getSelectedUIState returns invalid value");
    }

}
 
Example 28
Source Project: jdk8u-dev-jdk   Source File: bug6913768.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new SynthLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            JFrame frame = new JFrame();

            JTable table = new JTable(new Object[][]{{"1", "2"}, {"3", "4"}},
                    new Object[]{"col1", "col2"});

            frame.getContentPane().add(new JScrollPane(table));
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(300, 200);
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        }
    });
}
 
Example 29
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());
        }
    });
}
 
Example 30
Source Project: openjdk-8   Source File: bug6923305.java    License: GNU General Public License v2.0 6 votes vote down vote up
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());
        }
    });
}