Beispiel #1
0
 /** Returns the contents of the next textarea. */
 public String getNextText() {
   String text;
   if (textAreaIndex == 0 && textArea1 != null) {
     // textArea1.selectAll();
     text = textArea1.getText();
     textAreaIndex++;
     if (macro) text = Macro.getValue(macroOptions, "text1", text);
     if (recorderOn) {
       String text2 = text;
       String cmd = Recorder.getCommand();
       if (cmd != null && cmd.equals("Convolve...")) {
         text2 = text.replaceAll("\n", "\\\\n");
         if (!text.endsWith("\n")) text2 = text2 + "\\n";
       } else text2 = text.replace('\n', ' ');
       Recorder.recordOption("text1", text2);
     }
   } else if (textAreaIndex == 1 && textArea2 != null) {
     textArea2.selectAll();
     text = textArea2.getText();
     textAreaIndex++;
     if (macro) text = Macro.getValue(macroOptions, "text2", text);
     if (recorderOn) Recorder.recordOption("text2", text.replace('\n', ' '));
   } else text = null;
   return text;
 }
Beispiel #2
0
 /**
  * Adds one or two (side by side) text areas.
  *
  * @param text1 initial contents of the first text area
  * @param text2 initial contents of the second text area or null
  * @param rows the number of rows
  * @param columns the number of columns
  */
 public void addTextAreas(String text1, String text2, int rows, int columns) {
   if (textArea1 != null) return;
   Panel panel = new Panel();
   textArea1 = new TextArea(text1, rows, columns, TextArea.SCROLLBARS_NONE);
   if (IJ.isLinux()) textArea1.setBackground(Color.white);
   textArea1.addTextListener(this);
   panel.add(textArea1);
   if (text2 != null) {
     textArea2 = new TextArea(text2, rows, columns, TextArea.SCROLLBARS_NONE);
     if (IJ.isLinux()) textArea2.setBackground(Color.white);
     panel.add(textArea2);
   }
   c.gridx = 0;
   c.gridy = y;
   c.gridwidth = 2;
   c.anchor = GridBagConstraints.WEST;
   c.insets = getInsets(15, 20, 0, 0);
   grid.setConstraints(panel, c);
   add(panel);
   y++;
 }