/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @author Scott Violet
*/
private static final boolean IS_22;
/**
* Whether or not text is drawn antialiased. This keys off the
* We should assume ON - or some variation of ON as no GTK desktop
* ships with it OFF.
*/
/**
* Solaris, or Linux with Sun JDS in a CJK Locale.
* Used to determine if Sun's high quality CJK fonts are present.
*/
private static boolean isSunCJK;
/*
* Used to override if system (desktop) text anti-aliasing settings should
* be used. The reasons for this are are is that currently its "off"
* for CJK locales which is not likely to be a good universal answer, and
* also its off for remote display. So this provides an unsupported
* way to explicitly request that it be "on".
*/
private static boolean gtkAAFontSettingsCond;
/**
* Font to use in places where there is no widget.
*/
/**
* If true, GTKLookAndFeel is inside the <code>initialize</code>
* method.
*/
private boolean inInitialize;
/**
* If true, PropertyChangeListeners have been installed for the
* Toolkit.
*/
private boolean pclInstalled;
/**
* StyleFactory needs to be created only the first time.
*/
/**
* Cached theme name. Used by GTKGraphicsUtils
*/
static {
// Backup for specifying the version, this isn't currently documented.
new GetPropertyAction("swing.gtk.version"));
}
else {
IS_22 = true;
}
boolean cjkLocale =
if (cjkLocale) {
boolean isSunDesktop = false;
case SOLARIS:
isSunDesktop = true;
break;
case LINUX:
new PrivilegedAction<Boolean>() {
}
});
}
isSunCJK = true;
}
}
}
/**
* Returns true if running on system containing at least 2.2.
*/
static boolean is2_2() {
// NOTE: We're currently hard coding to use 2.2.
// If we want to support both GTK 2.0 and 2.2, we'll
// Refer to bug 4912613 for details.
return IS_22;
}
/**
* Maps a swing constant to a GTK constant.
*/
switch (side) {
case SwingConstants.LEFT:
return PositionType.LEFT;
case SwingConstants.RIGHT:
return PositionType.RIGHT;
case SwingConstants.TOP:
return PositionType.TOP;
case SwingConstants.BOTTOM:
return PositionType.BOTTOM;
}
assert false : "Unknown orientation: " + side;
return PositionType.TOP;
}
/**
* Maps from Synth state to native GTK state using typesafe enumeration
* StateType. This is only used by GTKEngine.
*/
switch (state) {
case SynthConstants.PRESSED:
break;
case SynthConstants.MOUSE_OVER:
break;
case SynthConstants.SELECTED:
break;
case SynthConstants.DISABLED:
break;
case SynthConstants.ENABLED:
default:
break;
}
return result;
}
/**
* Maps from a Synth state to the corresponding GTK state.
* The GTK states are named differently than Synth's states, the
* following gives the mapping:
* <table><tr><td>Synth<td>GTK
* <tr><td>SynthConstants.PRESSED<td>ACTIVE
* <tr><td>SynthConstants.SELECTED<td>SELECTED
* <tr><td>SynthConstants.MOUSE_OVER<td>PRELIGHT
* <tr><td>SynthConstants.DISABLED<td>INSENSITIVE
* <tr><td>SynthConstants.ENABLED<td>NORMAL
* </table>
* Additionally some widgets are special cased.
*/
} else {
}
}
} else {
}
}
// If the button is SELECTED and is PRELIGHT we need to
// make the state MOUSE_OVER otherwise we don't paint the
// PRELIGHT.
} else {
}
} else {
}
}
}
}
else {
} else {
}
}
return state;
}
// These Regions treat FOREGROUND as TEXT.
}
// We need to call super for basic's properties file.
// SynthTabbedPaneUI supports rollover on tabs, GTK does not
// Prevents Synth from setting text AA by itself
// For compatability with apps expecting certain defaults we'll
// populate the table with the values from basic.
return table;
}
private void installPropertyChangeListeners() {
if(!pclInstalled) {
pclInstalled = true;
}
}
}
// For compatability with apps expecting certain defaults we'll
// populate the table with the values from basic.
super.initComponentDefaults(table);
"javax.swing.plaf.BorderUIResource$EmptyBorderUIResource",
"com.sun.java.swing.plaf.gtk.GTKPainter$ListTableFocusBorder",
"getUnselectedCellBorder");
"com.sun.java.swing.plaf.gtk.GTKPainter$ListTableFocusBorder",
"getSelectedCellBorder");
"com.sun.java.swing.plaf.gtk.GTKPainter$ListTableFocusBorder",
"getNoFocusCellBorder");
// The following progress bar size calculations come from
// gtkprogressbar.c (version 2.8.20), see MIN_* constants and
// the gtk_progress_bar_size_request() method.
"ctrl BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
"control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
});
"ctrl BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
"control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
});
"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",
"ctrl BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
"ctrl T", "next-link-action",
"ctrl shift T", "previous-link-action",
"ctrl SPACE", "activate-link-action",
"control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
});
}
}
}
"SPACE", "pressed",
"released SPACE", "released",
"ENTER", "pressed",
"released ENTER", "released"
}),
"Button.margin", zeroInsets,
"SPACE", "pressed",
"released SPACE", "released"
}),
"com.sun.java.swing.plaf.gtk.GTKIconFactory",
"getCheckBoxIcon"),
"CheckBox.margin", zeroInsets,
"CheckBoxMenuItem.arrowIcon", null,
"com.sun.java.swing.plaf.gtk.GTKIconFactory",
"getCheckBoxMenuItemCheckIcon"),
"CheckBoxMenuItem.font",
"CheckBoxMenuItem.margin", zeroInsets,
return new AbstractColorChooserPanel[] {
new GTKColorChooserPanel() };
}
},
"ComboBox.ancestorInputMap",
"ESCAPE", "hidePopup",
"PAGE_UP", "pageUpPassThrough",
"PAGE_DOWN", "pageDownPassThrough",
"HOME", "homePassThrough",
"END", "endPassThrough",
"DOWN", "selectNext",
"KP_DOWN", "selectNext",
"alt DOWN", "togglePopup",
"alt KP_DOWN", "togglePopup",
"alt UP", "togglePopup",
"alt KP_UP", "togglePopup",
"SPACE", "spacePopup",
"ENTER", "enterPressed",
"UP", "selectPrevious",
"KP_UP", "selectPrevious"
}),
"EditorPane.caretForeground", caretColor,
"EditorPane.caretAspectRatio", defaultCaretAspectRatio,
"EditorPane.caretBlinkRate", caretBlinkRate,
"EditorPane.margin", editorMargin,
"EditorPane.focusInputMap", multilineInputMap,
"FileChooser.ancestorInputMap",
"ESCAPE", "cancelSelection",
"ctrl ENTER", "approveSelection"
}),
"FileChooserUI", "com.sun.java.swing.plaf.gtk.GTKLookAndFeel",
"FormattedTextField.caretForeground", caretColor,
"FormattedTextField.caretAspectRatio", defaultCaretAspectRatio,
"FormattedTextField.caretBlinkRate", caretBlinkRate,
"FormattedTextField.focusInputMap",
"ctrl BACK_SLASH", "unselect",
"control shift O", "toggle-componentOrientation",
"ESCAPE", "reset-field-edit",
"UP", "increment",
"KP_UP", "increment",
"DOWN", "decrement",
"KP_DOWN", "decrement",
}),
"FormattedTextField.font",
"InternalFrameTitlePane.titlePaneLayout",
"getTitlePaneLayout"),
"InternalFrame.windowBindings", new Object[] {
"shift ESCAPE", "showSystemMenu",
"ctrl SPACE", "showSystemMenu",
"ESCAPE", "hideSystemMenu" },
"InternalFrameTitlePane.iconifyButtonOpacity", null,
"InternalFrameTitlePane.maximizeButtonOpacity", null,
"InternalFrameTitlePane.closeButtonOpacity", null,
"List.background", tableBg,
"List.focusCellHighlightBorder", focusBorder,
"List.focusSelectedCellHighlightBorder", focusSelectedBorder,
"List.noFocusBorder", noFocusBorder,
"List.focusInputMap",
"ctrl C", "copy",
"ctrl V", "paste",
"ctrl X", "cut",
"COPY", "copy",
"PASTE", "paste",
"CUT", "cut",
"control INSERT", "copy",
"shift INSERT", "paste",
"shift DELETE", "cut",
"UP", "selectPreviousRow",
"KP_UP", "selectPreviousRow",
"shift UP", "selectPreviousRowExtendSelection",
"shift KP_UP", "selectPreviousRowExtendSelection",
"ctrl shift UP", "selectPreviousRowExtendSelection",
"ctrl shift KP_UP", "selectPreviousRowExtendSelection",
"ctrl UP", "selectPreviousRowChangeLead",
"ctrl KP_UP", "selectPreviousRowChangeLead",
"DOWN", "selectNextRow",
"KP_DOWN", "selectNextRow",
"shift DOWN", "selectNextRowExtendSelection",
"shift KP_DOWN", "selectNextRowExtendSelection",
"ctrl shift DOWN", "selectNextRowExtendSelection",
"ctrl shift KP_DOWN", "selectNextRowExtendSelection",
"ctrl DOWN", "selectNextRowChangeLead",
"ctrl KP_DOWN", "selectNextRowChangeLead",
"LEFT", "selectPreviousColumn",
"KP_LEFT", "selectPreviousColumn",
"shift LEFT", "selectPreviousColumnExtendSelection",
"shift KP_LEFT", "selectPreviousColumnExtendSelection",
"ctrl shift LEFT", "selectPreviousColumnExtendSelection",
"ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection",
"ctrl LEFT", "selectPreviousColumnChangeLead",
"ctrl KP_LEFT", "selectPreviousColumnChangeLead",
"RIGHT", "selectNextColumn",
"KP_RIGHT", "selectNextColumn",
"shift RIGHT", "selectNextColumnExtendSelection",
"shift KP_RIGHT", "selectNextColumnExtendSelection",
"ctrl shift RIGHT", "selectNextColumnExtendSelection",
"ctrl shift KP_RIGHT", "selectNextColumnExtendSelection",
"ctrl RIGHT", "selectNextColumnChangeLead",
"ctrl KP_RIGHT", "selectNextColumnChangeLead",
"HOME", "selectFirstRow",
"shift HOME", "selectFirstRowExtendSelection",
"ctrl shift HOME", "selectFirstRowExtendSelection",
"ctrl HOME", "selectFirstRowChangeLead",
"END", "selectLastRow",
"shift END", "selectLastRowExtendSelection",
"ctrl shift END", "selectLastRowExtendSelection",
"ctrl END", "selectLastRowChangeLead",
"PAGE_UP", "scrollUp",
"shift PAGE_UP", "scrollUpExtendSelection",
"ctrl shift PAGE_UP", "scrollUpExtendSelection",
"ctrl PAGE_UP", "scrollUpChangeLead",
"PAGE_DOWN", "scrollDown",
"shift PAGE_DOWN", "scrollDownExtendSelection",
"ctrl shift PAGE_DOWN", "scrollDownExtendSelection",
"ctrl PAGE_DOWN", "scrollDownChangeLead",
"ctrl A", "selectAll",
"ctrl SLASH", "selectAll",
"ctrl BACK_SLASH", "clearSelection",
"SPACE", "addToSelection",
"ctrl SPACE", "toggleAndAnchor",
"shift SPACE", "extendTo",
"ctrl shift SPACE", "moveSelectionTo"
}),
"List.focusInputMap.RightToLeft",
"LEFT", "selectNextColumn",
"KP_LEFT", "selectNextColumn",
"shift LEFT", "selectNextColumnExtendSelection",
"shift KP_LEFT", "selectNextColumnExtendSelection",
"ctrl shift LEFT", "selectNextColumnExtendSelection",
"ctrl shift KP_LEFT", "selectNextColumnExtendSelection",
"ctrl LEFT", "selectNextColumnChangeLead",
"ctrl KP_LEFT", "selectNextColumnChangeLead",
"RIGHT", "selectPreviousColumn",
"KP_RIGHT", "selectPreviousColumn",
"shift RIGHT", "selectPreviousColumnExtendSelection",
"shift KP_RIGHT", "selectPreviousColumnExtendSelection",
"ctrl shift RIGHT", "selectPreviousColumnExtendSelection",
"ctrl shift KP_RIGHT", "selectPreviousColumnExtendSelection",
"ctrl RIGHT", "selectPreviousColumnChangeLead",
"ctrl KP_RIGHT", "selectPreviousColumnChangeLead",
}),
"com.sun.java.swing.plaf.gtk.GTKIconFactory",
"getMenuArrowIcon"),
"Menu.checkIcon", null,
"Menu.margin", zeroInsets,
"Menu.cancelMode", "hideMenuTree",
"MenuBar.windowBindings", new Object[] {
"F10", "takeFocus" },
"MenuItem.arrowIcon", null,
"MenuItem.checkIcon", null,
"MenuItem.margin", zeroInsets,
"OptionPane.windowBindings", new Object[] {
"ESCAPE", "close" },
"PasswordField.caretForeground", caretColor,
"PasswordField.caretAspectRatio", defaultCaretAspectRatio,
"PasswordField.caretBlinkRate", caretBlinkRate,
"PasswordField.margin", zeroInsets,
"PasswordField.focusInputMap", passwordInputMap,
"PopupMenu.selectedWindowInputMapBindings", new Object[] {
"ESCAPE", "cancel",
"DOWN", "selectNext",
"KP_DOWN", "selectNext",
"UP", "selectPrevious",
"KP_UP", "selectPrevious",
"LEFT", "selectParent",
"KP_LEFT", "selectParent",
"RIGHT", "selectChild",
"KP_RIGHT", "selectChild",
"ENTER", "return",
"SPACE", "return"
},
"PopupMenu.selectedWindowInputMapBindings.RightToLeft",
new Object[] {
"LEFT", "selectChild",
"KP_LEFT", "selectChild",
"RIGHT", "selectParent",
"KP_RIGHT", "selectParent",
},
"ProgressBar.horizontalSize",
"ProgressBar.verticalSize",
"RadioButton.focusInputMap",
"SPACE", "pressed",
"released SPACE", "released",
"RETURN", "pressed"
}),
"com.sun.java.swing.plaf.gtk.GTKIconFactory",
"getRadioButtonIcon"),
"RadioButton.margin", zeroInsets,
"RadioButtonMenuItem.arrowIcon", null,
"com.sun.java.swing.plaf.gtk.GTKIconFactory",
"getRadioButtonMenuItemCheckIcon"),
"RadioButtonMenuItem.margin", zeroInsets,
// These bindings are only enabled when there is a default
// button set on the rootpane.
"RootPane.defaultButtonWindowKeyBindings", new Object[] {
"ENTER", "press",
"released ENTER", "release",
"ctrl ENTER", "press",
"ctrl released ENTER", "release"
},
"ScrollBar.ancestorInputMap",
"RIGHT", "positiveUnitIncrement",
"KP_RIGHT", "positiveUnitIncrement",
"DOWN", "positiveUnitIncrement",
"KP_DOWN", "positiveUnitIncrement",
"PAGE_DOWN", "positiveBlockIncrement",
"LEFT", "negativeUnitIncrement",
"KP_LEFT", "negativeUnitIncrement",
"UP", "negativeUnitIncrement",
"KP_UP", "negativeUnitIncrement",
"PAGE_UP", "negativeBlockIncrement",
"HOME", "minScroll",
"END", "maxScroll"
}),
"ScrollBar.ancestorInputMap.RightToLeft",
"RIGHT", "negativeUnitIncrement",
"KP_RIGHT", "negativeUnitIncrement",
"LEFT", "positiveUnitIncrement",
"KP_LEFT", "positiveUnitIncrement",
}),
"ScrollPane.ancestorInputMap",
"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"
}),
"ScrollPane.ancestorInputMap.RightToLeft",
"ctrl PAGE_UP", "scrollRight",
"ctrl PAGE_DOWN", "scrollLeft",
}),
"Separator.insets", zeroInsets,
"Slider.focusInputMap",
"RIGHT", "positiveUnitIncrement",
"KP_RIGHT", "positiveUnitIncrement",
"DOWN", "negativeUnitIncrement",
"KP_DOWN", "negativeUnitIncrement",
"PAGE_DOWN", "negativeBlockIncrement",
"LEFT", "negativeUnitIncrement",
"KP_LEFT", "negativeUnitIncrement",
"UP", "positiveUnitIncrement",
"KP_UP", "positiveUnitIncrement",
"PAGE_UP", "positiveBlockIncrement",
"HOME", "minScroll",
"END", "maxScroll"
}),
"Slider.focusInputMap.RightToLeft",
"RIGHT", "negativeUnitIncrement",
"KP_RIGHT", "negativeUnitIncrement",
"LEFT", "positiveUnitIncrement",
"KP_LEFT", "positiveUnitIncrement",
}),
"Spinner.ancestorInputMap",
"UP", "increment",
"KP_UP", "increment",
"DOWN", "decrement",
"KP_DOWN", "decrement",
}),
"SplitPane.ancestorInputMap",
"UP", "negativeIncrement",
"DOWN", "positiveIncrement",
"LEFT", "negativeIncrement",
"RIGHT", "positiveIncrement",
"KP_UP", "negativeIncrement",
"KP_DOWN", "positiveIncrement",
"KP_LEFT", "negativeIncrement",
"KP_RIGHT", "positiveIncrement",
"HOME", "selectMin",
"END", "selectMax",
"F8", "startResize",
"F6", "toggleFocus",
"ctrl TAB", "focusOutForward",
"ctrl shift TAB", "focusOutBackward"
}),
"TabbedPane.focusInputMap",
"RIGHT", "navigateRight",
"KP_RIGHT", "navigateRight",
"LEFT", "navigateLeft",
"KP_LEFT", "navigateLeft",
"UP", "navigateUp",
"KP_UP", "navigateUp",
"DOWN", "navigateDown",
"KP_DOWN", "navigateDown",
"ctrl DOWN", "requestFocusForVisibleComponent",
"ctrl KP_DOWN", "requestFocusForVisibleComponent",
"SPACE", "selectTabWithFocus"
}),
"TabbedPane.ancestorInputMap",
"ctrl TAB", "navigateNext",
"ctrl shift TAB", "navigatePrevious",
"ctrl PAGE_DOWN", "navigatePageDown",
"ctrl PAGE_UP", "navigatePageUp",
"ctrl UP", "requestFocus",
"ctrl KP_UP", "requestFocus",
}),
"TabbedPane.labelShift", 3,
"TabbedPane.selectedLabelShift", 3,
"Table.scrollPaneBorder", zeroBorder,
"Table.background", tableBg,
"Table.focusCellBackground", tableFocusCellBg,
"Table.focusCellForeground", tableFocusCellFg,
"Table.focusCellHighlightBorder", focusBorder,
"Table.focusSelectedCellHighlightBorder", focusSelectedBorder,
"Table.ancestorInputMap",
"ctrl C", "copy",
"ctrl V", "paste",
"ctrl X", "cut",
"COPY", "copy",
"PASTE", "paste",
"CUT", "cut",
"control INSERT", "copy",
"shift INSERT", "paste",
"shift DELETE", "cut",
"RIGHT", "selectNextColumn",
"KP_RIGHT", "selectNextColumn",
"shift RIGHT", "selectNextColumnExtendSelection",
"shift KP_RIGHT", "selectNextColumnExtendSelection",
"ctrl shift RIGHT", "selectNextColumnExtendSelection",
"ctrl shift KP_RIGHT", "selectNextColumnExtendSelection",
"ctrl RIGHT", "selectNextColumnChangeLead",
"ctrl KP_RIGHT", "selectNextColumnChangeLead",
"LEFT", "selectPreviousColumn",
"KP_LEFT", "selectPreviousColumn",
"shift LEFT", "selectPreviousColumnExtendSelection",
"shift KP_LEFT", "selectPreviousColumnExtendSelection",
"ctrl shift LEFT", "selectPreviousColumnExtendSelection",
"ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection",
"ctrl LEFT", "selectPreviousColumnChangeLead",
"ctrl KP_LEFT", "selectPreviousColumnChangeLead",
"DOWN", "selectNextRow",
"KP_DOWN", "selectNextRow",
"shift DOWN", "selectNextRowExtendSelection",
"shift KP_DOWN", "selectNextRowExtendSelection",
"ctrl shift DOWN", "selectNextRowExtendSelection",
"ctrl shift KP_DOWN", "selectNextRowExtendSelection",
"ctrl DOWN", "selectNextRowChangeLead",
"ctrl KP_DOWN", "selectNextRowChangeLead",
"UP", "selectPreviousRow",
"KP_UP", "selectPreviousRow",
"shift UP", "selectPreviousRowExtendSelection",
"shift KP_UP", "selectPreviousRowExtendSelection",
"ctrl shift UP", "selectPreviousRowExtendSelection",
"ctrl shift KP_UP", "selectPreviousRowExtendSelection",
"ctrl UP", "selectPreviousRowChangeLead",
"ctrl KP_UP", "selectPreviousRowChangeLead",
"HOME", "selectFirstColumn",
"shift HOME", "selectFirstColumnExtendSelection",
"ctrl shift HOME", "selectFirstRowExtendSelection",
"ctrl HOME", "selectFirstRow",
"END", "selectLastColumn",
"shift END", "selectLastColumnExtendSelection",
"ctrl shift END", "selectLastRowExtendSelection",
"ctrl END", "selectLastRow",
"PAGE_UP", "scrollUpChangeSelection",
"shift PAGE_UP", "scrollUpExtendSelection",
"ctrl shift PAGE_UP", "scrollLeftExtendSelection",
"ctrl PAGE_UP", "scrollLeftChangeSelection",
"PAGE_DOWN", "scrollDownChangeSelection",
"shift PAGE_DOWN", "scrollDownExtendSelection",
"ctrl shift PAGE_DOWN", "scrollRightExtendSelection",
"ctrl PAGE_DOWN", "scrollRightChangeSelection",
"TAB", "selectNextColumnCell",
"shift TAB", "selectPreviousColumnCell",
"ENTER", "selectNextRowCell",
"shift ENTER", "selectPreviousRowCell",
"ctrl A", "selectAll",
"ctrl SLASH", "selectAll",
"ctrl BACK_SLASH", "clearSelection",
"ESCAPE", "cancel",
"F2", "startEditing",
"SPACE", "addToSelection",
"ctrl SPACE", "toggleAndAnchor",
"shift SPACE", "extendTo",
"ctrl shift SPACE", "moveSelectionTo",
"F8", "focusHeader"
}),
"Table.ancestorInputMap.RightToLeft",
"RIGHT", "selectPreviousColumn",
"KP_RIGHT", "selectPreviousColumn",
"shift RIGHT", "selectPreviousColumnExtendSelection",
"shift KP_RIGHT", "selectPreviousColumnExtendSelection",
"ctrl shift RIGHT", "selectPreviousColumnExtendSelection",
"ctrl shift KP_RIGHT", "selectPreviousColumnExtendSelection",
"shift RIGHT", "selectPreviousColumnChangeLead",
"shift KP_RIGHT", "selectPreviousColumnChangeLead",
"LEFT", "selectNextColumn",
"KP_LEFT", "selectNextColumn",
"shift LEFT", "selectNextColumnExtendSelection",
"shift KP_LEFT", "selectNextColumnExtendSelection",
"ctrl shift LEFT", "selectNextColumnExtendSelection",
"ctrl shift KP_LEFT", "selectNextColumnExtendSelection",
"ctrl LEFT", "selectNextColumnChangeLead",
"ctrl KP_LEFT", "selectNextColumnChangeLead",
"ctrl PAGE_UP", "scrollRightChangeSelection",
"ctrl PAGE_DOWN", "scrollLeftChangeSelection",
"ctrl shift PAGE_UP", "scrollRightExtendSelection",
"ctrl shift PAGE_DOWN", "scrollLeftExtendSelection",
}),
"com.sun.java.swing.plaf.gtk.GTKIconFactory",
"getAscendingSortIcon"),
"com.sun.java.swing.plaf.gtk.GTKIconFactory",
"getDescendingSortIcon"),
"TextArea.caretForeground", caretColor,
"TextArea.caretAspectRatio", defaultCaretAspectRatio,
"TextArea.caretBlinkRate", caretBlinkRate,
"TextArea.margin", zeroInsets,
"TextArea.focusInputMap", multilineInputMap,
"TextField.caretForeground", caretColor,
"TextField.caretAspectRatio", defaultCaretAspectRatio,
"TextField.caretBlinkRate", caretBlinkRate,
"TextField.margin", zeroInsets,
"TextField.focusInputMap", fieldInputMap,
"TextPane.caretForeground", caretColor,
"TextPane.caretAspectRatio", defaultCaretAspectRatio,
"TextPane.caretBlinkRate", caretBlinkRate,
"TextPane.margin", editorMargin,
"TextPane.focusInputMap", multilineInputMap,
"TitledBorder.titleColor", controlText,
return new GTKPainter.TitledBorder();
}
},
"ToggleButton.focusInputMap",
"SPACE", "pressed",
"released SPACE", "released"
}),
"ToggleButton.margin", zeroInsets,
return GTKIconFactory.getToolBarHandleIcon();
}
},
"ToolBar.ancestorInputMap",
"UP", "navigateUp",
"KP_UP", "navigateUp",
"DOWN", "navigateDown",
"KP_DOWN", "navigateDown",
"LEFT", "navigateLeft",
"KP_LEFT", "navigateLeft",
"RIGHT", "navigateRight",
"KP_RIGHT", "navigateRight"
}),
"Tree.background", tableBg,
"Tree.closedIcon", null,
"Tree.leafIcon", null,
"Tree.openIcon", null,
"com.sun.java.swing.plaf.gtk.GTKIconFactory",
"getTreeExpandedIcon"),
"com.sun.java.swing.plaf.gtk.GTKIconFactory",
"getTreeCollapsedIcon"),
"Tree.focusInputMap",
"ctrl C", "copy",
"ctrl V", "paste",
"ctrl X", "cut",
"COPY", "copy",
"PASTE", "paste",
"CUT", "cut",
"control INSERT", "copy",
"shift INSERT", "paste",
"shift DELETE", "cut",
"UP", "selectPrevious",
"KP_UP", "selectPrevious",
"shift UP", "selectPreviousExtendSelection",
"shift KP_UP", "selectPreviousExtendSelection",
"ctrl shift UP", "selectPreviousExtendSelection",
"ctrl shift KP_UP", "selectPreviousExtendSelection",
"ctrl UP", "selectPreviousChangeLead",
"ctrl KP_UP", "selectPreviousChangeLead",
"DOWN", "selectNext",
"KP_DOWN", "selectNext",
"shift DOWN", "selectNextExtendSelection",
"shift KP_DOWN", "selectNextExtendSelection",
"ctrl shift DOWN", "selectNextExtendSelection",
"ctrl shift KP_DOWN", "selectNextExtendSelection",
"ctrl DOWN", "selectNextChangeLead",
"ctrl KP_DOWN", "selectNextChangeLead",
"RIGHT", "selectChild",
"KP_RIGHT", "selectChild",
"LEFT", "selectParent",
"KP_LEFT", "selectParent",
"typed +", "expand",
"typed -", "collapse",
"BACK_SPACE", "moveSelectionToParent",
"PAGE_UP", "scrollUpChangeSelection",
"shift PAGE_UP", "scrollUpExtendSelection",
"ctrl shift PAGE_UP", "scrollUpExtendSelection",
"ctrl PAGE_UP", "scrollUpChangeLead",
"PAGE_DOWN", "scrollDownChangeSelection",
"shift PAGE_DOWN", "scrollDownExtendSelection",
"ctrl shift PAGE_DOWN", "scrollDownExtendSelection",
"ctrl PAGE_DOWN", "scrollDownChangeLead",
"HOME", "selectFirst",
"shift HOME", "selectFirstExtendSelection",
"ctrl shift HOME", "selectFirstExtendSelection",
"ctrl HOME", "selectFirstChangeLead",
"END", "selectLast",
"shift END", "selectLastExtendSelection",
"ctrl shift END", "selectLastExtendSelection",
"ctrl END", "selectLastChangeLead",
"F2", "startEditing",
"ctrl A", "selectAll",
"ctrl SLASH", "selectAll",
"ctrl BACK_SLASH", "clearSelection",
"ctrl LEFT", "scrollLeft",
"ctrl KP_LEFT", "scrollLeft",
"ctrl RIGHT", "scrollRight",
"ctrl KP_RIGHT", "scrollRight",
"SPACE", "addToSelection",
"ctrl SPACE", "toggleAndAnchor",
"shift SPACE", "extendTo",
"ctrl shift SPACE", "moveSelectionTo"
}),
"Tree.focusInputMap.RightToLeft",
"RIGHT", "selectParent",
"KP_RIGHT", "selectParent",
"LEFT", "selectChild",
"KP_LEFT", "selectChild",
}),
"Tree.ancestorInputMap",
"ESCAPE", "cancel"
}),
};
if (fallbackFont != null) {
}
}
if (caretColor == null) {
}
// colors specific only for GTK
// It is impossible to create a simple GtkWidget without specifying the
// type. So for GtkWidget we can use any appropriate concrete type of
// wigdet. LABEL in this case.
}
/**
* Creates the GTK look and feel class for the passed in Component.
*/
if (key == "FileChooserUI") {
return GTKFileChooserUI.createUI(c);
}
return SynthLookAndFeel.createUI(c);
}
/**
* Returns the cached gtkThemeName
*/
return gtkThemeName;
}
return c.getComponentOrientation().isLeftToRight();
}
public void initialize() {
/*
* We need to call loadGTK() to ensure that the native GTK
* libraries are loaded. It is very unlikely that this call will
* fail (since we've already verified native GTK support in
* isSupportedLookAndFeel()), but we can throw an error in the
* failure situation just in case.
*/
if (toolkit instanceof UNIXToolkit &&
{
throw new InternalError("Unable to load native GTK libraries");
}
super.initialize();
inInitialize = true;
loadStyles();
inInitialize = false;
/*
* Check if system AA font settings should be used.
* Sun's JDS (for Linux and Solaris) ships with high quality CJK
* fonts and specifies via fontconfig that these be rendered in
* B&W to take advantage of the embedded bitmaps.
* If is a Sun CJK locale or remote display, indicate by the condition
* variable that in this case the L&F recommends ignoring desktop
* settings. On other Unixes (eg Linux) this doesn't apply.
* REMIND 1: The isSunCJK test is really just a place holder
* until we can properly query fontconfig and use the properties
* set for specific fonts.
* REMIND 2: See comment on isLocalDisplay() definition regarding
* XRender.
*/
}
private static void flushUnreferenced() {
}
}
}
// The property was GC'ed, we're no longer interested in
// PropertyChanges, remove the listener.
dispose();
}
else {
// We are using invokeLater here because we are getting called
// on the AWT-Motif thread which can cause a deadlock.
public void run() {
/* We are listening for GTK desktop text AA settings:
* However we don't need to read these here as
* the UIDefaults reads them and this event causes
* those to be reinitialised.
*/
}
lnf.loadStyles();
}
}
});
}
}
void dispose() {
}
}
public boolean isSupportedLookAndFeel() {
return (toolkit instanceof SunToolkit &&
}
public boolean isNativeLookAndFeel() {
return true;
}
return "GTK look and feel";
}
return "GTK look and feel";
}
return "GTK";
}
// Subclassed to pass in false to the superclass, we don't want to try
// and load the system colors.
}
private void loadStyles() {
// If we are in initialize initializations will be
// called later, don't do it now.
if (!inInitialize) {
}
}
}
}
// Desktop property appears to have preference over rc font.
fontName = "sans 10";
}
}
if (styleFactory == null) {
styleFactory = new GTKStyleFactory();
}
return styleFactory;
}
return false;
}
return false;
}
return false;
}
return false;
}
int w;
int h;
try {
} catch (NumberFormatException nfe) {
return false;
}
if (w > 0 && h > 0) {
} else {
}
}
return true;
}
/**
* Returns whether or not the UIs should update their
* <code>SynthStyles</code> from the <code>SynthStyleFactory</code>
* when the ancestor of the Component changes.
*
* @return whether or not the UIs should update their
* <code>SynthStyles</code> from the <code>SynthStyleFactory</code>
* when the ancestor changed.
*/
public boolean shouldUpdateStyleOnAncestorChanged() {
return true;
}
/**
* {@inheritDoc}
*/
return GnomeLayoutStyle.INSTANCE;
}
/**
* Gnome layout style. From:
* http://developer.gnome.org/projects/gup/hig/2.0/design-window.html#window-layout-spacing
* You'll notice this doesn't do the radiobutton/checkbox border
* provide margins/insets for checkbox/radiobuttons.
*/
// Checks args
parent);
switch(type) {
case INDENT:
// Indent group members 12 pixels to denote hierarchy and
// association.
return 12;
}
// Fall through to related
// As a basic rule of thumb, leave space between user
// interface components in increments of 6 pixels, going up as
// the relationship between related elements becomes more
// distant. For example, between icon labels and associated
// graphics within an icon, 6 pixels are adequate. Between
// labels and associated components, leave 12 horizontal
// pixels. For vertical spacing between groups of components,
// 18 pixels is adequate.
//
// The first part of this is handled automatically by Icon (which
// won't give you 6 pixels).
case RELATED:
return 12;
}
return 6;
case UNRELATED:
return 12;
}
return 0;
}
// Checks args
// A general padding of 12 pixels is
// recommended between the contents of a dialog window and the
// window borders.
return 12;
}
}
}