Ejemplo n.º 1
0
  private void configureUI() {
    // UIManager.put("ToolTip.hideAccelerator", Boolean.FALSE);
    Options.setDefaultIconSize(new Dimension(18, 18));
    Options.setUseNarrowButtons(settings.isUseNarrowButtons());
    Options.setTabIconsEnabled(settings.isTabIconsEnabled());
    UIManager.put(Options.POPUP_DROP_SHADOW_ENABLED_KEY, settings.isPopupDropShadowEnabled());

    // Swing Settings
    LookAndFeel selectedLaf = settings.getSelectedLookAndFeel();

    // Work around caching in MetalRadioButtonUI
    JRadioButton radio = new JRadioButton();
    radio.getUI().uninstallUI(radio);
    JCheckBox checkBox = new JCheckBox();
    checkBox.getUI().uninstallUI(checkBox);

    try {
      UIManager.setLookAndFeel(selectedLaf);
      SwingUtilities.updateComponentTreeUI(this);
    } catch (UnsupportedLookAndFeelException uslafe) {
      System.out.println("UnsupportedLookAndFeelException: " + uslafe.getMessage());
    } catch (Exception e) {
      System.out.println("Can't change L&F: " + e);
    }

    // // FensterIcon
    // String IconLocation = ResourceManager.getString("icon.IconImage");
    // System.out.println("[i] set IconImage: " +
    // getClass().getResource(IconLocation).toString());
    // setIconImage( new
    // ImageIcon(getClass().getResource(IconLocation)).getImage());

  }
Ejemplo n.º 2
0
Archivo: Tiny.java Proyecto: srnsw/xena
  /**
   * Configures the UI; tries to set the system look on Mac, <code>WindowsLookAndFeel</code> on
   * general Windows, and <code>Plastic3DLookAndFeel</code> on Windows XP and all other OS.
   *
   * <p>The JGoodies Swing Suite's <code>ApplicationStarter</code>, <code>ExtUIManager</code>, and
   * <code>LookChoiceStrategies</code> classes provide a much more fine grained algorithm to choose
   * and restore a look and theme.
   */
  private void configureUI() {
    UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, Boolean.TRUE);
    Options.setDefaultIconSize(new Dimension(18, 18));

    String lafName =
        LookUtils.IS_OS_WINDOWS_XP
            ? Options.getCrossPlatformLookAndFeelClassName()
            : Options.getSystemLookAndFeelClassName();

    try {
      UIManager.setLookAndFeel(lafName);
    } catch (Exception e) {
      System.err.println("Can't set look & feel:" + e);
    }
  }
Ejemplo n.º 3
0
 /**
  * Creates a <code>Popup</code> for the Component <code>owner</code> containing the Component
  * <code>contents</code>. In addition to the superclass behavior, we try to return a Popup that
  * has a drop shadow, if popup drop shadows are active - as returned by <code>
  * Options#isPopupDropShadowActive</code>.
  *
  * <p><code>owner</code> is used to determine which <code>Window</code> the new <code>Popup</code>
  * will parent the <code>Component</code> the <code>Popup</code> creates to. A null <code>owner
  * </code> implies there is no valid parent. <code>x</code> and <code>y</code> specify the
  * preferred initial location to place the <code>Popup</code> at. Based on screen size, or other
  * paramaters, the <code>Popup</code> may not display at <code>x</code> and <code>y</code>.
  *
  * <p>We invoke the super <code>#getPopup</code>, not the one in the stored factory, because the
  * popup type is set in this instance, not in the stored one.
  *
  * @param owner Component mouse coordinates are relative to, may be null
  * @param contents Contents of the Popup
  * @param x Initial x screen coordinate
  * @param y Initial y screen coordinate
  * @return Popup containing Contents
  * @throws IllegalArgumentException if contents is null
  * @see Options#isPopupDropShadowActive()
  */
 public Popup getPopup(Component owner, Component contents, int x, int y)
     throws IllegalArgumentException {
   Popup popup = super.getPopup(owner, contents, x, y);
   return Options.isPopupDropShadowActive()
       ? ShadowPopup.getInstance(owner, contents, x, y, popup)
       : popup;
 }
Ejemplo n.º 4
0
  ThemeManager(final JFrame frame) {

    // this line needs to be implemented in order to make JWS work properly
    UIManager.getLookAndFeelDefaults().put("ClassLoader", frame.getClass().getClassLoader());

    try { // This could fail if JGoodies is not available
      com.jgoodies.looks.Options.setPopupDropShadowEnabled(true); // Enabled JGoodies drop shadow
    } catch (Exception e) {
      Logger.getLogger(ThemeManager.class.getName())
          .log(Level.FINE, "JGoodies L&F was not found", e);
    }

    Preferences pref = Preferences.userNodeForPackage(ThemeManager.class);

    setLookAndFeel(pref.get(LF, UIManager.getCrossPlatformLookAndFeelClassName()));
  }