public MetalLayoutStyle() { isOcean = false; try { Method method = MetalLookAndFeel.class. getMethod("getCurrentTheme", (Class[])null); isOcean = ((MetalTheme)method.invoke(null, (Object[])null)). getName() == "Ocean"; } catch (NoSuchMethodException nsme) { } catch (IllegalAccessException iae) { } catch (IllegalArgumentException iae2) { } catch (InvocationTargetException ite) { } }
/** * Workaround method to get the metal theme, either "Steel" or "Ocean". This is because the * Metal look and feel's getName() property does not distinguish between versions correctly. * A bug has been submitted to the Sun Java bug database and will be reviewed. */ 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) { e.printStackTrace(); return "Metal/Steel"; } }
/** * Workaround method to get the metal theme, either "Steel" or "Ocean". This is because the * Metal look and feel's getName() property does not distinguish between versions correctly. * A bug has been submitted to the Sun Java bug database and will be reviewed. */ 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) { e.printStackTrace(); return "Metal/Steel"; } }
/** * Workaround method to get the metal theme, either "Steel" or "Ocean". This is because the * Metal look and feel's getName() property does not distinguish between versions correctly. * A bug has been submitted to the Sun Java bug database and will be reviewed. */ 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) { e.printStackTrace(); return "Metal/Steel"; } }
private void loadThemesCombo() { _themeCmb.removeAllItems(); for(Iterator<MetalTheme> it = _ctrl.themesIterator(); it.hasNext();) { _themeCmb.addItem((it.next()).getName()); } if (_themeCmb.getModel().getSize() > 0) { String selThemeName = _ctrl.getCurrentThemeName(); if (selThemeName != null && selThemeName.length() > 0) { _themeCmb.setSelectedItem(selThemeName); } if (_themeCmb.getSelectedIndex() == -1) { _themeCmb.setSelectedIndex(0); } } _origSelThemeIdx = _themeCmb.getSelectedIndex(); } }
_themesByName.put(metalTheme.getName(), metalTheme); ret.add(metalTheme);
Class<?> clazz = Class.forName(AbstractPlasticController.DEFAULT_PLASTIC_THEME_CLASS_NAME, false, cl); MetalTheme theme = (MetalTheme) clazz.newInstance(); _prefs.setThemeName(theme.getName());
Class<?> clazz = Class.forName(MetalLookAndFeelController.DEFAULT_METAL_THEME, false, cl); MetalTheme theme = (MetalTheme) clazz.newInstance(); _currentThemePrefs.setThemeName(theme.getName());