// Workaround to avoid a bug in the java 1.3 VM
 static {
   try {
     if (JTattooUtilities.getJavaVersion() < 1.4) {
       UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
     }
   } catch (Exception ex) {
   }
 }
Exemplo n.º 2
0
  protected void initClassDefaults(UIDefaults table) {
    if (!"graphiteTheme".equals(currentThemeName)) {
      setTheme("Default");
    }
    super.initClassDefaults(table);
    Object[] uiDefaults = {
      // BaseLookAndFeel classes
      "LabelUI", BaseLabelUI.class.getName(),
      "ToggleButtonUI", BaseToggleButtonUI.class.getName(),
      "SeparatorUI", BaseSeparatorUI.class.getName(),
      "TextFieldUI", BaseTextFieldUI.class.getName(),
      "TextAreaUI", BaseTextAreaUI.class.getName(),
      "EditorPaneUI", BaseEditorPaneUI.class.getName(),
      "PasswordFieldUI", BasePasswordFieldUI.class.getName(),
      "ComboBoxUI", BaseComboBoxUI.class.getName(),
      "ToolTipUI", BaseToolTipUI.class.getName(),
      "TreeUI", BaseTreeUI.class.getName(),
      "TableUI", BaseTableUI.class.getName(),
      "TableHeaderUI", BaseTableHeaderUI.class.getName(),
      "ScrollBarUI", BaseScrollBarUI.class.getName(),
      "ScrollPaneUI", BaseScrollPaneUI.class.getName(),
      "ProgressBarUI", BaseProgressBarUI.class.getName(),
      "PanelUI", BasePanelUI.class.getName(),
      "SplitPaneUI", BaseSplitPaneUI.class.getName(),
      "SliderUI", BaseSliderUI.class.getName(),
      "FileChooserUI", BaseFileChooserUI.class.getName(),
      "MenuBarUI", BaseMenuBarUI.class.getName(),
      "PopupMenuUI", BasePopupMenuUI.class.getName(),
      "PopupMenuSeparatorUI", BaseSeparatorUI.class.getName(),
      "DesktopPaneUI", BaseDesktopPaneUI.class.getName(),

      // GraphiteLookAndFeel classes
      "RadioButtonUI", GraphiteRadioButtonUI.class.getName(),
      "CheckBoxUI", GraphiteCheckBoxUI.class.getName(),
      "ButtonUI", GraphiteButtonUI.class.getName(),
      "MenuUI", GraphiteMenuUI.class.getName(),
      "MenuItemUI", GraphiteMenuItemUI.class.getName(),
      "CheckBoxMenuItemUI", GraphiteCheckBoxMenuItemUI.class.getName(),
      "RadioButtonMenuItemUI", GraphiteRadioButtonMenuItemUI.class.getName(),
      "TabbedPaneUI", GraphiteTabbedPaneUI.class.getName(),
      "ToolBarUI", GraphiteToolBarUI.class.getName(),
      "InternalFrameUI", GraphiteInternalFrameUI.class.getName(),
      "RootPaneUI", GraphiteRootPaneUI.class.getName(),
    };
    table.putDefaults(uiDefaults);
    if (JTattooUtilities.getJavaVersion() >= 1.5) {
      table.put("FormattedTextFieldUI", BaseFormattedTextFieldUI.class.getName());
      table.put("SpinnerUI", BaseSpinnerUI.class.getName());
    }
  }
