Esempio n. 1
0
 public static void main(String[] arguments) {
   GuiUtilities.initLookAndFeel();
   for (String argument : arguments) {
     String text = StringUtilities.readFile(argument);
     new HtmlViewer(text).setVisible(true);
   }
 }
Esempio n. 2
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();
  }