Search in sources :

Example 1 with OceanTheme

use of javax.swing.plaf.metal.OceanTheme in project jdk8u_jdk by JetBrains.

the class MetalworksFrame method buildMenus.

protected void buildMenus() {
    menuBar = new JMenuBar();
    menuBar.setOpaque(true);
    JMenu file = buildFileMenu();
    JMenu edit = buildEditMenu();
    JMenu views = buildViewsMenu();
    JMenu speed = buildSpeedMenu();
    JMenu help = buildHelpMenu();
    // load a theme from a text file
    MetalTheme myTheme = null;
    try {
        InputStream istream = getClass().getResourceAsStream("/resources/MyTheme.theme");
        myTheme = new PropertiesMetalTheme(istream);
    } catch (NullPointerException e) {
        System.out.println(e);
    }
    // build an array of themes
    MetalTheme[] themes = { new OceanTheme(), new DefaultMetalTheme(), new GreenMetalTheme(), new AquaMetalTheme(), new KhakiMetalTheme(), new DemoMetalTheme(), new ContrastMetalTheme(), new BigContrastMetalTheme(), myTheme };
    // put the themes in a menu
    JMenu themeMenu = new MetalThemeMenu("Theme", themes);
    menuBar.add(file);
    menuBar.add(edit);
    menuBar.add(views);
    menuBar.add(themeMenu);
    menuBar.add(speed);
    menuBar.add(help);
    setJMenuBar(menuBar);
}
Also used : InputStream(java.io.InputStream) DefaultMetalTheme(javax.swing.plaf.metal.DefaultMetalTheme) OceanTheme(javax.swing.plaf.metal.OceanTheme) DefaultMetalTheme(javax.swing.plaf.metal.DefaultMetalTheme) MetalTheme(javax.swing.plaf.metal.MetalTheme) JMenuBar(javax.swing.JMenuBar) JMenu(javax.swing.JMenu)

Aggregations

InputStream (java.io.InputStream)1 JMenu (javax.swing.JMenu)1 JMenuBar (javax.swing.JMenuBar)1 DefaultMetalTheme (javax.swing.plaf.metal.DefaultMetalTheme)1 MetalTheme (javax.swing.plaf.metal.MetalTheme)1 OceanTheme (javax.swing.plaf.metal.OceanTheme)1