Пример #1
0
 /** Sets whether this JInternalFrame is to use a palette border or not */
 public void setPalette(boolean isPalette) {
   if (isPalette) {
     LookAndFeel.installBorder(frame, "InternalFrame.paletteBorder");
   } else {
     LookAndFeel.installBorder(frame, "InternalFrame.border");
   }
   titlePane.setPalette(isPalette);
 }
Пример #2
0
  /** Installs the appropriate <code>Border</code> onto the <code>JRootPane</code>. */
  void installBorder(JRootPane root) {
    int style = root.getWindowDecorationStyle();

    if (style == JRootPane.NONE) {
      LookAndFeel.uninstallBorder(root);
    } else {
      LookAndFeel.installBorder(root, borderKeys[style]);
    }
  }
Пример #3
0
 /**
  * Sets the frame type according to the specified type constant. This must be one of the
  * SwingConstants.
  */
 private void setFrameType(String frameType) {
   if (frameType.equals(OPTION_DIALOG)) {
     LookAndFeel.installBorder(frame, "InternalFrame.optionDialogBorder");
     titlePane.setPalette(false);
   } else if (frameType.equals(PALETTE_FRAME)) {
     LookAndFeel.installBorder(frame, "InternalFrame.paletteBorder");
     titlePane.setPalette(true);
   } else {
     LookAndFeel.installBorder(frame, "InternalFrame.border");
     titlePane.setPalette(false);
   }
 }
Пример #4
0
 /**
  * Creates an <code>InputMap</code> with the bindings that are passed in.
  *
  * @param table a <code>UIDefaults</code> table
  * @return the <code>InputMap</code>
  */
 public Object createValue(UIDefaults table) {
   if (bindings != null) {
     InputMap km = LookAndFeel.makeInputMap(bindings);
     return km;
   }
   return null;
 }
 public void installUI(JComponent jComponent) {
   grid = (JGrid) jComponent;
   rendererPane = new CellRendererPane();
   grid.add(rendererPane);
   gridHeader = (JGrid) jComponent;
   jComponent.setOpaque(false);
   LookAndFeel.installColorsAndFont(
       jComponent, "TableHeader.background", "TableHeader.foreground", "TableHeader.font");
   installDefaults();
   installListeners();
   installKeyboardActions();
 }
Пример #6
0
  protected void installDefaults(AbstractButton b) {
    // load shared instance defaults
    String pp = getPropertyPrefix();

    defaultTextShiftOffset = UIManager.getInt(pp + "textShiftOffset");

    // set the following defaults on the button
    if (b.isContentAreaFilled()) {
      LookAndFeel.installProperty(b, "opaque", Boolean.TRUE);
    } else {
      LookAndFeel.installProperty(b, "opaque", Boolean.FALSE);
    }

    if (b.getMargin() == null || (b.getMargin() instanceof UIResource)) {
      b.setMargin(UIManager.getInsets(pp + "margin"));
    }

    LookAndFeel.installColorsAndFont(b, pp + "background", pp + "foreground", pp + "font");
    LookAndFeel.installBorder(b, pp + "border");

    Object rollover = UIManager.get(pp + "rollover");
    if (rollover != null) {
      LookAndFeel.installProperty(b, "rolloverEnabled", rollover);
    }

    LookAndFeel.installProperty(b, "iconTextGap", new Integer(4));
  }
Пример #7
0
 private static boolean isWindows(LookAndFeel laf) {
   if (laf.getID() == "Windows") {
     return true;
   }
   if (!checkedForWindows) {
     try {
       WINDOWS_CLASS = Class.forName("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
     } catch (ClassNotFoundException e) {
     }
     checkedForWindows = true;
   }
   return (WINDOWS_CLASS != null && WINDOWS_CLASS.isInstance(laf));
 }
Пример #8
0
 /** Removes any border that may have been installed. */
 private void uninstallBorder(JRootPane root) {
   LookAndFeel.uninstallBorder(root);
 }
Пример #9
0
 protected void uninstallDefaults(AbstractButton b) {
   LookAndFeel.uninstallBorder(b);
 }
Пример #10
0
 protected void uninstallDefaults(JPanel p) {
   LookAndFeel.uninstallBorder(p);
 }
Пример #11
0
 protected void installDefaults(JPanel p) {
   LookAndFeel.installColorsAndFont(p, "Panel.background", "Panel.foreground", "Panel.font");
   LookAndFeel.installBorder(p, "Panel.border");
   LookAndFeel.installProperty(p, "opaque", Boolean.TRUE);
 }
Пример #12
0
 private static boolean isKnownLookAndFeel() {
   LookAndFeel laf = UIManager.getLookAndFeel();
   String lookAndFeelID = laf.getID();
   return (lookAndFeelID == "GTK" || lookAndFeelID == "Aqua" || isMetal(laf) || isWindows(laf));
 }
Пример #13
0
 private static boolean isMetal(LookAndFeel laf) {
   return (laf.getID() == "Metal" || laf instanceof MetalLookAndFeel);
 }