/** * 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"); }
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); } } }
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); }
/** 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); }
/** 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]); } }
/** * 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; } }
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"); }
/** * 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); } }
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); }
/** 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()); } }
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; }
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; }
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); }
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); }
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(); }
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)); }
/** Removes any border that may have been installed. */ private void uninstallBorder(JRootPane root) { LookAndFeel.uninstallBorder(root); }
/** {@inheritDoc} */ @Override protected void installDefaults(AbstractButton b) { updateStyle(b); LookAndFeel.installProperty(b, "rolloverEnabled", Boolean.TRUE); }
protected void uninstallDefaults() { LookAndFeel.uninstallBorder(optionPane); }
private static boolean isMetal(LookAndFeel laf) { return (laf.getID() == "Metal" || laf instanceof MetalLookAndFeel); }
private static boolean isKnownLookAndFeel() { LookAndFeel laf = UIManager.getLookAndFeel(); String lookAndFeelID = laf.getID(); return (lookAndFeelID == "GTK" || lookAndFeelID == "Aqua" || isMetal(laf) || isWindows(laf)); }
protected void installDefaults() { if (desktop.getBackground() == null || desktop.getBackground() instanceof UIResource) { desktop.setBackground(UIManager.getColor("Desktop.background")); } LookAndFeel.installProperty(desktop, "opaque", Boolean.TRUE); }
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); }
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)); }
protected void uninstallDefaults(AbstractButton b) { LookAndFeel.uninstallBorder(b); }
protected void uninstallDefaults(JPanel p) { LookAndFeel.uninstallBorder(p); }
@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); }
protected void uninstallDefaults() { LookAndFeel.uninstallBorder(progressBar); }