Exemplo n.º 3
0
  public static void fillComponent(Graphics g, Component c) {
    Graphics2D g2D = (Graphics2D) g;
    int w = c.getWidth();
    int h = c.getHeight();
    if (AbstractLookAndFeel.getTheme().isBackgroundPatternOn()) {
      // pattern
      Point p = JTattooUtilities.getRelLocation(c);
      Dimension d = JTattooUtilities.getFrameSize(c);
      int y = -p.y;
      while (y < h) {
        int x = -p.x;
        while (x < w) {
          BG_IMAGE.paintIcon(c, g, x, y);
          x += IMAGE_WIDTH;
        }
        y += IMAGE_HEIGHT;
      }
      if (JTattooUtilities.getJavaVersion() >= 1.6) {
        // higlight
        if (backgroundImage == null
            || backgroundImage.getWidth(null) != d.width
            || backgroundImage.getHeight(null) != d.height) {
          backgroundImage = c.createImage(d.width, d.height);
          Graphics2D ig2D = (Graphics2D) backgroundImage.getGraphics();
          Point pt1 = new Point(0, 0);
          Point pt2 = new Point(d.width, 0);
          float fractions[] = {0.0f, 0.5f, 1.0f};
          Color c1 = new Color(220, 220, 220);
          Color colors[] = {c1, Color.white, c1};
          ig2D.setPaint(new LinearGradientPaint(pt1, pt2, fractions, colors));
          ig2D.fillRect(0, 0, d.width, d.height);
          ig2D.dispose();
        }

        Composite savedComposite = g2D.getComposite();
        g2D.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.7f));
        g2D.drawImage(backgroundImage, -p.x, 0, null);
        g2D.setComposite(savedComposite);
      }
    } else {
      g.setColor(c.getBackground());
      g.fillRect(0, 0, w, h);
    }
  }
Exemplo n.º 4
0
  protected void paintText(Graphics g, AbstractButton b, Rectangle textRect, String text) {
    ButtonModel model = b.getModel();
    FontMetrics fm = JTattooUtilities.getFontMetrics(b, g, b.getFont());
    int mnemIndex;
    if (JTattooUtilities.getJavaVersion() >= 1.4) {
      mnemIndex = b.getDisplayedMnemonicIndex();
    } else {
      mnemIndex = JTattooUtilities.findDisplayedMnemonicIndex(b.getText(), model.getMnemonic());
    }
    int offs = 0;
    if (model.isArmed() && model.isPressed()) {
      offs = 1;
    }

    Graphics2D g2D = (Graphics2D) g;
    Composite composite = g2D.getComposite();
    AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f);
    g2D.setComposite(alpha);
    Color foreground = b.getForeground();
    Color background = b.getBackground();
    if (background instanceof ColorUIResource) {
      if (model.isPressed() && model.isArmed()) {
        foreground = AbstractLookAndFeel.getTheme().getSelectionForegroundColor();
      } else if (model.isRollover()) {
        foreground = AbstractLookAndFeel.getTheme().getRolloverForegroundColor();
      }
    }
    if (!model.isEnabled()) {
      foreground = AbstractLookAndFeel.getTheme().getDisabledForegroundColor();
    }
    if (ColorHelper.getGrayValue(foreground) > 64) {
      g2D.setColor(Color.black);
    } else {
      g2D.setColor(Color.white);
    }
    JTattooUtilities.drawStringUnderlineCharAt(
        b, g, text, mnemIndex, textRect.x + offs + 1, textRect.y + offs + fm.getAscent() + 1);
    g2D.setComposite(composite);
    g2D.setColor(foreground);
    JTattooUtilities.drawStringUnderlineCharAt(
        b, g, text, mnemIndex, textRect.x + offs, textRect.y + offs + fm.getAscent());
  }
