/**
   * Prompts the user for the number of bullets in the list and then inserts the HTML for a bulleted
   * list into the given TabManager
   */
  @Override
  public void actionPerformed(ActionEvent e) {
    String input = "";

    while ((input != null) && (!input.matches("[0-9]{1,3}"))) {
      input =
          (String)
              JOptionPane.showInputDialog(
                  tabManager,
                  "Please input the number of list entries:",
                  "Insert List",
                  JOptionPane.PLAIN_MESSAGE,
                  null,
                  null,
                  "");
    }

    if (input != null) {
      int numEntries = Integer.parseInt(input);

      String inputText = "<ul>";
      String entryText = "	<li></li>\n";

      for (int i = 0; i < numEntries; i++) {
        inputText += entryText;
      }
      inputText += "</ul>";

      tabManager.InsertText(inputText);
    }
  }
Esempio n. 2
0
  /** This method executes the actual copy operation. */
  @Override
  public void actionPerformed(ActionEvent e) {
    String text = tabManager.GetSelectedText();
    StringSelection ss = new StringSelection(text);

    Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
  }