1 7 package com.sun.java.swing.plaf.gtk; 8 9 import com.sun.java.swing.SwingUtilities2; 10 import java.lang.ref.*; 11 import javax.swing.plaf.synth.*; 12 import java.awt.*; 13 import java.awt.event.*; 14 import java.beans.*; 15 import java.io.File ; 16 import java.lang.reflect.*; 17 import java.security.AccessController ; 18 import java.security.PrivilegedAction ; 19 import java.util.HashMap ; 20 import java.util.Locale ; 21 import javax.swing.*; 22 import javax.swing.colorchooser.*; 23 import javax.swing.plaf.*; 24 import javax.swing.text.DefaultEditorKit ; 25 import java.io.IOException ; 26 27 import sun.security.action.GetPropertyAction; 28 29 33 public class GTKLookAndFeel extends SynthLookAndFeel { 34 private static final boolean IS_22; 35 36 40 static Boolean aaText = Boolean.FALSE; 41 42 53 static boolean cjkLocale; 54 55 58 private Font fallbackFont; 59 60 64 private boolean inInitialize; 65 66 static { 67 String version = (String )java.security.AccessController.doPrivileged( 70 new GetPropertyAction("swing.gtk.version")); 71 if (version != null) { 72 IS_22 = version.equals("2.2"); 73 } 74 else { 75 IS_22 = true; 76 } 77 } 78 79 82 static boolean is2_2() { 83 return IS_22; 88 } 89 90 93 static int SwingOrientationConstantToGTK(int side) { 94 switch (side) { 95 case SwingConstants.LEFT: 96 return GTKConstants.LEFT; 97 case SwingConstants.RIGHT: 98 return GTKConstants.RIGHT; 99 case SwingConstants.TOP: 100 return GTKConstants.TOP; 101 case SwingConstants.BOTTOM: 102 return GTKConstants.BOTTOM; 103 } 104 assert false : "Unknowning orientation: " + side; 105 return side; 106 } 107 108 121 static int synthStateToGTKState(Region region, int state) { 122 int orgState = state; 123 124 if ((state & SynthConstants.PRESSED) != 0) { 125 if (region == Region.RADIO_BUTTON 126 || region == Region.CHECK_BOX 127 || region == Region.TOGGLE_BUTTON 128 || region == Region.MENU 129 || region == Region.MENU_ITEM 130 || region == Region.RADIO_BUTTON_MENU_ITEM 131 || region == Region.CHECK_BOX_MENU_ITEM 132 || region == Region.SPLIT_PANE) { 133 state = SynthConstants.MOUSE_OVER; 134 } else { 135 state = SynthConstants.PRESSED; 136 } 137 } 138 else if ((state & SynthConstants.SELECTED) != 0) { 139 if (region == Region.MENU) { 140 state = SynthConstants.MOUSE_OVER; 141 } else if (region == Region.RADIO_BUTTON || 142 region == Region.TOGGLE_BUTTON || 143 region == Region.RADIO_BUTTON_MENU_ITEM || 144 region == Region.CHECK_BOX_MENU_ITEM || 145 region == Region.CHECK_BOX || 146 region == Region.BUTTON) { 147 if ((state & SynthConstants.MOUSE_OVER) != 0) { 151 state = SynthConstants.MOUSE_OVER; 152 } else if ((state & SynthConstants.DISABLED) != 0){ 153 state = SynthConstants.DISABLED; 154 } else { 155 state = SynthConstants.PRESSED; 156 } 157 } else if (region == Region.TABBED_PANE_TAB) { 158 state = SynthConstants.ENABLED; 159 } else { 160 state = SynthConstants.SELECTED; 161 } 162 } 163 else if ((state & SynthConstants.MOUSE_OVER) != 0) { 164 state = SynthConstants.MOUSE_OVER; 165 } 166 else if ((state & SynthConstants.DISABLED) != 0) { 167 state = SynthConstants.DISABLED; 168 } 169 else { 170 if (region == Region.SLIDER_TRACK) { 171 state = SynthConstants.PRESSED; 172 } else if (region == Region.TABBED_PANE_TAB) { 173 state = SynthConstants.PRESSED; 174 } else { 175 state = SynthConstants.ENABLED; 176 } 177 } 178 return state; 179 } 180 181 static boolean isText(Region region) { 182 return (region == Region.TEXT_FIELD || 184 region == Region.FORMATTED_TEXT_FIELD || 185 region == Region.LIST || 186 region == Region.PASSWORD_FIELD || 187 region == Region.SPINNER || 188 region == Region.TABLE || 189 region == Region.TEXT_AREA || 190 region == Region.TEXT_FIELD || 191 region == Region.TEXT_PANE || 192 region == Region.TREE); 193 } 194 195 public UIDefaults getDefaults() { 196 UIDefaults table = super.getDefaults(); 198 199 initResourceBundle(table); 200 initSystemColorDefaults(table); 203 initComponentDefaults(table); 204 return table; 205 } 206 207 private void initResourceBundle(UIDefaults table) { 208 table.addResourceBundle("com.sun.java.swing.plaf.gtk.resources.gtk"); 209 } 210 211 protected void initComponentDefaults(UIDefaults table) { 212 super.initComponentDefaults(table); 215 216 Object focusBorder = new GTKStyle.GTKLazyValue( 217 "com.sun.java.swing.plaf.gtk.GTKPainter$ListTableFocusBorder", 218 "getUnselectedCellBorder"); 219 Object focusSelectedBorder = new GTKStyle.GTKLazyValue( 220 "com.sun.java.swing.plaf.gtk.GTKPainter$ListTableFocusBorder", 221 "getSelectedCellBorder"); 222 223 GTKStyleFactory factory = (GTKStyleFactory)getStyleFactory(); 224 GTKStyle tableStyle = (GTKStyle)factory.getStyle("GtkTreeView"); 225 Color tableFocusCellBg = tableStyle.getColorForState(null, Region.TABLE, 226 SynthConstants.ENABLED, GTKColorType.BACKGROUND); 227 Color tableFocusCellFg = tableStyle.getColorForState(null, Region.TABLE, 228 SynthConstants.ENABLED, GTKColorType.FOREGROUND); 229 230 Integer caretBlinkRate = new Integer (500); 231 Insets zeroInsets = new InsetsUIResource(0, 0, 0, 0); 232 233 Double defaultCaretAspectRatio = new Double (0.025); 234 Color caretColor = table.getColor("caretColor"); 235 236 Object fieldInputMap = new UIDefaults.LazyInputMap(new Object [] { 237 "ctrl C", DefaultEditorKit.copyAction, 238 "ctrl V", DefaultEditorKit.pasteAction, 239 "ctrl X", DefaultEditorKit.cutAction, 240 "COPY", DefaultEditorKit.copyAction, 241 "PASTE", DefaultEditorKit.pasteAction, 242 "CUT", DefaultEditorKit.cutAction, 243 "shift LEFT", DefaultEditorKit.selectionBackwardAction, 244 "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction, 245 "shift RIGHT", DefaultEditorKit.selectionForwardAction, 246 "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction, 247 "ctrl LEFT", DefaultEditorKit.previousWordAction, 248 "ctrl KP_LEFT", DefaultEditorKit.previousWordAction, 249 "ctrl RIGHT", DefaultEditorKit.nextWordAction, 250 "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction, 251 "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction, 252 "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction, 253 "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction, 254 "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction, 255 "ctrl A", DefaultEditorKit.selectAllAction, 256 "HOME", DefaultEditorKit.beginLineAction, 257 "END", DefaultEditorKit.endLineAction, 258 "shift HOME", DefaultEditorKit.selectionBeginLineAction, 259 "shift END", DefaultEditorKit.selectionEndLineAction, 260 "BACK_SPACE", DefaultEditorKit.deletePrevCharAction, 261 "ctrl H", DefaultEditorKit.deletePrevCharAction, 262 "DELETE", DefaultEditorKit.deleteNextCharAction, 263 "RIGHT", DefaultEditorKit.forwardAction, 264 "LEFT", DefaultEditorKit.backwardAction, 265 "KP_RIGHT", DefaultEditorKit.forwardAction, 266 "KP_LEFT", DefaultEditorKit.backwardAction, 267 "ENTER", JTextField.notifyAction, 268 "ctrl BACK_SLASH", "unselect", 269 "control shift O", "toggle-componentOrientation" 270 }); 271 272 Object passwordInputMap = new UIDefaults.LazyInputMap(new Object [] { 273 "ctrl C", DefaultEditorKit.copyAction, 274 "ctrl V", DefaultEditorKit.pasteAction, 275 "ctrl X", DefaultEditorKit.cutAction, 276 "COPY", DefaultEditorKit.copyAction, 277 "PASTE", DefaultEditorKit.pasteAction, 278 "CUT", DefaultEditorKit.cutAction, 279 "shift LEFT", DefaultEditorKit.selectionBackwardAction, 280 "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction, 281 "shift RIGHT", DefaultEditorKit.selectionForwardAction, 282 "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction, 283 "ctrl LEFT", DefaultEditorKit.beginLineAction, 284 "ctrl KP_LEFT", DefaultEditorKit.beginLineAction, 285 "ctrl RIGHT", DefaultEditorKit.endLineAction, 286 "ctrl KP_RIGHT", DefaultEditorKit.endLineAction, 287 "ctrl shift LEFT", DefaultEditorKit.selectionBeginLineAction, 288 "ctrl shift KP_LEFT", DefaultEditorKit.selectionBeginLineAction, 289 "ctrl shift RIGHT", DefaultEditorKit.selectionEndLineAction, 290 "ctrl shift KP_RIGHT", DefaultEditorKit.selectionEndLineAction, 291 "ctrl A", DefaultEditorKit.selectAllAction, 292 "HOME", DefaultEditorKit.beginLineAction, 293 "END", DefaultEditorKit.endLineAction, 294 "shift HOME", DefaultEditorKit.selectionBeginLineAction, 295 "shift END", DefaultEditorKit.selectionEndLineAction, 296 "BACK_SPACE", DefaultEditorKit.deletePrevCharAction, 297 "ctrl H", DefaultEditorKit.deletePrevCharAction, 298 "DELETE", DefaultEditorKit.deleteNextCharAction, 299 "RIGHT", DefaultEditorKit.forwardAction, 300 "LEFT", DefaultEditorKit.backwardAction, 301 "KP_RIGHT", DefaultEditorKit.forwardAction, 302 "KP_LEFT", DefaultEditorKit.backwardAction, 303 "ENTER", JTextField.notifyAction, 304 "ctrl BACK_SLASH", "unselect", 305 "control shift O", "toggle-componentOrientation" 306 }); 307 308 Object editorMargin = new InsetsUIResource(3,3,3,3); 309 310 Object multilineInputMap = new UIDefaults.LazyInputMap(new Object [] { 311 "ctrl C", DefaultEditorKit.copyAction, 312 "ctrl V", DefaultEditorKit.pasteAction, 313 "ctrl X", DefaultEditorKit.cutAction, 314 "COPY", DefaultEditorKit.copyAction, 315 "PASTE", DefaultEditorKit.pasteAction, 316 "CUT", DefaultEditorKit.cutAction, 317 "shift LEFT", DefaultEditorKit.selectionBackwardAction, 318 "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction, 319 "shift RIGHT", DefaultEditorKit.selectionForwardAction, 320 "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction, 321 "ctrl LEFT", DefaultEditorKit.previousWordAction, 322 "ctrl KP_LEFT", DefaultEditorKit.previousWordAction, 323 "ctrl RIGHT", DefaultEditorKit.nextWordAction, 324 "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction, 325 "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction, 326 "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction, 327 "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction, 328 "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction, 329 "ctrl A", DefaultEditorKit.selectAllAction, 330 "HOME", DefaultEditorKit.beginLineAction, 331 "END", DefaultEditorKit.endLineAction, 332 "shift HOME", DefaultEditorKit.selectionBeginLineAction, 333 "shift END", DefaultEditorKit.selectionEndLineAction, 334 335 "UP", DefaultEditorKit.upAction, 336 "KP_UP", DefaultEditorKit.upAction, 337 "DOWN", DefaultEditorKit.downAction, 338 "KP_DOWN", DefaultEditorKit.downAction, 339 "PAGE_UP", DefaultEditorKit.pageUpAction, 340 "PAGE_DOWN", DefaultEditorKit.pageDownAction, 341 "shift PAGE_UP", "selection-page-up", 342 "shift PAGE_DOWN", "selection-page-down", 343 "ctrl shift PAGE_UP", "selection-page-left", 344 "ctrl shift PAGE_DOWN", "selection-page-right", 345 "shift UP", DefaultEditorKit.selectionUpAction, 346 "shift KP_UP", DefaultEditorKit.selectionUpAction, 347 "shift DOWN", DefaultEditorKit.selectionDownAction, 348 "shift KP_DOWN", DefaultEditorKit.selectionDownAction, 349 "ENTER", DefaultEditorKit.insertBreakAction, 350 "BACK_SPACE", DefaultEditorKit.deletePrevCharAction, 351 "ctrl H", DefaultEditorKit.deletePrevCharAction, 352 "DELETE", DefaultEditorKit.deleteNextCharAction, 353 "RIGHT", DefaultEditorKit.forwardAction, 354 "LEFT", DefaultEditorKit.backwardAction, 355 "KP_RIGHT", DefaultEditorKit.forwardAction, 356 "KP_LEFT", DefaultEditorKit.backwardAction, 357 "TAB", DefaultEditorKit.insertTabAction, 358 "ctrl BACK_SLASH", "unselect", 359 "ctrl HOME", DefaultEditorKit.beginAction, 360 "ctrl END", DefaultEditorKit.endAction, 361 "ctrl shift HOME", DefaultEditorKit.selectionBeginAction, 362 "ctrl shift END", DefaultEditorKit.selectionEndAction, 363 "ctrl T", "next-link-action", 364 "ctrl shift T", "previous-link-action", 365 "ctrl SPACE", "activate-link-action", 366 "control shift O", "toggle-componentOrientation" 367 }); 368 369 class FontLazyValue implements UIDefaults.LazyValue { 370 private Region region; 371 FontLazyValue(Region region) { 372 this.region = region; 373 } 374 public Object createValue(UIDefaults table) { 375 GTKStyleFactory factory = (GTKStyleFactory)getStyleFactory(); 376 GTKStyle style = (GTKStyle)factory.getStyle( 377 GTKStyleFactory.gtkClassFor(region)); 378 return style.getFontForState( 379 null, region, SynthConstants.ENABLED); 380 } 381 } 382 383 Object [] defaults = new Object [] { 384 "ArrowButton.size", new Integer (13), 385 386 387 "Button.defaultButtonFollowsFocus", Boolean.FALSE, 388 "Button.focusInputMap", new UIDefaults.LazyInputMap(new Object [] { 389 "SPACE", "pressed", 390 "released SPACE", "released", 391 "ENTER", "pressed", 392 "released ENTER", "released" 393 }), 394 "Button.font", new FontLazyValue(Region.BUTTON), 395 396 397 "CheckBox.focusInputMap", new UIDefaults.LazyInputMap(new Object []{ 398 "SPACE", "pressed", 399 "released SPACE", "released", 400 }), 401 "CheckBox.icon", new GTKStyle.GTKLazyValue( 402 "com.sun.java.swing.plaf.gtk.GTKIconFactory", 403 "getCheckBoxIcon"), 404 "CheckBox.font", new FontLazyValue(Region.CHECK_BOX), 405 406 407 "CheckBoxMenuItem.arrowIcon", new GTKStyle.GTKLazyValue( 408 "com.sun.java.swing.plaf.gtk.GTKIconFactory", 409 "getCheckBoxMenuItemArrowIcon"), 410 "CheckBoxMenuItem.checkIcon", new GTKStyle.GTKLazyValue( 411 "com.sun.java.swing.plaf.gtk.GTKIconFactory", 412 "getCheckBoxMenuItemCheckIcon"), 413 "CheckBoxMenuItem.font", 414 new FontLazyValue(Region.CHECK_BOX_MENU_ITEM), 415 "CheckBoxMenuItem.margin", zeroInsets, 416 417 418 "ColorChooser.showPreviewPanelText", Boolean.FALSE, 419 "ColorChooser.panels", new UIDefaults.ActiveValue() { 420 public Object createValue(UIDefaults table) { 421 return new AbstractColorChooserPanel[] { 422 new GTKColorChooserPanel() }; 423 } 424 }, 425 "ColorChooser.font", new FontLazyValue(Region.COLOR_CHOOSER), 426 427 428 "ComboBox.ancestorInputMap", 429 new UIDefaults.LazyInputMap(new Object [] { 430 "ESCAPE", "hidePopup", 431 "PAGE_UP", "pageUpPassThrough", 432 "PAGE_DOWN", "pageDownPassThrough", 433 "HOME", "homePassThrough", 434 "END", "endPassThrough", 435 "DOWN", "selectNext", 436 "KP_DOWN", "selectNext", 437 "alt DOWN", "togglePopup", 438 "alt KP_DOWN", "togglePopup", 439 "alt UP", "togglePopup", 440 "alt KP_UP", "togglePopup", 441 "SPACE", "spacePopup", 442 "ENTER", "enterPressed", 443 "UP", "selectPrevious", 444 "KP_UP", "selectPrevious" 445 446 }), 447 "ComboBox.font", new FontLazyValue(Region.COMBO_BOX), 448 449 450 "EditorPane.caretForeground", caretColor, 451 "EditorPane.caretAspectRatio", defaultCaretAspectRatio, 452 "EditorPane.caretBlinkRate", caretBlinkRate, 453 "EditorPane.margin", editorMargin, 454 "EditorPane.focusInputMap", multilineInputMap, 455 "EditorPane.font", new FontLazyValue(Region.EDITOR_PANE), 456 457 458 "FileChooser.ancestorInputMap", 459 new UIDefaults.LazyInputMap(new Object [] { 460 "ESCAPE", "cancelSelection" 461 }), 462 "FileChooserUI", "com.sun.java.swing.plaf.gtk.GTKLookAndFeel", 463 464 465 "FormattedTextField.caretForeground", caretColor, 466 "FormattedTextField.caretAspectRatio", defaultCaretAspectRatio, 467 "FormattedTextField.caretBlinkRate", caretBlinkRate, 468 "FormattedTextField.focusInputMap", 469 new UIDefaults.LazyInputMap(new Object [] { 470 "ctrl C", DefaultEditorKit.copyAction, 471 "ctrl V", DefaultEditorKit.pasteAction, 472 "ctrl X", DefaultEditorKit.cutAction, 473 "COPY", DefaultEditorKit.copyAction, 474 "PASTE", DefaultEditorKit.pasteAction, 475 "CUT", DefaultEditorKit.cutAction, 476 "shift LEFT", DefaultEditorKit.selectionBackwardAction, 477 "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction, 478 "shift RIGHT", DefaultEditorKit.selectionForwardAction, 479 "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction, 480 "ctrl LEFT", DefaultEditorKit.previousWordAction, 481 "ctrl KP_LEFT", DefaultEditorKit.previousWordAction, 482 "ctrl RIGHT", DefaultEditorKit.nextWordAction, 483 "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction, 484 "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction, 485 "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction, 486 "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction, 487 "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction, 488 "ctrl A", DefaultEditorKit.selectAllAction, 489 "HOME", DefaultEditorKit.beginLineAction, 490 "END", DefaultEditorKit.endLineAction, 491 "shift HOME", DefaultEditorKit.selectionBeginLineAction, 492 "shift END", DefaultEditorKit.selectionEndLineAction, 493 "BACK_SPACE", DefaultEditorKit.deletePrevCharAction, 494 "ctrl H", DefaultEditorKit.deletePrevCharAction, 495 "DELETE", DefaultEditorKit.deleteNextCharAction, 496 "RIGHT", DefaultEditorKit.forwardAction, 497 "LEFT", DefaultEditorKit.backwardAction, 498 "KP_RIGHT", DefaultEditorKit.forwardAction, 499 "KP_LEFT", DefaultEditorKit.backwardAction, 500 "ENTER", JTextField.notifyAction, 501 "ctrl BACK_SLASH", "unselect", 502 "control shift O", "toggle-componentOrientation", 503 "ESCAPE", "reset-field-edit", 504 "UP", "increment", 505 "KP_UP", "increment", 506 "DOWN", "decrement", 507 "KP_DOWN", "decrement", 508 }), 509 "FormattedTextField.font", 510 new FontLazyValue(Region.FORMATTED_TEXT_FIELD), 511 512 513 "InternalFrameTitlePane.titlePaneLayout", 514 new GTKStyle.GTKLazyValue("com.sun.java.swing.plaf.gtk.Metacity", 515 "getTitlePaneLayout"), 516 "InternalFrame.windowBindings", new Object [] { 517 "shift ESCAPE", "showSystemMenu", 518 "ctrl SPACE", "showSystemMenu", 519 "ESCAPE", "hideSystemMenu" }, 520 "InternalFrame.layoutTitlePaneAtOrigin", Boolean.TRUE, 521 "InternalFrame.useTaskBar", Boolean.TRUE, 522 523 "Label.font", new FontLazyValue(Region.LABEL), 524 525 "List.focusCellHighlightBorder", focusBorder, 526 "List.focusSelectedCellHighlightBorder", focusSelectedBorder, 527 "List.focusInputMap", 528 new UIDefaults.LazyInputMap(new Object [] { 529 "ctrl C", "copy", 530 "ctrl V", "paste", 531 "ctrl X", "cut", 532 "COPY", "copy", 533 "PASTE", "paste", 534 "CUT", "cut", 535 "UP", "selectPreviousRow", 536 "KP_UP", "selectPreviousRow", 537 "shift UP", "selectPreviousRowExtendSelection", 538 "shift KP_UP", "selectPreviousRowExtendSelection", 539 "ctrl shift UP", "selectPreviousRowExtendSelection", 540 "ctrl shift KP_UP", "selectPreviousRowExtendSelection", 541 "ctrl UP", "selectPreviousRowChangeLead", 542 "ctrl KP_UP", "selectPreviousRowChangeLead", 543 "DOWN", "selectNextRow", 544 "KP_DOWN", "selectNextRow", 545 "shift DOWN", "selectNextRowExtendSelection", 546 "shift KP_DOWN", "selectNextRowExtendSelection", 547 "ctrl shift DOWN", "selectNextRowExtendSelection", 548 "ctrl shift KP_DOWN", "selectNextRowExtendSelection", 549 "ctrl DOWN", "selectNextRowChangeLead", 550 "ctrl KP_DOWN", "selectNextRowChangeLead", 551 "LEFT", "selectPreviousColumn", 552 "KP_LEFT", "selectPreviousColumn", 553 "shift LEFT", "selectPreviousColumnExtendSelection", 554 "shift KP_LEFT", "selectPreviousColumnExtendSelection", 555 "ctrl shift LEFT", "selectPreviousColumnExtendSelection", 556 "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection", 557 "ctrl LEFT", "selectPreviousColumnChangeLead", 558 "ctrl KP_LEFT", "selectPreviousColumnChangeLead", 559 "RIGHT", "selectNextColumn", 560 "KP_RIGHT", "selectNextColumn", 561 "shift RIGHT", "selectNextColumnExtendSelection", 562 "shift KP_RIGHT", "selectNextColumnExtendSelection", 563 "ctrl shift RIGHT", "selectNextColumnExtendSelection", 564 "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection", 565 "ctrl RIGHT", "selectNextColumnChangeLead", 566 "ctrl KP_RIGHT", "selectNextColumnChangeLead", 567 "HOME", "selectFirstRow", 568 "shift HOME", "selectFirstRowExtendSelection", 569 "ctrl shift HOME", "selectFirstRowExtendSelection", 570 "ctrl HOME", "selectFirstRowChangeLead", 571 "END", "selectLastRow", 572 "shift END", "selectLastRowExtendSelection", 573 "ctrl shift END", "selectLastRowExtendSelection", 574 "ctrl END", "selectLastRowChangeLead", 575 "PAGE_UP", "scrollUp", 576 "shift PAGE_UP", "scrollUpExtendSelection", 577 "ctrl shift PAGE_UP", "scrollUpExtendSelection", 578 "ctrl PAGE_UP", "scrollUpChangeLead", 579 "PAGE_DOWN", "scrollDown", 580 "shift PAGE_DOWN", "scrollDownExtendSelection", 581 "ctrl shift PAGE_DOWN", "scrollDownExtendSelection", 582 "ctrl PAGE_DOWN", "scrollDownChangeLead", 583 "ctrl A", "selectAll", 584 "ctrl SLASH", "selectAll", 585 "ctrl BACK_SLASH", "clearSelection", 586 "SPACE", "addToSelection", 587 "ctrl SPACE", "toggleAndAnchor", 588 "shift SPACE", "extendTo", 589 "ctrl shift SPACE", "moveSelectionTo" 590 }), 591 "List.focusInputMap.RightToLeft", 592 new UIDefaults.LazyInputMap(new Object [] { 593 "LEFT", "selectNextColumn", 594 "KP_LEFT", "selectNextColumn", 595 "shift LEFT", "selectNextColumnExtendSelection", 596 "shift KP_LEFT", "selectNextColumnExtendSelection", 597 "ctrl shift LEFT", "selectNextColumnExtendSelection", 598 "ctrl shift KP_LEFT", "selectNextColumnExtendSelection", 599 "ctrl LEFT", "selectNextColumnChangeLead", 600 "ctrl KP_LEFT", "selectNextColumnChangeLead", 601 "RIGHT", "selectPreviousColumn", 602 "KP_RIGHT", "selectPreviousColumn", 603 "shift RIGHT", "selectPreviousColumnExtendSelection", 604 "shift KP_RIGHT", "selectPreviousColumnExtendSelection", 605 "ctrl shift RIGHT", "selectPreviousColumnExtendSelection", 606 "ctrl shift KP_RIGHT", "selectPreviousColumnExtendSelection", 607 "ctrl RIGHT", "selectPreviousColumnChangeLead", 608 "ctrl KP_RIGHT", "selectPreviousColumnChangeLead", 609 }), 610 "List.font", new FontLazyValue(Region.LIST), 611 612 613 "Menu.shortcutKeys", new int[] {KeyEvent.ALT_MASK}, 614 "Menu.arrowIcon", new GTKStyle.GTKLazyValue( 615 "com.sun.java.swing.plaf.gtk.GTKIconFactory", 616 "getMenuArrowIcon"), 617 "Menu.font", new FontLazyValue(Region.MENU), 618 "Menu.margin", zeroInsets, 619 620 621 "MenuBar.windowBindings", new Object [] { 622 "F10", "takeFocus" }, 623 "MenuBar.font", new FontLazyValue(Region.MENU_BAR), 624 625 626 "MenuItem.arrowIcon", new GTKStyle.GTKLazyValue( 627 "com.sun.java.swing.plaf.gtk.GTKIconFactory", 628 "getMenuItemArrowIcon"), 629 "MenuItem.font", new FontLazyValue(Region.MENU_ITEM), 630 "MenuItem.margin", zeroInsets, 631 632 633 "OptionPane.setButtonMargin", Boolean.FALSE, 634 "OptionPane.sameSizeButtons", Boolean.TRUE, 635 "OptionPane.buttonOrientation", new Integer (SwingConstants.RIGHT), 636 "OptionPane.minimumSize", new DimensionUIResource(262, 90), 637 "OptionPane.buttonPadding", new Integer (10), 638 "OptionPane.windowBindings", new Object [] { 639 "ESCAPE", "close" }, 640 "OptionPane.buttonClickThreshhold", new Integer (500), 641 "OptionPane.isYesLast", Boolean.TRUE, 642 "OptionPane.font", new FontLazyValue(Region.OPTION_PANE), 643 644 "Panel.font", new FontLazyValue(Region.PANEL), 645 646 "PasswordField.caretForeground", caretColor, 647 "PasswordField.caretAspectRatio", defaultCaretAspectRatio, 648 "PasswordField.caretBlinkRate", caretBlinkRate, 649 "PasswordField.margin", zeroInsets, 650 "PasswordField.focusInputMap", passwordInputMap, 651 "PasswordField.font", new FontLazyValue(Region.PASSWORD_FIELD), 652 653 654 "PopupMenu.consumeEventOnClose", Boolean.TRUE, 655 "PopupMenu.selectedWindowInputMapBindings", new Object [] { 656 "ESCAPE", "cancel", 657 "DOWN", "selectNext", 658 "KP_DOWN", "selectNext", 659 "UP", "selectPrevious", 660 "KP_UP", "selectPrevious", 661 "LEFT", "selectParent", 662 "KP_LEFT", "selectParent", 663 "RIGHT", "selectChild", 664 "KP_RIGHT", "selectChild", 665 "ENTER", "return", 666 "SPACE", "return" 667 }, 668 "PopupMenu.selectedWindowInputMapBindings.RightToLeft", 669 new Object [] { 670 "LEFT", "selectChild", 671 "KP_LEFT", "selectChild", 672 "RIGHT", "selectParent", 673 "KP_RIGHT", "selectParent", 674 }, 675 "PopupMenu.font", new FontLazyValue(Region.POPUP_MENU), 676 677 "ProgressBar.horizontalSize", new DimensionUIResource(146, 16), 678 "ProgressBar.verticalSize", new DimensionUIResource(16, 146), 679 "ProgressBar.font", new FontLazyValue(Region.PROGRESS_BAR), 680 681 "RadioButton.focusInputMap", 682 new UIDefaults.LazyInputMap(new Object [] { 683 "SPACE", "pressed", 684 "released SPACE", "released", 685 "RETURN", "pressed" 686 }), 687 "RadioButton.icon", new GTKStyle.GTKLazyValue( 688 "com.sun.java.swing.plaf.gtk.GTKIconFactory", 689 "getRadioButtonIcon"), 690 "RadioButton.font", new FontLazyValue(Region.RADIO_BUTTON), 691 692 693 "RadioButtonMenuItem.arrowIcon", new GTKStyle.GTKLazyValue( 694 "com.sun.java.swing.plaf.gtk.GTKIconFactory", 695 "getRadioButtonMenuItemArrowIcon"), 696 "RadioButtonMenuItem.checkIcon", new GTKStyle.GTKLazyValue( 697 "com.sun.java.swing.plaf.gtk.GTKIconFactory", 698 "getRadioButtonMenuItemCheckIcon"), 699 "RadioButtonMenuItem.font", new FontLazyValue(Region.RADIO_BUTTON_MENU_ITEM), 700 "RadioButtonMenuItem.margin", zeroInsets, 701 702 "RootPane.defaultButtonWindowKeyBindings", new Object [] { 705 "ENTER", "press", 706 "released ENTER", "release", 707 "ctrl ENTER", "press", 708 "ctrl released ENTER", "release" 709 }, 710 711 712 "ScrollBar.squareButtons", Boolean.TRUE, 713 "ScrollBar.thumbHeight", new Integer (14), 714 "ScrollBar.width", new Integer (16), 715 "ScrollBar.minimumThumbSize", new Dimension(8, 8), 716 "ScrollBar.maximumThumbSize", new Dimension(4096, 4096), 717 "ScrollBar.allowsAbsolutePositioning", Boolean.TRUE, 718 "ScrollBar.ancestorInputMap", 719 new UIDefaults.LazyInputMap(new Object [] { 720 "RIGHT", "positiveUnitIncrement", 721 "KP_RIGHT", "positiveUnitIncrement", 722 "DOWN", "positiveUnitIncrement", 723 "KP_DOWN", "positiveUnitIncrement", 724 "PAGE_DOWN", "positiveBlockIncrement", 725 "LEFT", "negativeUnitIncrement", 726 "KP_LEFT", "negativeUnitIncrement", 727 "UP", "negativeUnitIncrement", 728 "KP_UP", "negativeUnitIncrement", 729 "PAGE_UP", "negativeBlockIncrement", 730 "HOME", "minScroll", 731 "END", "maxScroll" 732 }), 733 "ScrollBar.ancestorInputMap.RightToLeft", 734 new UIDefaults.LazyInputMap(new Object [] { 735 "RIGHT", "negativeUnitIncrement", 736 "KP_RIGHT", "negativeUnitIncrement", 737 "LEFT", "positiveUnitIncrement", 738 "KP_LEFT", "positiveUnitIncrement", 739 }), 740 741 742 "ScrollPane.ancestorInputMap", 743 new UIDefaults.LazyInputMap(new Object [] { 744 "RIGHT", "unitScrollRight", 745 "KP_RIGHT", "unitScrollRight", 746 "DOWN", "unitScrollDown", 747 "KP_DOWN", "unitScrollDown", 748 "LEFT", "unitScrollLeft", 749 "KP_LEFT", "unitScrollLeft", 750 "UP", "unitScrollUp", 751 "KP_UP", "unitScrollUp", 752 "PAGE_UP", "scrollUp", 753 "PAGE_DOWN", "scrollDown", 754 "ctrl PAGE_UP", "scrollLeft", 755 "ctrl PAGE_DOWN", "scrollRight", 756 "ctrl HOME", "scrollHome", 757 "ctrl END", "scrollEnd" 758 }), 759 "ScrollPane.ancestorInputMap.RightToLeft", 760 new UIDefaults.LazyInputMap(new Object [] { 761 "ctrl PAGE_UP", "scrollRight", 762 "ctrl PAGE_DOWN", "scrollLeft", 763 }), 764 "ScrollPane.font", new FontLazyValue(Region.SCROLL_PANE), 765 766 767 "Separator.insets", zeroInsets, 768 "Separator.thickness", new Integer (2), 769 770 771 "Slider.paintValue", Boolean.TRUE, 772 "Slider.thumbWidth", new Integer (30), 773 "Slider.thumbHeight", new Integer (14), 774 "Slider.focusInputMap", 775 new UIDefaults.LazyInputMap(new Object [] { 776 "RIGHT", "positiveUnitIncrement", 777 "KP_RIGHT", "positiveUnitIncrement", 778 "DOWN", "negativeUnitIncrement", 779 "KP_DOWN", "negativeUnitIncrement", 780 "PAGE_DOWN", "negativeBlockIncrement", 781 "LEFT", "negativeUnitIncrement", 782 "KP_LEFT", "negativeUnitIncrement", 783 "UP", "positiveUnitIncrement", 784 "KP_UP", "positiveUnitIncrement", 785 "PAGE_UP", "positiveBlockIncrement", 786 "HOME", "minScroll", 787 "END", "maxScroll" 788 }), 789 "Slider.focusInputMap.RightToLeft", 790 new UIDefaults.LazyInputMap(new Object [] { 791 "RIGHT", "negativeUnitIncrement", 792 "KP_RIGHT", "negativeUnitIncrement", 793 "LEFT", "positiveUnitIncrement", 794 "KP_LEFT", "positiveUnitIncrement", 795 }), 796 797 798 "Spinner.ancestorInputMap", 799 new UIDefaults.LazyInputMap(new Object [] { 800 "UP", "increment", 801 "KP_UP", "increment", 802 "DOWN", "decrement", 803 "KP_DOWN", "decrement", 804 }), 805 "Spinner.font", new FontLazyValue(Region.SPINNER), 806 807 808 "SplitPane.ancestorInputMap", 809 new UIDefaults.LazyInputMap(new Object [] { 810 "UP", "negativeIncrement", 811 "DOWN", "positiveIncrement", 812 "LEFT", "negativeIncrement", 813 "RIGHT", "positiveIncrement", 814 "KP_UP", "negativeIncrement", 815 "KP_DOWN", "positiveIncrement", 816 "KP_LEFT", "negativeIncrement", 817 "KP_RIGHT", "positiveIncrement", 818 "HOME", "selectMin", 819 "END", "selectMax", 820 "F8", "startResize", 821 "F6", "toggleFocus", 822 "ctrl TAB", "focusOutForward", 823 "ctrl shift TAB", "focusOutBackward" 824 }), 825 826 827 "SplitPane.size", new Integer (7), 828 "SplitPane.oneTouchOffset", new Integer (2), 829 "SplitPane.oneTouchButtonSize", new Integer (5), 830 "SplitPane.supportsOneTouchButtons", Boolean.FALSE, 831 832 833 "TabbedPane.focusInputMap", 834 new UIDefaults.LazyInputMap(new Object [] { 835 "RIGHT", "navigateRight", 836 "KP_RIGHT", "navigateRight", 837 "LEFT", "navigateLeft", 838 "KP_LEFT", "navigateLeft", 839 "UP", "navigateUp", 840 "KP_UP", "navigateUp", 841 "DOWN", "navigateDown", 842 "KP_DOWN", "navigateDown", 843 "ctrl DOWN", "requestFocusForVisibleComponent", 844 "ctrl KP_DOWN", "requestFocusForVisibleComponent", 845 "SPACE", "selectTabWithFocus" 846 }), 847 "TabbedPane.ancestorInputMap", 848 new UIDefaults.LazyInputMap(new Object [] { 849 "ctrl TAB", "navigateNext", 850 "ctrl shift TAB", "navigatePrevious", 851 "ctrl PAGE_DOWN", "navigatePageDown", 852 "ctrl PAGE_UP", "navigatePageUp", 853 "ctrl UP", "requestFocus", 854 "ctrl KP_UP", "requestFocus", 855 }), 856 857 "TabbedPane.selectionFollowsFocus", Boolean.FALSE, 858 "TabbedPane.font", new FontLazyValue(Region.TABBED_PANE), 859 860 "Table.focusCellBackground", tableFocusCellBg, 861 "Table.focusCellForeground", tableFocusCellFg, 862 "Table.focusCellHighlightBorder", focusBorder, 863 "Table.focusSelectedCellHighlightBorder", focusSelectedBorder, 864 "Table.ancestorInputMap", 865 new UIDefaults.LazyInputMap(new Object [] { 866 "ctrl C", "copy", 867 "ctrl V", "paste", 868 "ctrl X", "cut", 869 "COPY", "copy", 870 "PASTE", "paste", 871 "CUT", "cut", 872 "RIGHT", "selectNextColumn", 873 "KP_RIGHT", "selectNextColumn", 874 "shift RIGHT", "selectNextColumnExtendSelection", 875 "shift KP_RIGHT", "selectNextColumnExtendSelection", 876 "ctrl shift RIGHT", "selectNextColumnExtendSelection", 877 "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection", 878 "ctrl RIGHT", "selectNextColumnChangeLead", 879 "ctrl KP_RIGHT", "selectNextColumnChangeLead", 880 "LEFT", "selectPreviousColumn", 881 "KP_LEFT", "selectPreviousColumn", 882 "shift LEFT", "selectPreviousColumnExtendSelection", 883 "shift KP_LEFT", "selectPreviousColumnExtendSelection", 884 "ctrl shift LEFT", "selectPreviousColumnExtendSelection", 885 "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection", 886 "ctrl LEFT", "selectPreviousColumnChangeLead", 887 "ctrl KP_LEFT", "selectPreviousColumnChangeLead", 888 "DOWN", "selectNextRow", 889 "KP_DOWN", "selectNextRow", 890 "shift DOWN", "selectNextRowExtendSelection", 891 "shift KP_DOWN", "selectNextRowExtendSelection", 892 "ctrl shift DOWN", "selectNextRowExtendSelection", 893 "ctrl shift KP_DOWN", "selectNextRowExtendSelection", 894 "ctrl DOWN", "selectNextRowChangeLead", 895 "ctrl KP_DOWN", "selectNextRowChangeLead", 896 "UP", "selectPreviousRow", 897 "KP_UP", "selectPreviousRow", 898 "shift UP", "selectPreviousRowExtendSelection", 899 "shift KP_UP", "selectPreviousRowExtendSelection", 900 "ctrl shift UP", "selectPreviousRowExtendSelection", 901 "ctrl shift KP_UP", "selectPreviousRowExtendSelection", 902 "ctrl UP", "selectPreviousRowChangeLead", 903 "ctrl KP_UP", "selectPreviousRowChangeLead", 904 "HOME", "selectFirstColumn", 905 "shift HOME", "selectFirstColumnExtendSelection", 906 "ctrl shift HOME", "selectFirstRowExtendSelection", 907 "ctrl HOME", "selectFirstRow", 908 "END", "selectLastColumn", 909 "shift END", "selectLastColumnExtendSelection", 910 "ctrl shift END", "selectLastRowExtendSelection", 911 "ctrl END", "selectLastRow", 912 "PAGE_UP", "scrollUpChangeSelection", 913 "shift PAGE_UP", "scrollUpExtendSelection", 914 "ctrl shift PAGE_UP", "scrollLeftExtendSelection", 915 "ctrl PAGE_UP", "scrollLeftChangeSelection", 916 "PAGE_DOWN", "scrollDownChangeSelection", 917 "shift PAGE_DOWN", "scrollDownExtendSelection", 918 "ctrl shift PAGE_DOWN", "scrollRightExtendSelection", 919 "ctrl PAGE_DOWN", "scrollRightChangeSelection", 920 "TAB", "selectNextColumnCell", 921 "shift TAB", "selectPreviousColumnCell", 922 "ENTER", "selectNextRowCell", 923 "shift ENTER", "selectPreviousRowCell", 924 "ctrl A", "selectAll", 925 "ctrl SLASH", "selectAll", 926 "ctrl BACK_SLASH", "clearSelection", 927 "ESCAPE", "cancel", 928 "F2", "startEditing", 929 "SPACE", "addToSelection", 930 "ctrl SPACE", "toggleAndAnchor", 931 "shift SPACE", "extendTo", 932 "ctrl shift SPACE", "moveSelectionTo" 933 }), 934 "Table.ancestorInputMap.RightToLeft", 935 new UIDefaults.LazyInputMap(new Object [] { 936 "RIGHT", "selectPreviousColumn", 937 "KP_RIGHT", "selectPreviousColumn", 938 "shift RIGHT", "selectPreviousColumnExtendSelection", 939 "shift KP_RIGHT", "selectPreviousColumnExtendSelection", 940 "ctrl shift RIGHT", "selectPreviousColumnExtendSelection", 941 "ctrl shift KP_RIGHT", "selectPreviousColumnExtendSelection", 942 "shift RIGHT", "selectPreviousColumnChangeLead", 943 "shift KP_RIGHT", "selectPreviousColumnChangeLead", 944 "LEFT", "selectNextColumn", 945 "KP_LEFT", "selectNextColumn", 946 "shift LEFT", "selectNextColumnExtendSelection", 947 "shift KP_LEFT", "selectNextColumnExtendSelection", 948 "ctrl shift LEFT", "selectNextColumnExtendSelection", 949 "ctrl shift KP_LEFT", "selectNextColumnExtendSelection", 950 "ctrl LEFT", "selectNextColumnChangeLead", 951 "ctrl KP_LEFT", "selectNextColumnChangeLead", 952 "ctrl PAGE_UP", "scrollRightChangeSelection", 953 "ctrl PAGE_DOWN", "scrollLeftChangeSelection", 954 "ctrl shift PAGE_UP", "scrollRightExtendSelection", 955 "ctrl shift PAGE_DOWN", "scrollLeftExtendSelection", 956 }), 957 "Table.font", new FontLazyValue(Region.TABLE), 958 959 "TableHeader.font", new FontLazyValue(Region.TABLE_HEADER), 960 961 "TextArea.caretForeground", caretColor, 962 "TextArea.caretAspectRatio", defaultCaretAspectRatio, 963 "TextArea.caretBlinkRate", caretBlinkRate, 964 "TextArea.margin", zeroInsets, 965 "TextArea.focusInputMap", multilineInputMap, 966 "TextArea.font", new FontLazyValue(Region.TEXT_AREA), 967 968 969 "TextField.caretForeground", caretColor, 970 "TextField.caretAspectRatio", defaultCaretAspectRatio, 971 "TextField.caretBlinkRate", caretBlinkRate, 972 "TextField.margin", zeroInsets, 973 "TextField.focusInputMap", fieldInputMap, 974 "TextField.font", new FontLazyValue(Region.TEXT_FIELD), 975 976 977 "TextPane.caretForeground", caretColor, 978 "TextPane.caretAspectRatio", defaultCaretAspectRatio, 979 "TextPane.caretBlinkRate", caretBlinkRate, 980 "TextPane.margin", editorMargin, 981 "TextPane.focusInputMap", multilineInputMap, 982 "TextPane.font", new FontLazyValue(Region.TEXT_PANE), 983 984 985 "TitledBorder.titleColor", new ColorUIResource(Color.BLACK), 986 "TitledBorder.border", new UIDefaults.ProxyLazyValue( 987 "javax.swing.plaf.BorderUIResource", 988 "getEtchedBorderUIResource"), 989 990 "ToggleButton.focusInputMap", 991 new UIDefaults.LazyInputMap(new Object [] { 992 "SPACE", "pressed", 993 "released SPACE", "released" 994 }), 995 "ToggleButton.font", new FontLazyValue(Region.TOGGLE_BUTTON), 996 997 998 "ToolBar.separatorSize", new DimensionUIResource(10, 10), 999 "ToolBar.handleIcon", new UIDefaults.ActiveValue() { 1000 public Object createValue(UIDefaults table) { 1001 return GTKIconFactory.getToolBarHandleIcon(); 1002 } 1003 }, 1004 "ToolBar.ancestorInputMap", 1005 new UIDefaults.LazyInputMap(new Object [] { 1006 "UP", "navigateUp", 1007 "KP_UP", "navigateUp", 1008 "DOWN", "navigateDown", 1009 "KP_DOWN", "navigateDown", 1010 "LEFT", "navigateLeft", 1011 "KP_LEFT", "navigateLeft", 1012 "RIGHT", "navigateRight", 1013 "KP_RIGHT", "navigateRight" 1014 }), 1015 "ToolBar.font", new FontLazyValue(Region.TOOL_BAR), 1016 1017 "ToolTip.font", new FontLazyValue(Region.TOOL_TIP), 1018 1019 "Tree.padding", new Integer (4), 1020 "Tree.drawHorizontalLines", Boolean.FALSE, 1021 "Tree.drawVerticalLines", Boolean.FALSE, 1022 "Tree.rowHeight", new Integer (-1), 1023 "Tree.scrollsOnExpand", Boolean.FALSE, 1024 "Tree.expanderSize", new Integer (10), 1025 "Tree.closedIcon", null, 1026 "Tree.leafIcon", null, 1027 "Tree.openIcon", null, 1028 "Tree.expandedIcon", new GTKStyle.GTKLazyValue( 1029 "com.sun.java.swing.plaf.gtk.GTKIconFactory", 1030 "getTreeExpandedIcon"), 1031 "Tree.collapsedIcon", new GTKStyle.GTKLazyValue( 1032 "com.sun.java.swing.plaf.gtk.GTKIconFactory", 1033 "getTreeCollapsedIcon"), 1034 "Tree.leftChildIndent", new Integer (2), 1035 "Tree.rightChildIndent", new Integer (12), 1036 "Tree.scrollsHorizontallyAndVertically", Boolean.FALSE, 1037 "Tree.drawsFocusBorder", Boolean.TRUE, 1038 "Tree.focusInputMap", 1039 new UIDefaults.LazyInputMap(new Object [] { 1040 "ctrl C", "copy", 1041 "ctrl V", "paste", 1042 "ctrl X", "cut", 1043 "COPY", "copy", 1044 "PASTE", "paste", 1045 "CUT", "cut", 1046 "UP", "selectPrevious", 1047 "KP_UP", "selectPrevious", 1048 "shift UP", "selectPreviousExtendSelection", 1049 "shift KP_UP", "selectPreviousExtendSelection", 1050 "ctrl shift UP", "selectPreviousExtendSelection", 1051 "ctrl shift KP_UP", "selectPreviousExtendSelection", 1052 "ctrl UP", "selectPreviousChangeLead", 1053 "ctrl KP_UP", "selectPreviousChangeLead", 1054 "DOWN", "selectNext", 1055 "KP_DOWN", "selectNext", 1056 "shift DOWN", "selectNextExtendSelection", 1057 "shift KP_DOWN", "selectNextExtendSelection", 1058 "ctrl shift DOWN", "selectNextExtendSelection", 1059 "ctrl shift KP_DOWN", "selectNextExtendSelection", 1060 "ctrl DOWN", "selectNextChangeLead", 1061 "ctrl KP_DOWN", "selectNextChangeLead", 1062 "RIGHT", "selectChild", 1063 "KP_RIGHT", "selectChild", 1064 "LEFT", "selectParent", 1065 "KP_LEFT", "selectParent", 1066 "typed +", "expand", 1067 "typed -", "collapse", 1068 "BACK_SPACE", "moveSelectionToParent", 1069 "PAGE_UP", "scrollUpChangeSelection", 1070 "shift PAGE_UP", "scrollUpExtendSelection", 1071 "ctrl shift PAGE_UP", "scrollUpExtendSelection", 1072 "ctrl PAGE_UP", "scrollUpChangeLead", 1073 "PAGE_DOWN", "scrollDownChangeSelection", 1074 "shift PAGE_DOWN", "scrollDownExtendSelection", 1075 "ctrl shift PAGE_DOWN", "scrollDownExtendSelection", 1076 "ctrl PAGE_DOWN", "scrollDownChangeLead", 1077 "HOME", "selectFirst", 1078 "shift HOME", "selectFirstExtendSelection", 1079 "ctrl shift HOME", "selectFirstExtendSelection", 1080 "ctrl HOME", "selectFirstChangeLead", 1081 "END", "selectLast", 1082 "shift END", "selectLastExtendSelection", 1083 "ctrl shift END", "selectLastExtendSelection", 1084 "ctrl END", "selectLastChangeLead", 1085 "F2", "startEditing", 1086 "ctrl A", "selectAll", 1087 "ctrl SLASH", "selectAll", 1088 "ctrl BACK_SLASH", "clearSelection", 1089 "ctrl LEFT", "scrollLeft", 1090 "ctrl KP_LEFT", "scrollLeft", 1091 "ctrl RIGHT", "scrollRight", 1092 "ctrl KP_RIGHT", "scrollRight", 1093 "SPACE", "addToSelection", 1094 "ctrl SPACE", "toggleAndAnchor", 1095 "shift SPACE", "extendTo", 1096 "ctrl shift SPACE", "moveSelectionTo" 1097 }), 1098 "Tree.focusInputMap.RightToLeft", 1099 new UIDefaults.LazyInputMap(new Object [] { 1100 "RIGHT", "selectParent", 1101 "KP_RIGHT", "selectParent", 1102 "LEFT", "selectChild", 1103 "KP_LEFT", "selectChild", 1104 }), 1105 "Tree.ancestorInputMap", 1106 new UIDefaults.LazyInputMap(new Object [] { 1107 "ESCAPE", "cancel" 1108 }), 1109 "Tree.font", new FontLazyValue(Region.TREE), 1110 1111 "Viewport.font", new FontLazyValue(Region.VIEWPORT) 1112 }; 1113 table.putDefaults(defaults); 1114 1115 if (fallbackFont != null) { 1116 table.put("TitledBorder.font", fallbackFont); 1117 } 1118 } 1119 1120 protected void initSystemColorDefaults(UIDefaults table) { 1121 GTKStyleFactory factory = (GTKStyleFactory)getStyleFactory(); 1122 GTKStyle windowStyle = (GTKStyle)factory.getStyle("GtkWindow"); 1123 table.put("window", windowStyle.getGTKColor(SynthConstants.ENABLED, 1124 GTKColorType.BACKGROUND)); 1125 table.put("windowText", windowStyle.getGTKColor( 1126 SynthConstants.ENABLED, GTKColorType.TEXT_FOREGROUND)); 1127 1128 GTKStyle entryStyle = (GTKStyle)factory.getStyle("GtkEntry"); 1129 table.put("text", entryStyle.getGTKColor(SynthConstants.ENABLED, 1130 GTKColorType.TEXT_BACKGROUND)); 1131 table.put("textText", entryStyle.getGTKColor(SynthConstants.ENABLED, 1132 GTKColorType.TEXT_FOREGROUND)); 1133 table.put("textHighlight", 1134 entryStyle.getGTKColor(SynthConstants.SELECTED, 1135 GTKColorType.TEXT_BACKGROUND)); 1136 table.put("textHighlightText", 1137 entryStyle.getGTKColor(SynthConstants.SELECTED, 1138 GTKColorType.TEXT_FOREGROUND)); 1139 table.put("textInactiveText", 1140 entryStyle.getGTKColor(SynthConstants.DISABLED, 1141 GTKColorType.TEXT_FOREGROUND)); 1142 Object caretColor = 1143 entryStyle.getClassSpecificValue(Region.TEXT_FIELD, "cursor-color"); 1144 if (caretColor == null) { 1145 caretColor = GTKStyle.BLACK_COLOR; 1146 } 1147 table.put("caretColor", caretColor); 1148 1149 GTKStyle widgetStyle = (GTKStyle)factory.getStyle("GtkWidget"); 1150 table.put("control", widgetStyle.getGTKColor(SynthConstants.ENABLED, 1151 GTKColorType.BACKGROUND)); 1152 table.put("controlText", widgetStyle.getGTKColor( 1153 SynthConstants.ENABLED, 1154 GTKColorType.TEXT_FOREGROUND)); 1155 1156 table.put("controlHighlight", widgetStyle.getGTKColor( 1157 SynthConstants.ENABLED, GTKColorType.BACKGROUND)); 1158 table.put("controlLtHighlight", widgetStyle.getGTKColor( 1159 SynthConstants.ENABLED, GTKColorType.LIGHT)); 1160 table.put("controlShadow", widgetStyle.getGTKColor( 1161 SynthConstants.ENABLED, GTKColorType.DARK)); 1162 table.put("controlDkShadow", widgetStyle.getGTKColor( 1163 SynthConstants.ENABLED, GTKColorType.BLACK)); 1164 1165 1166 GTKStyle menuStyle = (GTKStyle)factory.getStyle("GtkMenuItem"); 1167 table.put("menu", menuStyle.getGTKColor(SynthConstants.ENABLED, 1168 GTKColorType.BACKGROUND)); 1169 table.put("menuText", menuStyle.getGTKColor(SynthConstants.ENABLED, 1170 GTKColorType.TEXT_FOREGROUND)); 1171 1172 GTKStyle scrollbarStyle = (GTKStyle)factory.getStyle("GtkScrollbar"); 1173 table.put("scrollbar", scrollbarStyle.getGTKColor(SynthConstants.ENABLED, 1174 GTKColorType.BACKGROUND)); 1175 1176 GTKStyle infoStyle = (GTKStyle)factory.getStyle("GtkMessageDialog"); 1177 table.put("info", scrollbarStyle.getGTKColor(SynthConstants.ENABLED, 1178 GTKColorType.BACKGROUND)); 1179 table.put("infoText", scrollbarStyle.getGTKColor(SynthConstants.ENABLED, 1180 GTKColorType.TEXT_FOREGROUND)); 1181 1182 GTKStyle desktopStyle = (GTKStyle)factory.getStyle("GtkContainer"); 1183 table.put("desktop", scrollbarStyle.getGTKColor(SynthConstants.ENABLED, 1184 GTKColorType.BACKGROUND)); 1185 1186 table.put("light", widgetStyle.getGTKColor( 1188 SynthConstants.ENABLED, GTKColorType.LIGHT)); 1189 table.put("mid", widgetStyle.getGTKColor( 1190 SynthConstants.ENABLED, GTKColorType.MID)); 1191 table.put("dark", widgetStyle.getGTKColor( 1192 SynthConstants.ENABLED, GTKColorType.DARK)); 1193 table.put("black", widgetStyle.getGTKColor( 1194 SynthConstants.ENABLED, GTKColorType.BLACK)); 1195 table.put("white", widgetStyle.getGTKColor( 1196 SynthConstants.ENABLED, GTKColorType.WHITE)); 1197 } 1198 1199 1202 public static ComponentUI createUI(JComponent c) { 1203 String key = c.getUIClassID().intern(); 1204 1205 if (key == "FileChooserUI") { 1206 return GTKFileChooserUI.createUI(c); 1207 } 1208 return SynthLookAndFeel.createUI(c); 1209 } 1210 1211 1214 static void updateAAText() { 1215 if (!cjkLocale) { 1216 Object aaValue = Toolkit.getDefaultToolkit(). 1217 getDesktopProperty("gnome.Xft/Antialias"); 1218 aaText = Boolean.valueOf(((aaValue instanceof Number ) && 1219 ((Number )aaValue).intValue() == 1)); 1220 } 1221 } 1222 1223 static boolean isLeftToRight(Component c) { 1224 return c.getComponentOrientation().isLeftToRight(); 1225 } 1226 1227 private static boolean isLocalDisplay() { 1228 try { 1229 Class x11Class = Class.forName("sun.awt.X11GraphicsEnvironment"); 1230 Method isDisplayLocalMethod = x11Class.getMethod( 1231 "isDisplayLocal", new Class [0]); 1232 return (Boolean )isDisplayLocalMethod.invoke(null, null); 1233 } catch (NoSuchMethodException nsme) { 1234 } catch (ClassNotFoundException cnfe) { 1235 } catch (IllegalAccessException iae) { 1236 } catch (InvocationTargetException ite) { 1237 } 1238 return false; 1241 } 1242 1243 1244 public void initialize() { 1245 super.initialize(); 1246 inInitialize = true; 1247 loadStylesFromThemeFiles(); 1248 inInitialize = false; 1249 1250 Toolkit kit = Toolkit.getDefaultToolkit(); 1251 WeakPCL pcl = new WeakPCL(this, kit, "gnome.Net/ThemeName"); 1252 kit.addPropertyChangeListener(pcl.getKey(), pcl); 1253 pcl = new WeakPCL(this, kit, "gnome.Gtk/FontName"); 1254 kit.addPropertyChangeListener(pcl.getKey(), pcl); 1255 pcl = new WeakPCL(this, kit, "gnome.Xft/DPI"); 1256 kit.addPropertyChangeListener(pcl.getKey(), pcl); 1257 1258 String language = Locale.getDefault().getLanguage(); 1259 cjkLocale = 1260 (Locale.CHINESE.getLanguage().equals(language) || 1261 Locale.JAPANESE.getLanguage().equals(language) || 1262 Locale.KOREAN.getLanguage().equals(language)); 1263 1264 if (isLocalDisplay()) { 1265 pcl = new WeakPCL(this, kit, "gnome.Xft/Antialias"); 1266 kit.addPropertyChangeListener(pcl.getKey(), pcl); 1267 updateAAText(); 1268 } 1269 flushUnreferenced(); 1270 } 1271 1272 static ReferenceQueue queue = new ReferenceQueue(); 1273 1274 static void flushUnreferenced() { 1275 WeakPCL pcl; 1276 1277 while ((pcl = (WeakPCL)queue.poll()) != null) { 1278 pcl.dispose(); 1279 } 1280 } 1281 1282 static class WeakPCL extends WeakReference implements 1283 PropertyChangeListener { 1284 private Toolkit kit; 1285 private String key; 1286 1287 WeakPCL(Object target, Toolkit kit, String key) { 1288 super(target, queue); 1289 this.kit = kit; 1290 this.key = key; 1291 } 1292 1293 public String getKey() { return key; } 1294 1295 public void propertyChange(final PropertyChangeEvent pce) { 1296 final GTKLookAndFeel lnf = (GTKLookAndFeel)get(); 1297 1298 if (lnf == null || UIManager.getLookAndFeel() != lnf) { 1299 dispose(); 1302 } 1303 else { 1304 SwingUtilities.invokeLater(new Runnable () { 1307 public void run() { 1308 if ("gnome.Xft/Antialias".equals( 1309 pce.getPropertyName())) { 1310 updateAAText(); 1311 } 1312 lnf.loadStylesFromThemeFiles(); 1313 Frame appFrames[] = Frame.getFrames(); 1314 for (int i = 0; i < appFrames.length; i++) { 1315 SynthLookAndFeel.updateStyles(appFrames[i]); 1316 } 1317 } 1318 }); 1319 } 1320 } 1321 1322 void dispose() { 1323 kit.removePropertyChangeListener(key, this); 1324 } 1325 } 1326 1327 public void propertyChange(PropertyChangeEvent evt) { 1328 String propertyName = evt.getPropertyName(); 1329 loadStylesFromThemeFiles(); 1330 Frame appFrames[] = Frame.getFrames(); 1331 for (int i = 0; i < appFrames.length; i++) { 1332 SynthLookAndFeel.updateStyles(appFrames[i]); 1333 } 1334 } 1335 1336 public boolean isSupportedLookAndFeel() { 1337 return true; 1338 } 1339 1340 public boolean isNativeLookAndFeel() { 1341 return false; 1342 } 1343 1344 public String getDescription() { 1345 return "GTK look and feel"; 1346 } 1347 1348 public String getName() { 1349 return "GTK look and feel"; 1350 } 1351 1352 public String getID() { 1353 return "GTK"; 1354 } 1355 1356 protected void loadSystemColors(UIDefaults table, String [] systemColors, boolean useNative) { 1359 super.loadSystemColors(table, systemColors, false); 1360 } 1361 1362 private void loadStylesFromThemeFiles() { 1363 AccessController.doPrivileged(new PrivilegedAction () { 1364 public Object run() { 1365 GTKParser parser = new GTKParser(); 1366 1367 1387 String filename = System.getProperty("swing.gtkthemefile"); 1389 String sep = File.separator; 1390 1391 if (filename == null || !parseThemeFile(filename, parser)) { 1392 String userHome = System.getProperty("user.home"); 1394 if (userHome != null) { 1395 parseThemeFile(userHome + sep + ".gtkrc-2.0", parser); 1396 } 1397 String themeName = (String )Toolkit.getDefaultToolkit(). 1399 getDesktopProperty("gnome.Net/ThemeName"); 1400 if (themeName == null) { 1401 themeName = "Default"; 1402 } 1403 String [] dirs = new String [] { 1404 userHome + "/.themes", 1405 System.getProperty("swing.gtkthemedir"), 1406 "/usr/share/themes" }; 1408 1409 String themeDirName = null; 1410 for (int i = 0; i < dirs.length; i++) { 1412 if (dirs[i] == null) { 1413 continue; 1414 } 1415 1416 if (new File (dirs[i] + sep + themeName + sep + 1417 "gtk-2.0" + sep + "gtkrc").canRead()) { 1418 themeDirName = dirs[i]; 1419 break; 1420 } 1421 } 1422 1423 if (themeDirName != null) { 1424 parseThemeFile(themeDirName + sep + themeName + sep + 1425 "gtk-2.0" + sep + "gtkrc", parser); 1426 } 1427 } 1428 setStyleFactory(handleParsedData(parser)); 1429 parser.clearParser(); 1430 return null; 1431 } 1432 }); 1433 if (!inInitialize) { 1436 UIDefaults table = UIManager.getLookAndFeelDefaults(); 1437 initSystemColorDefaults(table); 1438 initComponentDefaults(table); 1439 } 1440 } 1441 1442 private boolean parseThemeFile(String fileName, GTKParser parser) { 1443 File file = new File (fileName); 1444 if (file.exists()) { 1445 try { 1446 parser.parseFile(file, fileName); 1447 } catch (IOException ioe) { 1448 System.err.println("error: (" + ioe.toString() 1449 + ") while parsing file: \"" 1450 + fileName 1451 + "\""); 1452 } 1453 return true; 1454 } 1455 return false; } 1457 1458 1465 private GTKStyleFactory handleParsedData(GTKParser parser) { 1466 HashMap settings = parser.getGTKSettings(); 1467 1468 1498 1499 Object iconSizes = settings.get("gtk-icon-sizes"); 1500 if (iconSizes instanceof String ) { 1501 if (!configIconSizes((String )iconSizes)) { 1502 System.err.println("Error parsing gtk-icon-sizes string: '" + iconSizes + "'"); 1503 } 1504 } 1505 1506 Object fontName = Toolkit.getDefaultToolkit().getDesktopProperty( 1508 "gnome.Gtk/FontName"); 1509 1510 if (!(fontName instanceof String )) { 1511 fontName = settings.get("gtk-font-name"); 1512 if (!(fontName instanceof String )) { 1513 fontName = "sans 10"; 1514 } 1515 } 1516 Font defaultFont = PangoFonts.lookupFont((String )fontName); 1517 GTKStyle defaultStyle = new GTKStyle(defaultFont); 1518 GTKStyleFactory factory = new GTKStyleFactory(defaultStyle); 1519 1520 parser.loadStylesInto(factory); 1521 fallbackFont = defaultFont; 1522 return factory; 1523 } 1524 1525 private boolean configIconSizes(String sizeString) { 1526 String [] sizes = sizeString.split(":"); 1527 for (int i = 0; i < sizes.length; i++) { 1528 String [] splits = sizes[i].split("="); 1529 1530 if (splits.length != 2) { 1531 return false; 1532 } 1533 1534 String size = splits[0].trim().intern(); 1535 if (size.length() < 1) { 1536 return false; 1537 } 1538 1539 splits = splits[1].split(","); 1540 1541 if (splits.length != 2) { 1542 return false; 1543 } 1544 1545 String width = splits[0].trim(); 1546 String height = splits[1].trim(); 1547 1548 if (width.length() < 1 || height.length() < 1) { 1549 return false; 1550 } 1551 1552 int w = 0; 1553 int h = 0; 1554 1555 try { 1556 w = Integer.parseInt(width); 1557 h = Integer.parseInt(height); 1558 } catch (NumberFormatException nfe) { 1559 return false; 1560 } 1561 1562 if (w > 0 && h > 0) { 1563 int type = GTKStyle.GTKStockIconInfo.getIconType(size); 1564 GTKStyle.GTKStockIconInfo.setIconSize(type, w, h); 1565 } else { 1566 System.err.println("Invalid size in gtk-icon-sizes: " + w + "," + h); 1567 } 1568 } 1569 1570 return true; 1571 } 1572 1573 1582 public boolean shouldUpdateStyleOnAncestorChanged() { 1583 return true; 1584 } 1585} 1586 | Popular Tags |