コード例 #1
0
  public static void main(String[] args)
      throws BadLocationException, FileNotFoundException, UnsupportedEncodingException,
          IOException {
    m_form = new MainForm();
    m_form.setVisible(true);
    JTabbedPane j = m_form.getTabbedPane();

    if (!IO.loadFile(j)) {
      IO.setStatus("Welcome to ZeroVal.");
      SyntaxBox b = new SyntaxBox();
      b.setHighlightText("//New Tab Name\n//Press Alt + Enter to evaluate");
      j.insertTab("New Tab", null, b, "Blank Tab", 0);
    } else {
      IO.setStatus("Loaded tabs successfully.");
    }

    m_timer =
        new Timer(
            60,
            new java.awt.event.ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                try {
                  ((SyntaxBox) m_form.getTabbedPane().getSelectedComponent())
                      .getPatternHandler()
                      .renderSyntaxHighlighting();
                } catch (BadLocationException ex) {
                  Logger.getLogger(Base.class.getName()).log(Level.SEVERE, null, ex);
                }
              }
            });
    m_timer.start();
    j.insertTab("+", null, null, "Create New Tab", j.getTabCount());
  }
コード例 #2
0
  public boolean act(MainForm mainForm) {

    EditForm editDialog = (EditForm) mainForm.getEditDialog();
    editDialog.setModal(true); // STOP EVERYTHING UNTIL USER SELECTS OK or CANCEL
    editDialog.setVisible(true);

    // WAIT until user does something
    if (editDialog.wasCanceled()) return false;

    return operate(mainForm, editDialog);
  }
コード例 #3
0
 public boolean operate(MainForm mainForm, EditForm editDialog) {
   DefaultListModel list1 = (DefaultListModel) mainForm.getDataList().getModel();
   list1.set(0, "2343223432");
   int[] row = mainForm.getDataList().getSelectedIndices();
   if (row.length == 0) return false;
   // only edit the first one;
   int index = row[0];
   DefaultListModel list = (DefaultListModel) mainForm.getDataList().getModel();
   editDialog = (EditForm) mainForm.getEditDialog();
   try {
     double x = Double.parseDouble(editDialog.getNewX().getText());
     double y = Double.parseDouble(editDialog.getNewY().getText());
     String dataPointToAdd = x + " , " + y;
     list.set(index, dataPointToAdd);
     data.editDataPoint(index, x, y);
     return true;
   } catch (NumberFormatException | NullPointerException e) {
     e.printStackTrace();
     return false;
   }
 }