Exemplo n.º 5
0
 protected void paintText(Graphics g, JComponent c, String text, Rectangle textRect) {
   View v = (View) c.getClientProperty(BasicHTML.propertyKey);
   if (v != null) {
     v.paint(g, textRect);
   } else {
     AbstractButton b = (AbstractButton) c;
     ButtonModel model = b.getModel();
     int mnemIndex = -1;
     if (JTattooUtilities.getJavaVersion() >= 1.4) {
       mnemIndex = b.getDisplayedMnemonicIndex();
     } else {
       mnemIndex = JTattooUtilities.findDisplayedMnemonicIndex(b.getText(), model.getMnemonic());
     }
     Font f = c.getFont();
     g.setFont(f);
     FontMetrics fm = g.getFontMetrics();
     if (model.isEnabled()) {
       Color fc = b.getForeground();
       if (AbstractLookAndFeel.getTheme().isTextShadowOn() && ColorHelper.getGrayValue(fc) > 128) {
         g.setColor(Color.black);
         JTattooUtilities.drawStringUnderlineCharAt(
             c, g, text, mnemIndex, textRect.x + 1, textRect.y + 1 + fm.getAscent());
       }
       g.setColor(fc);
       JTattooUtilities.drawStringUnderlineCharAt(
           c, g, text, mnemIndex, textRect.x, textRect.y + fm.getAscent());
     } else {
       g.setColor(Color.black);
       JTattooUtilities.drawStringUnderlineCharAt(
           c, g, text, mnemIndex, textRect.x + 1, textRect.y + 1 + fm.getAscent());
       g.setColor(AbstractLookAndFeel.getDisabledForegroundColor());
       JTattooUtilities.drawStringUnderlineCharAt(
           c, g, text, mnemIndex, textRect.x, textRect.y + fm.getAscent());
     }
   }
 }
  protected void initComponentDefaults(UIDefaults table) {
    super.initComponentDefaults(table);

    BaseBorders.initDefaults();
    BaseIcons.initDefaults();

    Object textFieldBorder = getBorderFactory().getTextFieldBorder();
    Object comboBoxBorder = getBorderFactory().getComboBoxBorder();
    Object scrollPaneBorder = getBorderFactory().getScrollPaneBorder();
    Object tableScrollPaneBorder = getBorderFactory().getTableScrollPaneBorder();
    Object tabbedPaneBorder = getBorderFactory().getTabbedPaneBorder();
    Object buttonBorder = getBorderFactory().getButtonBorder();
    Object toggleButtonBorder = getBorderFactory().getToggleButtonBorder();
    Object titledBorderBorder =
        new UIDefaults.ProxyLazyValue(
            "javax.swing.plaf.BorderUIResource$LineBorderUIResource",
            new Object[] {getFrameColor()});
    Object menuBarBorder = getBorderFactory().getMenuBarBorder();
    Object popupMenuBorder = getBorderFactory().getPopupMenuBorder();
    Object menuItemBorder = getBorderFactory().getMenuItemBorder();
    Object toolBarBorder = getBorderFactory().getToolBarBorder();
    Object progressBarBorder = getBorderFactory().getProgressBarBorder();
    Object toolTipBorder =
        new UIDefaults.ProxyLazyValue(
            "javax.swing.plaf.BorderUIResource$LineBorderUIResource",
            new Object[] {getFrameColor()});
    Object focusCellHighlightBorder =
        new UIDefaults.ProxyLazyValue(
            "javax.swing.plaf.BorderUIResource$LineBorderUIResource",
            new Object[] {getFocusCellColor()});
    Object optionPaneBorder = BorderFactory.createEmptyBorder(0, 0, 0, 0);
    Object optionPaneMessageAreaBorder = BorderFactory.createEmptyBorder(8, 8, 8, 8);
    Object optionPaneButtonAreaBorder = BorderFactory.createEmptyBorder(0, 8, 8, 8);
    Object windowBorder = getBorderFactory().getInternalFrameBorder();

    Color c = getBackgroundColor();
    ColorUIResource progressBarBackground = new ColorUIResource(ColorHelper.brighter(c, 20));

    // DEFAULTS TABLE
    Object[] defaults = {
      "controlTextFont", getControlTextFont(),
      "systemTextFont ", getSystemTextFont(),
      "userTextFont", getUserTextFont(),
      "menuTextFont", getMenuTextFont(),
      "windowTitleFont", getWindowTitleFont(),
      "subTextFont", getSubTextFont(),
      "Label.font", getUserTextFont(),
      "Label.background", getBackgroundColor(),
      "Label.foreground", getForegroundColor(),
      "Label.disabledText", getDisabledForegroundColor(),
      "Label.disabledShadow", getWhite(),
      // Text (Note: many are inherited)
      "TextField.border", textFieldBorder,
      "TextField.foreground", getInputForegroundColor(),
      "TextField.background", getInputBackgroundColor(),
      "TextField.disabledForeground", getDisabledForegroundColor(),
      "TextField.disabledBackground", getDisabledBackgroundColor(),
      "TextField.inactiveForeground", getDisabledForegroundColor(),
      "TextField.inactiveBackground", getDisabledBackgroundColor(),
      "TextArea.foreground", getInputForegroundColor(),
      "TextArea.background", getInputBackgroundColor(),
      "TextArea.disabledForeground", getDisabledForegroundColor(),
      "TextArea.disabledBackground", getDisabledBackgroundColor(),
      "TextArea.inactiveForeground", getDisabledForegroundColor(),
      "TextArea.inactiveBackground", getDisabledBackgroundColor(),
      "EditorPane.foreground", getInputForegroundColor(),
      "EditorPane.background", getInputBackgroundColor(),
      "EditorPane.disabledForeground", getDisabledForegroundColor(),
      "EditorPane.disabledBackground", getDisabledBackgroundColor(),
      "EditorPane.inactiveForeground", getDisabledForegroundColor(),
      "EditorPane.inactiveBackground", getDisabledBackgroundColor(),
      "FormattedTextField.border", textFieldBorder,
      "FormattedTextField.foreground", getInputForegroundColor(),
      "FormattedTextField.background", getInputBackgroundColor(),
      "FormattedTextField.disabledForeground", getDisabledForegroundColor(),
      "FormattedTextField.disabledBackground", getDisabledBackgroundColor(),
      "FormattedTextField.inactiveForeground", getDisabledForegroundColor(),
      "FormattedTextField.inactiveBackground", getDisabledBackgroundColor(),
      "PasswordField.border", textFieldBorder,
      "PasswordField.foreground", getInputForegroundColor(),
      "PasswordField.background", getInputBackgroundColor(),
      "PasswordField.disabledForeground", getDisabledForegroundColor(),
      "PasswordField.disabledBackground", getDisabledBackgroundColor(),
      "PasswordField.inactiveForeground", getDisabledForegroundColor(),
      "PasswordField.inactiveBackground", getDisabledBackgroundColor(),
      // Buttons
      "Button.background", getButtonBackgroundColor(),
      "Button.foreground", getButtonForegroundColor(),
      "Button.disabledText", getDisabledForegroundColor(),
      "Button.disabledShadow", getWhite(),
      "Button.select", getSelectionBackgroundColor(),
      "Button.border", buttonBorder,
      "Button.frame", getFrameColor(),
      "Button.focus", getFocusColor(),
      "Button.rolloverColor", getTheme().getRolloverColor(),
      "CheckBox.font", getUserTextFont(),
      "CheckBox.background", getBackgroundColor(),
      "CheckBox.foreground", getForegroundColor(),
      "CheckBox.disabledText", getDisabledForegroundColor(),
      "CheckBox.disabledShadow", getWhite(),
      "Checkbox.select", getSelectionBackgroundColor(),
      "CheckBox.focus", getFocusColor(),
      "CheckBox.icon", getIconFactory().getCheckBoxIcon(),
      "RadioButton.font", getUserTextFont(),
      "RadioButton.background", getBackgroundColor(),
      "RadioButton.foreground", getForegroundColor(),
      "RadioButton.disabledText", getDisabledForegroundColor(),
      "RadioButton.disabledShadow", getWhite(),
      "RadioButton.select", getSelectionBackgroundColor(),
      "RadioButton.icon", getIconFactory().getRadioButtonIcon(),
      "RadioButton.focus", getFocusColor(),
      "ToggleButton.background", getButtonBackgroundColor(),
      "ToggleButton.foreground", getButtonForegroundColor(),
      "ToggleButton.select", getSelectionBackgroundColor(),
      "ToggleButton.text", getButtonForegroundColor(),
      "ToggleButton.disabledText", getDisabledForegroundColor(),
      "ToggleButton.disabledShadow", getWhite(),
      "ToggleButton.disabledSelectedText", getDisabledForegroundColor(),
      "ToggleButton.disabledBackground", getButtonBackgroundColor(),
      "ToggleButton.disabledSelectedBackground", getSelectionBackgroundColor(),
      "ToggleButton.focus", getFocusColor(),
      "ToggleButton.border", toggleButtonBorder,
      // ToolTip
      "ToolTip.border", toolTipBorder,
      "ToolTip.foreground", getTooltipForegroundColor(),
      "ToolTip.background", getTooltipBackgroundColor(),
      // Slider
      "Slider.border", null,
      "Slider.foreground", getFrameColor(),
      "Slider.background", getBackgroundColor(),
      "Slider.focus", getFocusColor(),
      "Slider.focusInsets", new InsetsUIResource(0, 0, 0, 0),
      "Slider.trackWidth", new Integer(7),
      "Slider.majorTickLength", new Integer(6),
      // Progress Bar
      "ProgressBar.border", progressBarBorder,
      "ProgressBar.background", progressBarBackground,
      "ProgressBar.selectionForeground", getSelectionForegroundColor(),
      "ProgressBar.selectionBackground", getForegroundColor(),
      // Combo Box
      "ComboBox.border", comboBoxBorder,
      "ComboBox.background", getInputBackgroundColor(),
      "ComboBox.foreground", getInputForegroundColor(),
      "ComboBox.selectionBackground", getSelectionBackgroundColor(),
      "ComboBox.selectionForeground", getSelectionForegroundColor(),
      "ComboBox.selectionBorderColor", getFocusColor(),
      "ComboBox.disabledBackground", getDisabledBackgroundColor(),
      "ComboBox.disabledForeground", getDisabledForegroundColor(),
      "ComboBox.listBackground", getInputBackgroundColor(),
      "ComboBox.listForeground", getInputForegroundColor(),
      "ComboBox.font", getUserTextFont(),
      // Panel
      "Panel.foreground", getForegroundColor(),
      "Panel.background", getBackgroundColor(),
      "Panel.darkBackground", getTheme().getBackgroundColorDark(),
      "Panel.lightBackground", getTheme().getBackgroundColorLight(),
      "Panel.alterBackground", getTheme().getAlterBackgroundColor(),
      "Panel.font", getUserTextFont(),
      // RootPane
      "RootPane.frameBorder", windowBorder,
      "RootPane.plainDialogBorder", windowBorder,
      "RootPane.informationDialogBorder", windowBorder,
      "RootPane.errorDialogBorder", windowBorder,
      "RootPane.colorChooserDialogBorder", windowBorder,
      "RootPane.fileChooserDialogBorder", windowBorder,
      "RootPane.questionDialogBorder", windowBorder,
      "RootPane.warningDialogBorder", windowBorder,
      // InternalFrame
      "InternalFrame.border", getBorderFactory().getInternalFrameBorder(),
      "InternalFrame.font", getWindowTitleFont(),
      "InternalFrame.paletteBorder", getBorderFactory().getPaletteBorder(),
      "InternalFrame.paletteTitleHeight", new Integer(11),
      "InternalFrame.paletteCloseIcon", getIconFactory().getPaletteCloseIcon(),
      "InternalFrame.icon", getIconFactory().getMenuIcon(),
      "InternalFrame.iconifyIcon", getIconFactory().getIconIcon(),
      "InternalFrame.maximizeIcon", getIconFactory().getMaxIcon(),
      "InternalFrame.minimizeIcon", getIconFactory().getMinIcon(),
      "InternalFrame.closeIcon", getIconFactory().getCloseIcon(),

      // Titled Border
      "TitledBorder.titleColor", getForegroundColor(),
      "TitledBorder.border", titledBorderBorder,
      // List
      "List.focusCellHighlightBorder", focusCellHighlightBorder,
      "List.font", getUserTextFont(),
      "List.foreground", getInputForegroundColor(),
      "List.background", getInputBackgroundColor(),
      "List.selectionForeground", getSelectionForegroundColor(),
      "List.selectionBackground", getSelectionBackgroundColor(),
      "List.disabledForeground", getDisabledForegroundColor(),
      "List.disabledBackground", getDisabledBackgroundColor(),
      // ScrollBar
      "ScrollBar.background", getControlBackgroundColor(),
      "ScrollBar.highlight", getControlHighlightColor(),
      "ScrollBar.shadow", getControlShadowColor(),
      "ScrollBar.darkShadow", getControlDarkShadowColor(),
      "ScrollBar.thumb", getControlBackgroundColor(),
      "ScrollBar.thumbShadow", getControlShadowColor(),
      "ScrollBar.thumbHighlight", getControlHighlightColor(),
      "ScrollBar.width", new Integer(17),
      "ScrollBar.allowsAbsolutePositioning", Boolean.TRUE,
      // ScrollPane
      "ScrollPane.border", scrollPaneBorder,
      "ScrollPane.foreground", getForegroundColor(),
      "ScrollPane.background", getBackgroundColor(),
      // Viewport
      "Viewport.foreground", getForegroundColor(),
      "Viewport.background", getBackgroundColor(),
      "Viewport.font", getUserTextFont(),

      // Tabbed Pane
      "TabbedPane.boder", tabbedPaneBorder,
      "TabbedPane.background", getBackgroundColor(),
      "TabbedPane.tabAreaBackground", getTabAreaBackgroundColor(),
      "TabbedPane.unselectedBackground", getControlColorDark(),
      "TabbedPane.foreground", getControlForegroundColor(),
      "TabbedPane.selected", getBackgroundColor(),
      "TabbedPane.selectedForeground", getTabSelectionForegroundColor(),
      "TabbedPane.tabAreaInsets", new InsetsUIResource(5, 5, 5, 5),
      "TabbedPane.contentBorderInsets", new InsetsUIResource(0, 0, 0, 0),
      "TabbedPane.tabInsets", new InsetsUIResource(1, 6, 1, 6),
      "TabbedPane.focus", getFocusColor(),
      // TabbedPane ScrollButton
      "TabbedPane.selected", getButtonBackgroundColor(),
      "TabbedPane.shadow", new ColorUIResource(180, 180, 180),
      "TabbedPane.darkShadow", new ColorUIResource(120, 120, 120),
      "TabbedPane.highlight", new ColorUIResource(Color.white),
      // Tab Colors in Netbeans
      "tab_unsel_fill", getControlBackgroundColor(),
      "tab_sel_fill", getControlBackgroundColor(),
      // Table
      "Table.focusCellHighlightBorder", focusCellHighlightBorder,
      "Table.scrollPaneBorder", tableScrollPaneBorder,
      "Table.foreground", getInputForegroundColor(),
      "Table.background", getInputBackgroundColor(),
      "Table.gridColor", getGridColor(),
      "TableHeader.foreground", getControlForegroundColor(),
      "TableHeader.background", getBackgroundColor(),
      "TableHeader.cellBorder", getBorderFactory().getTableHeaderBorder(),
      // MenuBar
      "MenuBar.border", menuBarBorder,
      "MenuBar.foreground", getMenuForegroundColor(),
      "MenuBar.background", getMenuBackgroundColor(),
      // Menu
      "Menu.border", menuItemBorder,
      "Menu.borderPainted", Boolean.TRUE,
      "Menu.foreground", getMenuForegroundColor(),
      "Menu.background", getMenuBackgroundColor(),
      "Menu.selectionForeground", getMenuSelectionForegroundColor(),
      "Menu.selectionBackground", getMenuSelectionBackgroundColor(),
      "Menu.disabledForeground", getDisabledForegroundColor(),
      "Menu.acceleratorForeground", getMenuForegroundColor(),
      "Menu.acceleratorSelectionForeground", getMenuSelectionForegroundColor(),
      "Menu.arrowIcon", getIconFactory().getMenuArrowIcon(),
      // Popup Menu
      "PopupMenu.background", getMenuBackgroundColor(),
      "PopupMenu.border", popupMenuBorder,
      // Menu Item
      "MenuItem.border", menuItemBorder,
      "MenuItem.borderPainted", Boolean.TRUE,
      "MenuItem.foreground", getMenuForegroundColor(),
      "MenuItem.background", getMenuBackgroundColor(),
      "MenuItem.selectionForeground", getMenuSelectionForegroundColor(),
      "MenuItem.selectionBackground", getMenuSelectionBackgroundColor(),
      "MenuItem.disabledForeground", getDisabledForegroundColor(),
      "MenuItem.disabledShadow", getWhite(),
      "MenuItem.acceleratorForeground", getMenuForegroundColor(),
      "MenuItem.acceleratorSelectionForeground", getMenuSelectionForegroundColor(),
      "CheckBoxMenuItem.border", menuItemBorder,
      "CheckBoxMenuItem.borderPainted", Boolean.TRUE,
      "CheckBoxMenuItem.foreground", getMenuForegroundColor(),
      "CheckBoxMenuItem.background", getMenuBackgroundColor(),
      "CheckBoxMenuItem.selectionForeground", getMenuSelectionForegroundColor(),
      "CheckBoxMenuItem.selectionBackground", getMenuSelectionBackgroundColor(),
      "CheckBoxMenuItem.disabledForeground", getDisabledForegroundColor(),
      "CheckBoxMenuItem.disabledShadow", getWhite(),
      "CheckBoxMenuItem.acceleratorForeground", getMenuForegroundColor(),
      "CheckBoxMenuItem.acceleratorSelectionForeground", getMenuSelectionForegroundColor(),
      "CheckBoxMenuItem.checkIcon", getIconFactory().getMenuCheckBoxIcon(),
      "RadioButtonMenuItem.border", menuItemBorder,
      "RadioButtonMenuItem.borderPainted", Boolean.TRUE,
      "RadioButtonMenuItem.foreground", getMenuForegroundColor(),
      "RadioButtonMenuItem.background", getMenuBackgroundColor(),
      "RadioButtonMenuItem.selectionForeground", getMenuSelectionForegroundColor(),
      "RadioButtonMenuItem.selectionBackground", getMenuSelectionBackgroundColor(),
      "RadioButtonMenuItem.disabledForeground", getDisabledForegroundColor(),
      "RadioButtonMenuItem.disabledShadow", getWhite(),
      "RadioButtonMenuItem.acceleratorForeground", getMenuForegroundColor(),
      "RadioButtonMenuItem.acceleratorSelectionForeground", getMenuSelectionForegroundColor(),
      "RadioButtonMenuItem.checkIcon", getIconFactory().getMenuRadioButtonIcon(),
      // OptionPane.
      "OptionPane.errorIcon", getIconFactory().getOptionPaneErrorIcon(),
      "OptionPane.informationIcon", getIconFactory().getOptionPaneInformationIcon(),
      "OptionPane.warningIcon", getIconFactory().getOptionPaneWarningIcon(),
      "OptionPane.questionIcon", getIconFactory().getOptionPaneQuestionIcon(),
      "OptionPane.border", optionPaneBorder,
      "OptionPane.messageAreaBorder", optionPaneMessageAreaBorder,
      "OptionPane.buttonAreaBorder", optionPaneButtonAreaBorder,
      // File View
      "FileView.directoryIcon", getIconFactory().getTreeFolderIcon(),
      "FileView.fileIcon", getIconFactory().getTreeLeafIcon(),
      "FileView.computerIcon", getIconFactory().getTreeComputerIcon(),
      "FileView.hardDriveIcon", getIconFactory().getTreeHardDriveIcon(),
      "FileView.floppyDriveIcon", getIconFactory().getTreeFloppyDriveIcon(),
      // File Chooser
      "FileChooser.detailsViewIcon", getIconFactory().getFileChooserDetailViewIcon(),
      "FileChooser.homeFolderIcon", getIconFactory().getFileChooserHomeFolderIcon(),
      "FileChooser.listViewIcon", getIconFactory().getFileChooserListViewIcon(),
      "FileChooser.newFolderIcon", getIconFactory().getFileChooserNewFolderIcon(),
      "FileChooser.upFolderIcon", getIconFactory().getFileChooserUpFolderIcon(),
      // Separator
      "Separator.background", getBackgroundColor(),
      "Separator.foreground", getControlForegroundColor(),
      // SplitPane
      "SplitPane.centerOneTouchButtons", Boolean.TRUE,
      "SplitPane.dividerSize", new Integer(7),
      "SplitPane.border", BorderFactory.createEmptyBorder(),
      // Tree
      "Tree.background", getInputBackgroundColor(),
      "Tree.foreground", getInputForegroundColor(),
      "Tree.textForeground", getInputForegroundColor(),
      "Tree.textBackground", getInputBackgroundColor(),
      "Tree.openIcon", getIconFactory().getTreeFolderIcon(),
      "Tree.closedIcon", getIconFactory().getTreeFolderIcon(),
      "Tree.leafIcon", getIconFactory().getTreeLeafIcon(),
      "Tree.expandedIcon", getIconFactory().getTreeExpandedIcon(),
      "Tree.collapsedIcon", getIconFactory().getTreeCollapsedIcon(),
      "Tree.selectionBorderColor", getFocusCellColor(),
      "Tree.line", getFrameColor(), // horiz lines
      "Tree.hash", getFrameColor(), // legs

      // ToolBar
      "JToolBar.isRollover", Boolean.TRUE,
      "ToolBar.border", toolBarBorder,
      "ToolBar.background", getToolbarBackgroundColor(),
      "ToolBar.foreground", getToolbarForegroundColor(),
      "ToolBar.dockingBackground", getToolbarBackgroundColor(),
      "ToolBar.dockingForeground", getToolbarDockingColor(),
      "ToolBar.floatingBackground", getToolbarBackgroundColor(),
      "ToolBar.floatingForeground", getToolbarForegroundColor(),
    };
    table.putDefaults(defaults);

    if (JTattooUtilities.getJavaVersion() >= 1.5) {
      table.put("Spinner.font", getControlTextFont());
      table.put("Spinner.background", getButtonBackgroundColor());
      table.put("Spinner.foreground", getButtonForegroundColor());
      table.put("Spinner.border", getBorderFactory().getSpinnerBorder());
      table.put("Spinner.arrowButtonInsets", null);
      table.put("Spinner.arrowButtonBorder", BorderFactory.createEmptyBorder());
      table.put("Spinner.editorBorderPainted", Boolean.FALSE);
    }
  }
