Package javax.swing.plaf.metal

Examples of javax.swing.plaf.metal.MetalTheme


     */
    public static String getMetalTheme() {
        try {
            MetalLookAndFeel metalLNF = (MetalLookAndFeel)UIManager.getLookAndFeel();
            Method getCurrentTheme = metalLNF.getClass().getMethod("getCurrentTheme", new Class[0]);
            MetalTheme currentTheme = (MetalTheme)getCurrentTheme.invoke(metalLNF, new Object[0]);
            return "Metal/" + currentTheme.getName();
        } catch(NoSuchMethodException e) {
            // must be Java 1.4 because getCurrentTheme() method does not exist
            // therefore the theme of interest is "Steel"
            return "Metal/Steel";
        } catch(Exception e) {
View Full Code Here


            Class<MetalTheme> theme = (Class<MetalTheme>) Class.forName("com.izforge.izpack.gui.IzPackKMetalTheme");
            Method setCurrentThemeMethod = lafClass.getMethod("setCurrentTheme", params);

            // We invoke and place Kunststoff as our L&F
            LookAndFeel kunststoff = lafClass.newInstance();
            MetalTheme ktheme = theme.newInstance();
            Object[] kparams = {ktheme};
            UIManager.setLookAndFeel(kunststoff);
            setCurrentThemeMethod.invoke(kunststoff, kparams);

            lnf = "kunststoff";
View Full Code Here

         {
            _prefs = new PlasticThemePreferences();

            ClassLoader cl = getLAFRegister().getLookAndFeelClassLoader();
            Class<?> clazz = Class.forName(AbstractPlasticController.DEFAULT_PLASTIC_THEME_CLASS_NAME, false, cl);
            MetalTheme theme = (MetalTheme) clazz.newInstance();
            _prefs.setThemeName(theme.getName());

            try
            {
               cache.add(_prefs);
            }
View Full Code Here

  public void aboutToBeInstalled(LAFRegister lafRegister, LookAndFeel laf)
  {
    final String name = getCurrentThemeName();
    if (name != null)
    {
      MetalTheme theme = getThemeForName(name);
      if (theme != null)
      {
        try
        {
          installCurrentTheme(laf, theme);
View Full Code Here

         {
            _currentThemePrefs = new MetalThemePreferences();

            ClassLoader cl = getLAFRegister().getLookAndFeelClassLoader();
            Class<?> clazz = Class.forName(MetalLookAndFeelController.DEFAULT_METAL_THEME, false, cl);
            MetalTheme theme = (MetalTheme) clazz.newInstance();
            _currentThemePrefs.setThemeName(theme.getName());

            try
            {
               cache.add(_currentThemePrefs);
            }
View Full Code Here

    {
      try
      {
        Class<?> clazz = Class.forName(_extraThemeClassNames[i], false, cl);

            MetalTheme metalTheme = (MetalTheme) clazz.newInstance();
            _themesByName.put(metalTheme.getName(), metalTheme);
            ret.add(metalTheme);

        if(null != _defaultMetalTheme && _extraThemeClassNames[i].equals(_defaultMetalTheme.getClass().getName()))
        {
          defaultThemeIsIncluded = true;
View Full Code Here

  }


   MetalTheme getThemeForName(String name)
   {
      MetalTheme ret = super.getThemeForName(name);

      if(null == ret)
      {
         ret = _themesByName.get(name);
      }
View Full Code Here

        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) {
View Full Code Here

    }

    public void actionPerformed(ActionEvent e) {
        String numStr = e.getActionCommand();
        MetalTheme selectedTheme = themes[Integer.parseInt(numStr)];
        MetalLookAndFeel.setCurrentTheme(selectedTheme);
        try {
            UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
        } catch (Exception ex) {
            System.out.println("Failed loading Metal");
View Full Code Here

    if (null == installedThemes)
      installDefaultThemes();

    Collections.sort(installedThemes, new Comparator() {
      public int compare(Object o1, Object o2) {
        MetalTheme theme1 = (MetalTheme) o1;
        MetalTheme theme2 = (MetalTheme) o2;
        return theme1.getName().compareTo(theme2.getName());
      }
    });

    return installedThemes;
  }
View Full Code Here

TOP

Related Classes of javax.swing.plaf.metal.MetalTheme

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.