Ejemplo n.º 1
0
 protected void initGeneralDefaults(UIDefaults table) {
   Object[] uiDefaults;
   uiDefaults =
       new Object[] {
         "ClassLoader", getClass().getClassLoader(),
       };
   table.putDefaults(uiDefaults);
 }
Ejemplo n.º 2
0
 protected void initResourceBundle(UIDefaults table) {
   // The following line of code does not work, when Quaqua has been loaded with
   // a custom class loader. That's why, we have to inject the labels
   // by ourselves:
   // table.addResourceBundle( "ch.randelshofer.quaqua.Labels" );
   ResourceBundle bundle =
       ResourceBundle.getBundle(
           "ch.randelshofer.quaqua.Labels", Locale.getDefault(), getClass().getClassLoader());
   for (Enumeration i = bundle.getKeys(); i.hasMoreElements(); ) {
     String key = (String) i.nextElement();
     table.put(key, bundle.getObject(key));
   }
 }
Ejemplo n.º 3
0
  /**
   * Initialize the uiClassID to BasicComponentUI mapping. The JComponent classes define their own
   * uiClassID constants (see AbstractComponent.getUIClassID). This table must map those constants
   * to a BasicComponentUI class of the appropriate type.
   *
   * @see #getDefaults
   */
  @Override
  protected void initClassDefaults(UIDefaults table) {
    String basicPrefix = "javax.swing.plaf.basic.Basic";
    String quaquaPrefix = "ch.randelshofer.quaqua.Quaqua";
    String quaquaPantherPrefix = "ch.randelshofer.quaqua.panther.QuaquaPanther";

    // NOTE: Uncomment parts of the code below, to override additional
    // UI classes of the target look and feel.
    Object[] uiDefaults = {
      "BrowserUI", quaquaPrefix + "BrowserUI",
      "FileChooserUI", quaquaPantherPrefix + "FileChooserUI",
    };
    table.putDefaults(uiDefaults);
  }
Ejemplo n.º 4
0
  @Override
  protected void initComponentDefaults(UIDefaults table) {
    String prefValue;
    // True if file choosers orders by type
    boolean isOrderFilesByType = false;
    // True if file choosers shows all files by default
    prefValue =
        OSXPreferences.getString( //
                OSXPreferences.FINDER_PREFERENCES, "AppleShowAllFiles", "false") //
            .toLowerCase();
    boolean isFileHidingEnabled = prefValue.equals("false") || prefValue.equals("no");
    boolean isQuickLookEnabled =
        Boolean.valueOf(QuaquaManager.getProperty("Quaqua.FileChooser.quickLookEnabled", "true"));

    Font smallSystemFont = SMALL_SYSTEM_FONT;
    Color grayedFocusCellBorderColor = (Color) table.get("listHighlight");

    Object[] uiDefaults = {
      "Browser.expandedIcon",
      new UIDefaults.ProxyLazyValue(
          "ch.randelshofer.quaqua.QuaquaIconFactory",
          "createIcon",
          new Object[] {jaguarDir + "Browser.disclosureIcons.png", 6, Boolean.TRUE, 0}),
      "Browser.expandingIcon",
      new UIDefaults.ProxyLazyValue(
          "ch.randelshofer.quaqua.QuaquaIconFactory",
          "createIcon",
          new Object[] {jaguarDir + "Browser.disclosureIcons.png", 6, Boolean.TRUE, 1}),
      "Browser.focusedSelectedExpandedIcon",
      new UIDefaults.ProxyLazyValue(
          "ch.randelshofer.quaqua.QuaquaIconFactory",
          "createIcon",
          new Object[] {jaguarDir + "Browser.disclosureIcons.png", 6, Boolean.TRUE, 2}),
      "Browser.focusedSelectedExpandingIcon",
      new UIDefaults.ProxyLazyValue(
          "ch.randelshofer.quaqua.QuaquaIconFactory",
          "createIcon",
          new Object[] {jaguarDir + "Browser.disclosureIcons.png", 6, Boolean.TRUE, 3}),
      "Browser.selectedExpandedIcon",
      new UIDefaults.ProxyLazyValue(
          "ch.randelshofer.quaqua.QuaquaIconFactory",
          "createIcon",
          new Object[] {jaguarDir + "Browser.disclosureIcons.png", 6, Boolean.TRUE, 4}),
      "Browser.selectedExpandingIcon",
      new UIDefaults.ProxyLazyValue(
          "ch.randelshofer.quaqua.QuaquaIconFactory",
          "createIcon",
          new Object[] {jaguarDir + "Browser.disclosureIcons.png", 6, Boolean.TRUE, 5}),
      //
      "Browser.selectionBackground",
      new ColorUIResource(56, 117, 215),
      "Browser.selectionForeground",
      new ColorUIResource(255, 255, 255),
      "Browser.inactiveSelectionBackground",
      new ColorUIResource(208, 208, 208),
      "Browser.inactiveSelectionForeground",
      new ColorUIResource(0, 0, 0),
      "Browser.sizeHandleIcon",
      makeIcon(getClass(), commonDir + "Browser.sizeHandleIcon.png"),
      "FileChooser.homeFolderIcon",
      LookAndFeel.makeIcon(getClass(), commonDir + "FileChooser.homeFolderIcon.png"),
      //
      "FileView.computerIcon",
      LookAndFeel.makeIcon(getClass(), commonDir + "FileView.computerIcon.png"),
      //
      "FileChooser.fileHidingEnabled",
      isFileHidingEnabled,
      "FileChooser.quickLookEnabled",
      isQuickLookEnabled,
      "FileChooser.orderByType",
      isOrderFilesByType,
      "FileChooser.previewLabelForeground",
      new ColorUIResource(0x000000),
      "FileChooser.previewValueForeground",
      new ColorUIResource(0x000000),
      "FileChooser.previewLabelFont",
      smallSystemFont,
      "FileChooser.previewValueFont",
      smallSystemFont,
      "FileChooser.splitPaneDividerSize",
      6,
      "FileChooser.previewLabelInsets",
      new InsetsUIResource(0, 0, 0, 4),
      "FileChooser.cellTipOrigin",
      new Point(18, 1),
      "FileChooser.autovalidate",
      Boolean.TRUE,
      "FileChooser.browserFocusCellHighlightBorder",
      new UIDefaults.ProxyLazyValue(
          "javax.swing.plaf.BorderUIResource$EmptyBorderUIResource",
          new Object[] {new Insets(1, 1, 1, 1)}),
      "FileChooser.browserFocusCellHighlightBorderGrayed",
      new UIDefaults.ProxyLazyValue(
          "javax.swing.plaf.BorderUIResource$MatteBorderUIResource",
          new Object[] {1, 1, 1, 1, grayedFocusCellBorderColor}),
      "FileChooser.browserCellBorder",
      new UIDefaults.ProxyLazyValue(
          "javax.swing.plaf.BorderUIResource$EmptyBorderUIResource",
          new Object[] {new Insets(1, 1, 1, 1)}),
      "FileChooser.browserUseUnselectedExpandIconForLabeledFile",
      Boolean.TRUE,
      "Sheet.showAsSheet",
      Boolean.TRUE,
    };
    table.putDefaults(uiDefaults);
  }