Exemplo n.º 7
0
  protected void paintText(
      Graphics g,
      int tabPlacement,
      Font font,
      FontMetrics metrics,
      int tabIndex,
      String title,
      Rectangle textRect,
      boolean isSelected) {
    g.setFont(font);
    View v = getTextViewForTab(tabIndex);
    if (v != null) {
      // html
      Graphics2D g2D = (Graphics2D) g;
      Object savedRenderingHint = null;
      if (AbstractLookAndFeel.getTheme().isTextAntiAliasingOn()) {
        savedRenderingHint = g2D.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING);
        g2D.setRenderingHint(
            RenderingHints.KEY_TEXT_ANTIALIASING,
            AbstractLookAndFeel.getTheme().getTextAntiAliasingHint());
      }
      v.paint(g, textRect);
      if (AbstractLookAndFeel.getTheme().isTextAntiAliasingOn()) {
        g2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, savedRenderingHint);
      }
    } else {
      // plain text
      int mnemIndex = -1;
      if (JTattooUtilities.getJavaVersion() >= 1.4) {
        mnemIndex = tabPane.getDisplayedMnemonicIndexAt(tabIndex);
      }

      if (tabPane.isEnabled() && tabPane.isEnabledAt(tabIndex)) {
        if (isSelected && (tabPane.getBackgroundAt(tabIndex) instanceof UIResource)) {
          Color shadowColor = ColorHelper.darker(AcrylLookAndFeel.getWindowTitleColorDark(), 30);
          g.setColor(shadowColor);
          JTattooUtilities.drawStringUnderlineCharAt(
              tabPane, g, title, mnemIndex, textRect.x - 1, textRect.y - 1 + metrics.getAscent());
          JTattooUtilities.drawStringUnderlineCharAt(
              tabPane, g, title, mnemIndex, textRect.x - 1, textRect.y + 1 + metrics.getAscent());
          JTattooUtilities.drawStringUnderlineCharAt(
              tabPane, g, title, mnemIndex, textRect.x + 1, textRect.y - 1 + metrics.getAscent());
          JTattooUtilities.drawStringUnderlineCharAt(
              tabPane, g, title, mnemIndex, textRect.x + 1, textRect.y + 1 + metrics.getAscent());
          g.setColor(AbstractLookAndFeel.getTheme().getWindowTitleForegroundColor());
        } else {
          g.setColor(tabPane.getForegroundAt(tabIndex));
        }
        JTattooUtilities.drawStringUnderlineCharAt(
            tabPane, g, title, mnemIndex, textRect.x, textRect.y + metrics.getAscent());

      } else { // tab disabled
        g.setColor(tabPane.getBackgroundAt(tabIndex).brighter());
        JTattooUtilities.drawStringUnderlineCharAt(
            tabPane, g, title, mnemIndex, textRect.x, textRect.y + metrics.getAscent());
        g.setColor(tabPane.getBackgroundAt(tabIndex).darker());
        JTattooUtilities.drawStringUnderlineCharAt(
            tabPane, g, title, mnemIndex, textRect.x - 1, textRect.y + metrics.getAscent() - 1);
      }
    }
  }