コード例 #1
1
ファイル: JTreeTable.java プロジェクト: heuermh/cytoscape-api
  /**
   * Overridden to message super and forward the method to the tree. Since the tree is not actually
   * in the component hierarchy it will never receive this unless we forward it in this manner.
   */
  public void updateUI() {
    super.updateUI();

    if (tree != null) tree.updateUI();

    // Use the tree's default foreground and background colors in the
    // table.
    LookAndFeel.installColorsAndFont(this, "Tree.background", "Tree.foreground", "Tree.font");
  }
コード例 #2
0
ファイル: SynthButtonUI.java プロジェクト: FauxFaux/jdk9-jdk
  void updateStyle(AbstractButton b) {
    SynthContext context = getContext(b, SynthConstants.ENABLED);
    SynthStyle oldStyle = style;
    style = SynthLookAndFeel.updateStyle(context, this);
    if (style != oldStyle) {
      if (b.getMargin() == null || (b.getMargin() instanceof UIResource)) {
        Insets margin = (Insets) style.get(context, getPropertyPrefix() + "margin");

        if (margin == null) {
          // Some places assume margins are non-null.
          margin = SynthLookAndFeel.EMPTY_UIRESOURCE_INSETS;
        }
        b.setMargin(margin);
      }

      Object value = style.get(context, getPropertyPrefix() + "iconTextGap");
      if (value != null) {
        LookAndFeel.installProperty(b, "iconTextGap", value);
      }

      value = style.get(context, getPropertyPrefix() + "contentAreaFilled");
      LookAndFeel.installProperty(b, "contentAreaFilled", value != null ? value : Boolean.TRUE);

      if (oldStyle != null) {
        uninstallKeyboardActions(b);
        installKeyboardActions(b);
      }
    }
  }
コード例 #3
0
 protected void installDefaults() {
   LookAndFeel.installColorsAndFont(
       optionPane, "OptionPane.background", "OptionPane.foreground", "OptionPane.font");
   LookAndFeel.installBorder(optionPane, "OptionPane.border");
   minimumSize = UIManager.getDimension("OptionPane.minimumSize");
   LookAndFeel.installProperty(optionPane, "opaque", Boolean.TRUE);
 }
コード例 #4
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);
 }
コード例 #5
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]);
    }
  }
コード例 #6
0
 /**
  * A utility function that layers on top of the LookAndFeel's isSupportedLookAndFeel() method.
  * Returns true if the LookAndFeel is supported. Returns false if the LookAndFeel is not supported
  * and/or if there is any kind of error checking if the LookAndFeel is supported.
  *
  * <p>The L&F menu will use this method to detemine whether the various L&F options should be
  * active or inactive.
  */
 protected boolean isAvailableLookAndFeel(String laf) {
   try {
     Class lnfClass = Class.forName(laf);
     LookAndFeel newLAF = (LookAndFeel) (lnfClass.newInstance());
     return newLAF.isSupportedLookAndFeel();
   } catch (Exception e) { // If ANYTHING weird happens, return false
     return false;
   }
 }
コード例 #7
0
 protected void installDefaults() {
   LookAndFeel.installProperty(progressBar, "opaque", Boolean.TRUE);
   LookAndFeel.installBorder(progressBar, "ProgressBar.border");
   LookAndFeel.installColorsAndFont(
       progressBar, "ProgressBar.background", "ProgressBar.foreground", "ProgressBar.font");
   cellLength = UIManager.getInt("ProgressBar.cellLength");
   if (cellLength == 0) cellLength = 1;
   cellSpacing = UIManager.getInt("ProgressBar.cellSpacing");
   selectionForeground = UIManager.getColor("ProgressBar.selectionForeground");
   selectionBackground = UIManager.getColor("ProgressBar.selectionBackground");
 }
コード例 #8
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);
   }
 }
コード例 #9
0
 public AnimatedToolTip(JLabel label) {
   super();
   this.iconlabel = label;
   LookAndFeel.installColorsAndFont(
       iconlabel, "ToolTip.background", "ToolTip.foreground", "ToolTip.font");
   iconlabel.setOpaque(true);
   setLayout(new BorderLayout());
   add(iconlabel);
 }
