package sun.awt.X11;
import java.awt.Color;
import java.awt.Font;
import java.awt.SystemColor;
import javax.swing.*;
import javax.swing.plaf.*;
import javax.swing.border.*;
import javax.swing.text.DefaultEditorKit;
import javax.swing.plaf.basic.BasicBorders;
import com.sun.java.swing.plaf.motif.*;
import sun.awt.X11.XComponentPeer;
@SuppressWarnings("serial")
class XAWTLookAndFeel extends MotifLookAndFeel {
protected void initSystemColorDefaults(UIDefaults table) {
String[] defaultSystemColors = {
"desktop", "#005C5C",
"activeCaption", "#000080",
"activeCaptionText", "#FFFFFF",
"activeCaptionBorder", "#B24D7A",
"inactiveCaption", "#AEB2C3",
"inactiveCaptionText", "#000000",
"inactiveCaptionBorder", "#AEB2C3",
"window", "#AEB2C3",
"windowBorder", "#AEB2C3",
"windowText", "#000000",
"menu", "#AEB2C3",
"menuText", "#000000",
"text", "#FFF7E9",
"textText", "#000000",
"textHighlight", "#000000",
"textHighlightText", "#FFF7E9",
"textInactiveText", "#808080",
"control", "#AEB2C3",
"controlText", "#000000",
"controlHighlight", "#DCDEE5",
"controlLtHighlight", "#DCDEE5",
"controlShadow", "#63656F",
"controlLightShadow", "#9397A5",
"controlDkShadow", "#000000",
"scrollbar", "#AEB2C3",
"info", "#FFF7E9",
"infoText", "#000000"
};
loadSystemColors(table, defaultSystemColors, true);
}
protected void initComponentDefaults(UIDefaults table) {
super.initComponentDefaults(table);
FontUIResource dialogPlain12 = new FontUIResource(Font.DIALOG,
Font.PLAIN, 12);
FontUIResource sansSerifPlain12 = new FontUIResource(Font.SANS_SERIF,
Font.PLAIN, 12);
FontUIResource monospacedPlain12 = new FontUIResource(Font.MONOSPACED,
Font.PLAIN, 12);
ColorUIResource red = new ColorUIResource(Color.red);
ColorUIResource black = new ColorUIResource(Color.black);
ColorUIResource white = new ColorUIResource(Color.white);
ColorUIResource lightGray = new ColorUIResource(Color.lightGray);
ColorUIResource controlDarker = new ColorUIResource(SystemColor.controlDkShadow);
Color back = table.getColor("control");
Color[] colors = XComponentPeer.getSystemColors();
Color scrollBarBackground = colors[XComponentPeer.BACKGROUND_COLOR];
Color trackColor = new Color(MotifColorUtilities.calculateSelectFromBackground(scrollBarBackground.getRed(), scrollBarBackground.getGreen(), scrollBarBackground.getBlue()));
Border loweredBevelBorder = new MotifBorders.BevelBorder(false,
table.getColor("controlShadow"),
table.getColor("controlLtHighlight"));
Border raisedBevelBorder = new MotifBorders.BevelBorder(true,
table.getColor("controlShadow"),
table.getColor("controlLtHighlight"));
Border marginBorder = new BasicBorders.MarginBorder();
Border focusBorder = new MotifBorders.FocusBorder(
table.getColor("control"),
table.getColor("activeCaptionBorder"));
Border focusBevelBorder = new BorderUIResource.CompoundBorderUIResource(
focusBorder,
loweredBevelBorder);
Border textFieldBorder = new BorderUIResource.CompoundBorderUIResource(
focusBevelBorder,
marginBorder);
Object fieldInputMap = new UIDefaults.LazyInputMap(new Object[] {
"COPY", DefaultEditorKit.copyAction,
"PASTE", DefaultEditorKit.pasteAction,
"CUT", DefaultEditorKit.cutAction,
"control C", DefaultEditorKit.copyAction,
"control V", DefaultEditorKit.pasteAction,
"control X", DefaultEditorKit.cutAction,
"control INSERT", DefaultEditorKit.copyAction,
"shift INSERT", DefaultEditorKit.pasteAction,
"shift DELETE", DefaultEditorKit.cutAction,
"control F", DefaultEditorKit.forwardAction,
"control B", DefaultEditorKit.backwardAction,
"control D", DefaultEditorKit.deleteNextCharAction,
"typed \010", DefaultEditorKit.deletePrevCharAction,
"DELETE", DefaultEditorKit.deleteNextCharAction,
"RIGHT", DefaultEditorKit.forwardAction,
"LEFT", DefaultEditorKit.backwardAction,
"KP_RIGHT", DefaultEditorKit.forwardAction,
"KP_LEFT", DefaultEditorKit.backwardAction,
"shift LEFT", DefaultEditorKit.selectionBackwardAction,
"shift RIGHT", DefaultEditorKit.selectionForwardAction,
"control LEFT", DefaultEditorKit.previousWordAction,
"control RIGHT", DefaultEditorKit.nextWordAction,
"control shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
"control shift RIGHT", DefaultEditorKit.selectionNextWordAction,
"control SLASH", DefaultEditorKit.selectAllAction,
"HOME", DefaultEditorKit.beginLineAction,
"END", DefaultEditorKit.endLineAction,
"shift HOME", DefaultEditorKit.selectionBeginLineAction,
"shift END", DefaultEditorKit.selectionEndLineAction,
"control BACK_SLASH", "unselect",
"ENTER", JTextField.notifyAction,
"control shift O", "toggle-componentOrientation"
});
Object passwordInputMap = new UIDefaults.LazyInputMap(new Object[] {
"COPY", DefaultEditorKit.copyAction,
"PASTE", DefaultEditorKit.pasteAction,
"CUT", DefaultEditorKit.cutAction,
"control C", DefaultEditorKit.copyAction,
"control V", DefaultEditorKit.pasteAction,
"control X", DefaultEditorKit.cutAction,
"control INSERT", DefaultEditorKit.copyAction,
"shift INSERT", DefaultEditorKit.pasteAction,
"shift DELETE", DefaultEditorKit.cutAction,
"control F", DefaultEditorKit.forwardAction,
"control B", DefaultEditorKit.backwardAction,
"control D", DefaultEditorKit.deleteNextCharAction,
"typed \010", DefaultEditorKit.deletePrevCharAction,
"DELETE", DefaultEditorKit.deleteNextCharAction,
"RIGHT", DefaultEditorKit.forwardAction,
"LEFT", DefaultEditorKit.backwardAction,
"KP_RIGHT", DefaultEditorKit.forwardAction,
"KP_LEFT", DefaultEditorKit.backwardAction,
"shift LEFT", DefaultEditorKit.selectionBackwardAction,
"shift RIGHT", DefaultEditorKit.selectionForwardAction,
"control LEFT", DefaultEditorKit.beginLineAction,
"control RIGHT", DefaultEditorKit.endLineAction,
"control shift LEFT", DefaultEditorKit.selectionBeginLineAction,
"control shift RIGHT", DefaultEditorKit.selectionEndLineAction,
"control SLASH", DefaultEditorKit.selectAllAction,
"HOME", DefaultEditorKit.beginLineAction,
"END", DefaultEditorKit.endLineAction,
"shift HOME", DefaultEditorKit.selectionBeginLineAction,
"shift END", DefaultEditorKit.selectionEndLineAction,
"control BACK_SLASH", "unselect",
"ENTER", JTextField.notifyAction,
"control shift O", "toggle-componentOrientation"
});
Object multilineInputMap = new UIDefaults.LazyInputMap(new Object[] {
"COPY", DefaultEditorKit.copyAction,
"PASTE", DefaultEditorKit.pasteAction,
"CUT", DefaultEditorKit.cutAction,
"control C", DefaultEditorKit.copyAction,
"control V", DefaultEditorKit.pasteAction,
"control X", DefaultEditorKit.cutAction,
"control INSERT", DefaultEditorKit.copyAction,
"shift INSERT", DefaultEditorKit.pasteAction,
"shift DELETE", DefaultEditorKit.cutAction,
"control F", DefaultEditorKit.forwardAction,
"control B", DefaultEditorKit.backwardAction,
"control D", DefaultEditorKit.deleteNextCharAction,
"typed \010", DefaultEditorKit.deletePrevCharAction,
"DELETE", DefaultEditorKit.deleteNextCharAction,
"RIGHT", DefaultEditorKit.forwardAction,
"LEFT", DefaultEditorKit.backwardAction,
"KP_RIGHT", DefaultEditorKit.forwardAction,
"KP_LEFT", DefaultEditorKit.backwardAction,
"shift LEFT", DefaultEditorKit.selectionBackwardAction,
"shift RIGHT", DefaultEditorKit.selectionForwardAction,
"control LEFT", DefaultEditorKit.previousWordAction,
"control RIGHT", DefaultEditorKit.nextWordAction,
"control shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
"control shift RIGHT", DefaultEditorKit.selectionNextWordAction,
"control SLASH", DefaultEditorKit.selectAllAction,
"HOME", DefaultEditorKit.beginLineAction,
"END", DefaultEditorKit.endLineAction,
"shift HOME", DefaultEditorKit.selectionBeginLineAction,
"shift END", DefaultEditorKit.selectionEndLineAction,
"control N", DefaultEditorKit.downAction,
"control P", DefaultEditorKit.upAction,
"UP", DefaultEditorKit.upAction,
"DOWN", DefaultEditorKit.downAction,
"KP_UP", DefaultEditorKit.upAction,
"KP_DOWN", DefaultEditorKit.downAction,
"PAGE_UP", DefaultEditorKit.pageUpAction,
"PAGE_DOWN", DefaultEditorKit.pageDownAction,
"shift PAGE_UP", "selection-page-up",
"shift PAGE_DOWN", "selection-page-down",
"ctrl shift PAGE_UP", "selection-page-left",
"ctrl shift PAGE_DOWN", "selection-page-right",
"shift UP", DefaultEditorKit.selectionUpAction,
"shift DOWN", DefaultEditorKit.selectionDownAction,
"shift KP_UP", DefaultEditorKit.selectionUpAction,
"shift KP_DOWN", DefaultEditorKit.selectionDownAction,
"ENTER", DefaultEditorKit.insertBreakAction,
"TAB", DefaultEditorKit.insertTabAction,
"control BACK_SLASH", "unselect",
"control HOME", DefaultEditorKit.beginAction,
"control END", DefaultEditorKit.endAction,
"control shift HOME", DefaultEditorKit.selectionBeginAction,
"control shift END", DefaultEditorKit.selectionEndAction,
"control T", "next-link-action",
"control shift T", "previous-link-action",
"control SPACE", "activate-link-action",
"control shift O", "toggle-componentOrientation"
});
Object sliderFocusInsets = new InsetsUIResource( 0, 0, 0, 0 );
Object[] defaults = {
"ScrollBar.background", scrollBarBackground,
"ScrollBar.foreground", table.get("control"),
"ScrollBar.track", trackColor,
"ScrollBar.trackHighlight", trackColor,
"ScrollBar.thumb", scrollBarBackground,
"ScrollBar.thumbHighlight", table.get("controlHighlight") ,
"ScrollBar.thumbDarkShadow", table.get("controlDkShadow"),
"ScrollBar.thumbShadow", table.get("controlShadow"),
"ScrollBar.border", loweredBevelBorder,
"ScrollBar.allowsAbsolutePositioning", Boolean.TRUE,
"ScrollBar.defaultWidth", Integer.valueOf(17),
"ScrollBar.focusInputMap",
new UIDefaults.LazyInputMap(new Object[] {
"RIGHT", "positiveUnitIncrement",
"KP_RIGHT", "positiveUnitIncrement",
"DOWN", "positiveUnitIncrement",
"KP_DOWN", "positiveUnitIncrement",
"PAGE_DOWN", "positiveBlockIncrement",
"ctrl PAGE_DOWN", "positiveBlockIncrement",
"LEFT", "negativeUnitIncrement",
"KP_LEFT", "negativeUnitIncrement",
"UP", "negativeUnitIncrement",
"KP_UP", "negativeUnitIncrement",
"PAGE_UP", "negativeBlockIncrement",
"ctrl PAGE_UP", "negativeBlockIncrement",
"HOME", "minScroll",
"END", "maxScroll"
}),
"ScrollPane.font", dialogPlain12,
"ScrollPane.background", scrollBarBackground,
"ScrollPane.foreground", table.get("controlText"),
"ScrollPane.border", null,
"ScrollPane.viewportBorder", loweredBevelBorder,
"ScrollPane.ancestorInputMap",
new UIDefaults.LazyInputMap(new Object[] {
"RIGHT", "unitScrollRight",
"KP_RIGHT", "unitScrollRight",
"DOWN", "unitScrollDown",
"KP_DOWN", "unitScrollDown",
"LEFT", "unitScrollLeft",
"KP_LEFT", "unitScrollLeft",
"UP", "unitScrollUp",
"KP_UP", "unitScrollUp",
"PAGE_UP", "scrollUp",
"PAGE_DOWN", "scrollDown",
"ctrl PAGE_UP", "scrollLeft",
"ctrl PAGE_DOWN", "scrollRight",
"ctrl HOME", "scrollHome",
"ctrl END", "scrollEnd"
}),
"FormattedTextField.focusInputMap",
new UIDefaults.LazyInputMap(new Object[] {
"ctrl C", DefaultEditorKit.copyAction,
"ctrl V", DefaultEditorKit.pasteAction,
"ctrl X", DefaultEditorKit.cutAction,
"COPY", DefaultEditorKit.copyAction,
"PASTE", DefaultEditorKit.pasteAction,
"CUT", DefaultEditorKit.cutAction,
"shift LEFT", DefaultEditorKit.selectionBackwardAction,
"shift KP_LEFT", DefaultEditorKit.selectionBackwardAction,
"shift RIGHT", DefaultEditorKit.selectionForwardAction,
"shift KP_RIGHT", DefaultEditorKit.selectionForwardAction,
"ctrl LEFT", DefaultEditorKit.previousWordAction,
"ctrl KP_LEFT", DefaultEditorKit.previousWordAction,
"ctrl RIGHT", DefaultEditorKit.nextWordAction,
"ctrl KP_RIGHT", DefaultEditorKit.nextWordAction,
"ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
"ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction,
"ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction,
"ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction,
"ctrl A", DefaultEditorKit.selectAllAction,
"HOME", DefaultEditorKit.beginLineAction,
"END", DefaultEditorKit.endLineAction,
"shift HOME", DefaultEditorKit.selectionBeginLineAction,
"shift END", DefaultEditorKit.selectionEndLineAction,
"typed \010", DefaultEditorKit.deletePrevCharAction,
"DELETE", DefaultEditorKit.deleteNextCharAction,
"RIGHT", DefaultEditorKit.forwardAction,
"LEFT", DefaultEditorKit.backwardAction,
"KP_RIGHT", DefaultEditorKit.forwardAction,
"KP_LEFT", DefaultEditorKit.backwardAction,
"ENTER", JTextField.notifyAction,
"ctrl BACK_SLASH", "unselect",
"control shift O", "toggle-componentOrientation",
"ESCAPE", "reset-field-edit",
"UP", "increment",
"KP_UP", "increment",
"DOWN", "decrement",
"KP_DOWN", "decrement",
}),
"TextField.caretForeground", black,
"TextField.caretBlinkRate", Integer.valueOf(500),
"TextField.inactiveForeground", table.get("textInactiveText"),
"TextField.selectionBackground", table.get("textHighlight"),
"TextField.selectionForeground", table.get("textHighlightText"),
"TextField.background", table.get("window"),
"TextField.foreground", table.get("textText"),
"TextField.font", sansSerifPlain12,
"TextField.border", textFieldBorder,
"TextField.focusInputMap", fieldInputMap,
"PasswordField.caretForeground", black,
"PasswordField.caretBlinkRate", Integer.valueOf(500),
"PasswordField.inactiveForeground", table.get("textInactiveText"),
"PasswordField.selectionBackground", table.get("textHighlight"),
"PasswordField.selectionForeground", table.get("textHighlightText"),
"PasswordField.background", table.get("window"),
"PasswordField.foreground", table.get("textText"),
"PasswordField.font", sansSerifPlain12,
"PasswordField.border", textFieldBorder,
"PasswordField.focusInputMap", passwordInputMap,
"TextArea.caretForeground", black,
"TextArea.caretBlinkRate", Integer.valueOf(500),
"TextArea.inactiveForeground", table.get("textInactiveText"),
"TextArea.selectionBackground", table.get("textHighlight"),
"TextArea.selectionForeground", table.get("textHighlightText"),
"TextArea.background", table.get("window"),
"TextArea.foreground", table.get("textText"),
"TextArea.font", monospacedPlain12,
"TextArea.border", marginBorder,
"TextArea.focusInputMap", multilineInputMap
};
table.putDefaults(defaults);
}
}