private void initKeyboardEquivalent() {
    String key = "TAB";
    boolean shifted = (indexDelta == -1);

    boolean tabDoesNotWork = true;
    if (tabDoesNotWork || GuiUtilities.isMacOs()) {
      key = (indexDelta == -1) ? "OPEN_BRACKET" : "CLOSE_BRACKET";
      shifted = true;
    }

    putValue(ACCELERATOR_KEY, GuiUtilities.makeKeyStroke(key, shifted));
  }
示例#2
0
 public static void main(String[] arguments) {
   GuiUtilities.initLookAndFeel();
   for (String argument : arguments) {
     String text = StringUtilities.readFile(argument);
     new HtmlViewer(text).setVisible(true);
   }
 }
示例#3
0
  /** Flashes the visual bell. This class has no other public API. */
  public void flash() {
    if (GuiUtilities.isMacOs()) {
      // Mac OS has a system-wide "visual bell" that looks much better than ours.
      // You can turn this on in the Universal Access preference pane, by checking "Flash the screen
      // when an alert sound occurs".
      // We can take advantage of Apple's hard work if the user has this turned on by "actually"
      // ringing the bell.
      // This doesn't change our "no noise pollution" policy, if you ignore the very unlikely race
      // condition.
      ArrayList<String> result = new ArrayList<String>();
      ArrayList<String> errors = new ArrayList<String>();
      int status =
          ProcessUtilities.backQuote(
              null,
              new String[] {
                "defaults",
                "-currentHost",
                "read",
                "Apple Global Domain",
                "com.apple.sound.beep.flash"
              },
              result,
              errors);
      if (status == 0 && errors.size() == 0 && result.size() == 1 && result.get(0).equals("1")) {
        Toolkit.getDefaultToolkit().beep();
        return;
      }
    }

    setBellVisibility(true);
    timer.restart();
  }
 public CycleWorkspacesAction(int indexDelta) {
   GuiUtilities.configureAction(
       this, (indexDelta == 1) ? "_Next Workspace" : "_Previous Workspace", null);
   this.indexDelta = indexDelta;
   initKeyboardEquivalent();
 }