コード例 #10
0
ファイル: RootPaneUI.java プロジェクト: rob-work/iwbcff
  /** 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 {
      root.setBorder(new RootPaneBorder());
    }
  }
コード例 #11
0
  InputMap createInputMap(int condition) {
    if (condition == JComponent.WHEN_IN_FOCUSED_WINDOW) {
      Object[] bindings = (Object[]) DefaultLookup.get(desktop, this, "Desktop.windowBindings");

      if (bindings != null) {
        return LookAndFeel.makeComponentInputMap(desktop, bindings);
      }
    }
    return null;
  }
コード例 #12
0
 InputMap getInputMap(int condition) {
   if (condition == JComponent.WHEN_IN_FOCUSED_WINDOW) {
     Object[] bindings =
         (Object[]) DefaultLookup.get(optionPane, this, "OptionPane.windowBindings");
     if (bindings != null) {
       return LookAndFeel.makeComponentInputMap(optionPane, bindings);
     }
   }
   return null;
 }
コード例 #13
0
 protected void installDefaults(JFileChooser fc) {
   installIcons(fc);
   installStrings(fc);
   usesSingleFilePane = UIManager.getBoolean("FileChooser.usesSingleFilePane");
   readOnly = UIManager.getBoolean("FileChooser.readOnly");
   TransferHandler th = fc.getTransferHandler();
   if (th == null || th instanceof UIResource) {
     fc.setTransferHandler(defaultTransferHandler);
   }
   LookAndFeel.installProperty(fc, "opaque", Boolean.FALSE);
 }
コード例 #14
0
  protected void installListeners() {
    super.installListeners();

    handler = new AquaFocusHandler();
    final JTextComponent c = getComponent();
    c.addFocusListener(handler);
    c.addPropertyChangeListener(handler);

    LookAndFeel.installProperty(c, "opaque", UIManager.getBoolean(getPropertyPrefix() + "opaque"));
    AquaUtilControlSize.addSizePropertyListener(c);
    AquaTextFieldSearch.installSearchFieldListener(c);
  }
コード例 #15
0
 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();
 }
コード例 #16
0
ファイル: Baseline.java プロジェクト: benbac20/jrdesktop
 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));
 }
コード例 #17
0
 /** Removes any border that may have been installed. */
 private void uninstallBorder(JRootPane root) {
   LookAndFeel.uninstallBorder(root);
 }
コード例 #18
0
ファイル: SynthButtonUI.java プロジェクト: FauxFaux/jdk9-jdk
  /** {@inheritDoc} */
  @Override
  protected void installDefaults(AbstractButton b) {
    updateStyle(b);

    LookAndFeel.installProperty(b, "rolloverEnabled", Boolean.TRUE);
  }
コード例 #19
0
 protected void uninstallDefaults() {
   LookAndFeel.uninstallBorder(optionPane);
 }
コード例 #20
0
ファイル: Baseline.java プロジェクト: benbac20/jrdesktop
 private static boolean isMetal(LookAndFeel laf) {
   return (laf.getID() == "Metal" || laf instanceof MetalLookAndFeel);
 }
コード例 #21
0
ファイル: Baseline.java プロジェクト: benbac20/jrdesktop
 private static boolean isKnownLookAndFeel() {
   LookAndFeel laf = UIManager.getLookAndFeel();
   String lookAndFeelID = laf.getID();
   return (lookAndFeelID == "GTK" || lookAndFeelID == "Aqua" || isMetal(laf) || isWindows(laf));
 }
コード例 #22
0
 protected void installDefaults() {
   if (desktop.getBackground() == null || desktop.getBackground() instanceof UIResource) {
     desktop.setBackground(UIManager.getColor("Desktop.background"));
   }
   LookAndFeel.installProperty(desktop, "opaque", Boolean.TRUE);
 }
コード例 #23
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);
 }
コード例 #24
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));
  }
コード例 #25
0
 protected void uninstallDefaults(AbstractButton b) {
   LookAndFeel.uninstallBorder(b);
 }
コード例 #26
0
 protected void uninstallDefaults(JPanel p) {
   LookAndFeel.uninstallBorder(p);
 }
コード例 #27
0
  @Override
  protected void initComponentDefaults(UIDefaults table) {
    String prefValue;
    // True if file choosers orders by type
    boolean isOrderFilesByType = false;
    // True if file choosers shows all files by default
    prefValue =
        OSXPreferences.getString( //
                OSXPreferences.FINDER_PREFERENCES, "AppleShowAllFiles", "false") //
            .toLowerCase();
    boolean isFileHidingEnabled = prefValue.equals("false") || prefValue.equals("no");
    boolean isQuickLookEnabled =
        Boolean.valueOf(QuaquaManager.getProperty("Quaqua.FileChooser.quickLookEnabled", "true"));

    Font smallSystemFont = SMALL_SYSTEM_FONT;
    Color grayedFocusCellBorderColor = (Color) table.get("listHighlight");

    Object[] uiDefaults = {
      "Browser.expandedIcon",
      new UIDefaults.ProxyLazyValue(
          "ch.randelshofer.quaqua.QuaquaIconFactory",
          "createIcon",
          new Object[] {jaguarDir + "Browser.disclosureIcons.png", 6, Boolean.TRUE, 0}),
      "Browser.expandingIcon",
      new UIDefaults.ProxyLazyValue(
          "ch.randelshofer.quaqua.QuaquaIconFactory",
          "createIcon",
          new Object[] {jaguarDir + "Browser.disclosureIcons.png", 6, Boolean.TRUE, 1}),
      "Browser.focusedSelectedExpandedIcon",
      new UIDefaults.ProxyLazyValue(
          "ch.randelshofer.quaqua.QuaquaIconFactory",
          "createIcon",
          new Object[] {jaguarDir + "Browser.disclosureIcons.png", 6, Boolean.TRUE, 2}),
      "Browser.focusedSelectedExpandingIcon",
      new UIDefaults.ProxyLazyValue(
          "ch.randelshofer.quaqua.QuaquaIconFactory",
          "createIcon",
          new Object[] {jaguarDir + "Browser.disclosureIcons.png", 6, Boolean.TRUE, 3}),
      "Browser.selectedExpandedIcon",
      new UIDefaults.ProxyLazyValue(
          "ch.randelshofer.quaqua.QuaquaIconFactory",
          "createIcon",
          new Object[] {jaguarDir + "Browser.disclosureIcons.png", 6, Boolean.TRUE, 4}),
      "Browser.selectedExpandingIcon",
      new UIDefaults.ProxyLazyValue(
          "ch.randelshofer.quaqua.QuaquaIconFactory",
          "createIcon",
          new Object[] {jaguarDir + "Browser.disclosureIcons.png", 6, Boolean.TRUE, 5}),
      //
      "Browser.selectionBackground",
      new ColorUIResource(56, 117, 215),
      "Browser.selectionForeground",
      new ColorUIResource(255, 255, 255),
      "Browser.inactiveSelectionBackground",
      new ColorUIResource(208, 208, 208),
      "Browser.inactiveSelectionForeground",
      new ColorUIResource(0, 0, 0),
      "Browser.sizeHandleIcon",
      makeIcon(getClass(), commonDir + "Browser.sizeHandleIcon.png"),
      "FileChooser.homeFolderIcon",
      LookAndFeel.makeIcon(getClass(), commonDir + "FileChooser.homeFolderIcon.png"),
      //
      "FileView.computerIcon",
      LookAndFeel.makeIcon(getClass(), commonDir + "FileView.computerIcon.png"),
      //
      "FileChooser.fileHidingEnabled",
      isFileHidingEnabled,
      "FileChooser.quickLookEnabled",
      isQuickLookEnabled,
      "FileChooser.orderByType",
      isOrderFilesByType,
      "FileChooser.previewLabelForeground",
      new ColorUIResource(0x000000),
      "FileChooser.previewValueForeground",
      new ColorUIResource(0x000000),
      "FileChooser.previewLabelFont",
      smallSystemFont,
      "FileChooser.previewValueFont",
      smallSystemFont,
      "FileChooser.splitPaneDividerSize",
      6,
      "FileChooser.previewLabelInsets",
      new InsetsUIResource(0, 0, 0, 4),
      "FileChooser.cellTipOrigin",
      new Point(18, 1),
      "FileChooser.autovalidate",
      Boolean.TRUE,
      "FileChooser.browserFocusCellHighlightBorder",
      new UIDefaults.ProxyLazyValue(
          "javax.swing.plaf.BorderUIResource$EmptyBorderUIResource",
          new Object[] {new Insets(1, 1, 1, 1)}),
      "FileChooser.browserFocusCellHighlightBorderGrayed",
      new UIDefaults.ProxyLazyValue(
          "javax.swing.plaf.BorderUIResource$MatteBorderUIResource",
          new Object[] {1, 1, 1, 1, grayedFocusCellBorderColor}),
      "FileChooser.browserCellBorder",
      new UIDefaults.ProxyLazyValue(
          "javax.swing.plaf.BorderUIResource$EmptyBorderUIResource",
          new Object[] {new Insets(1, 1, 1, 1)}),
      "FileChooser.browserUseUnselectedExpandIconForLabeledFile",
      Boolean.TRUE,
      "Sheet.showAsSheet",
      Boolean.TRUE,
    };
    table.putDefaults(uiDefaults);
  }
コード例 #28
0
 protected void uninstallDefaults() {
   LookAndFeel.uninstallBorder(progressBar);
 }