예제 #1
0
  /** OptionPaneDemo Constructor */
  public OptionPaneDemo(SwingSet2 swingset) {
    // Set the title for this demo, and an icon used to represent this
    // demo inside the SwingSet2 app.
    super(swingset, "OptionPaneDemo", "toolbar/JOptionPane.gif");

    JPanel demo = getDemoPanel();

    demo.setLayout(new BoxLayout(demo, BoxLayout.X_AXIS));

    JPanel bp =
        new JPanel() {
          public Dimension getMaximumSize() {
            return new Dimension(getPreferredSize().width, super.getMaximumSize().height);
          }
        };
    bp.setLayout(new BoxLayout(bp, BoxLayout.Y_AXIS));

    bp.add(Box.createRigidArea(VGAP30));
    bp.add(Box.createRigidArea(VGAP30));

    bp.add(createInputDialogButton());
    bp.add(Box.createRigidArea(VGAP15));
    bp.add(createWarningDialogButton());
    bp.add(Box.createRigidArea(VGAP15));
    bp.add(createMessageDialogButton());
    bp.add(Box.createRigidArea(VGAP15));
    bp.add(createComponentDialogButton());
    bp.add(Box.createRigidArea(VGAP15));
    bp.add(createConfirmDialogButton());
    bp.add(Box.createVerticalGlue());

    demo.add(Box.createHorizontalGlue());
    demo.add(bp);
    demo.add(Box.createHorizontalGlue());
  }
  /**
   * Create the pixel location panel
   *
   * @param labelFont the font for the labels
   * @return the location panel
   */
  public JPanel createLocationPanel(Font labelFont) {

    // create a location panel
    JPanel locationPanel = new JPanel();
    locationPanel.setLayout(new FlowLayout());
    Box hBox = Box.createHorizontalBox();

    // create the labels
    rowLabel = new JLabel("Row:");
    colLabel = new JLabel("Column:");

    // create the text fields
    colValue = new JTextField(Integer.toString(colIndex + numberBase), 6);
    colValue.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            displayPixelInformation(colValue.getText(), rowValue.getText());
          }
        });
    rowValue = new JTextField(Integer.toString(rowIndex + numberBase), 6);
    rowValue.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            displayPixelInformation(colValue.getText(), rowValue.getText());
          }
        });

    // set up the next and previous buttons
    setUpNextAndPreviousButtons();

    // set up the font for the labels
    colLabel.setFont(labelFont);
    rowLabel.setFont(labelFont);
    colValue.setFont(labelFont);
    rowValue.setFont(labelFont);

    // add the items to the vertical box and the box to the panel
    hBox.add(Box.createHorizontalGlue());
    hBox.add(rowLabel);
    hBox.add(rowPrevButton);
    hBox.add(rowValue);
    hBox.add(rowNextButton);
    hBox.add(Box.createHorizontalStrut(10));
    hBox.add(colLabel);
    hBox.add(colPrevButton);
    hBox.add(colValue);
    hBox.add(colNextButton);
    locationPanel.add(hBox);
    hBox.add(Box.createHorizontalGlue());

    return locationPanel;
  }
예제 #3
0
  public Header() {

    super(BoxLayout.LINE_AXIS);

    this.label = new JLabel();

    this.label.setAlignmentY(Component.TOP_ALIGNMENT);
    this.label.setOpaque(false);
    // this.label.setVerticalAlignment (SwingConstants.TOP);

    // this.label.setVerticalTextPosition (SwingConstants.TOP);

    this.add(this.label);
    this.add(Box.createHorizontalGlue());

    this.paintProvider =
        new GradientPainter(Header.defaultPaintLeftColor, Header.defaultPaintRightColor);

    this.setPadding(Header.defaultPadding);

    Font f = this.getFont().deriveFont(Font.BOLD, 14);

    this.setFont(f);
    this.setTitleColor(Header.defaultTitleColor);
  }
예제 #4
0
  void initComponents() {
    JPanel mainPanel = new JPanel(new BorderLayout());
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
    Color bgColor = Color.getHSBColor(0.58f, 0.17f, 0.95f);
    buttonPanel.setBackground(bgColor);
    Border empty = BorderFactory.createEmptyBorder(5, 5, 5, 5);
    buttonPanel.setBorder(empty);

    textField = new JTextField(75);
    buttonPanel.add(textField);

    buttonPanel.add(Box.createHorizontalStrut(10));
    searchPHI = new JButton("Search PHI");
    searchPHI.addActionListener(this);
    buttonPanel.add(searchPHI);

    buttonPanel.add(Box.createHorizontalStrut(10));
    searchTrial = new JButton("Search Trial IDs");
    searchTrial.addActionListener(this);
    buttonPanel.add(searchTrial);

    buttonPanel.add(Box.createHorizontalStrut(20));
    buttonPanel.add(Box.createHorizontalGlue());
    saveAs = new JCheckBox("Save As...");
    saveAs.setBackground(bgColor);
    buttonPanel.add(saveAs);

    mainPanel.add(buttonPanel, BorderLayout.NORTH);

    JScrollPane scrollPane = new JScrollPane();
    textPane = new ColorPane();
    // textPane.setEditable(false);
    scrollPane.setViewportView(textPane);
    mainPanel.add(scrollPane, BorderLayout.CENTER);

    JPanel footerPanel = new JPanel();
    footerPanel.setLayout(new BoxLayout(footerPanel, BoxLayout.X_AXIS));
    footerPanel.setBackground(bgColor);
    message = new JLabel("Ready...");
    footerPanel.add(message);
    mainPanel.add(footerPanel, BorderLayout.SOUTH);

    setTitle(windowTitle);
    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent evt) {
            System.exit(0);
          }
        });
    getContentPane().add(mainPanel, BorderLayout.CENTER);
    pack();
    centerFrame();
  }
예제 #5
0
 /**
  * Create the toolbar. By default this reads the resource file for the definition of the toolbar.
  */
 private Component createToolbar() {
   toolbar = new JToolBar();
   String[] toolKeys = SCSUtility.tokenize(getResourceString("toolbar"));
   for (int i = 0; i < toolKeys.length; i++) {
     if (toolKeys[i].equals("-")) {
       toolbar.add(Box.createHorizontalStrut(5));
     } else {
       toolbar.add(createTool(toolKeys[i]));
     }
   }
   toolbar.add(Box.createHorizontalGlue());
   return toolbar;
 }
예제 #6
0
  /** Create and layout the visual components. */
  private void initComponents() {
    setTitle("Chart Settings");
    setSize(new Dimension(450, 375));
    setResizable(false);

    addWindowListener(
        new java.awt.event.WindowAdapter() {
          public void windowClosing(java.awt.event.WindowEvent evt) {
            closeDialog(evt);
          }
        });

    Box mainView = new Box(VERTICAL);
    getContentPane().add(mainView);

    Box row;

    Box yAxisView = new Box(VERTICAL);
    yAxisView.setBorder(border);
    mainView.add(yAxisView);

    yAutoScaleCheckbox = new JCheckBox("Auto Scale");
    yAutoScaleCheckbox.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            yAutoScaleCheckboxActionPerformed(evt);
          }
        });
    row = new Box(HORIZONTAL);
    row.add(Box.createHorizontalGlue());
    row.add(yAutoScaleCheckbox);
    yAxisView.add(row);

    yAxisMinValueField = new JTextField(10);
    yAxisMinValueField.setMaximumSize(yAxisMinValueField.getPreferredSize());
    yAxisMinValueField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
    yAxisMinValueField.addFocusListener(
        new FocusAdapter() {
          public void focusGained(FocusEvent event) {
            yAxisMinValueField.selectAll();
          }

          public void focusLost(FocusEvent event) {
            yAxisMinValueField.setCaretPosition(0);
            yAxisMinValueField.moveCaretPosition(0);
          }
        });
    row = new Box(HORIZONTAL);
    row.add(Box.createHorizontalGlue());
    row.add(new JLabel("Min:"));
    row.add(yAxisMinValueField);
    yAxisView.add(row);

    yAxisMaxValueField = new JTextField(10);
    yAxisMaxValueField.setMaximumSize(yAxisMaxValueField.getPreferredSize());
    yAxisMaxValueField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
    yAxisMaxValueField.addFocusListener(
        new FocusAdapter() {
          public void focusGained(FocusEvent event) {
            yAxisMaxValueField.selectAll();
          }

          public void focusLost(FocusEvent event) {
            yAxisMaxValueField.setCaretPosition(0);
            yAxisMaxValueField.moveCaretPosition(0);
          }
        });
    row = new Box(HORIZONTAL);
    row.add(Box.createHorizontalGlue());
    row.add(new JLabel("Max:"));
    row.add(yAxisMaxValueField);
    yAxisView.add(row);

    yAxisDivisionsField = new JTextField(10);
    yAxisDivisionsField.setMaximumSize(yAxisDivisionsField.getPreferredSize());
    yAxisDivisionsField.setHorizontalAlignment(JTextField.RIGHT);
    yAxisDivisionsField.addFocusListener(
        new FocusAdapter() {
          public void focusGained(FocusEvent event) {
            yAxisDivisionsField.selectAll();
          }

          public void focusLost(FocusEvent event) {
            yAxisDivisionsField.setCaretPosition(0);
            yAxisDivisionsField.moveCaretPosition(0);
          }
        });
    row = new Box(HORIZONTAL);
    row.add(Box.createHorizontalGlue());
    row.add(new JLabel("Major Divisions:"));
    row.add(yAxisDivisionsField);
    yAxisView.add(row);

    Box buttonView = new Box(HORIZONTAL);
    mainView.add(buttonView);
    buttonView.add(Box.createHorizontalGlue());

    JButton revertButton = new JButton("Revert");
    revertButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            revertButtonActionPerformed(event);
          }
        });
    buttonView.add(revertButton);

    JButton applyButton = new JButton("Apply");
    applyButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            applyButtonActionPerformed(event);
          }
        });
    buttonView.add(applyButton);

    pack();
  }
  /**
   * Creates a new <code>AddPersonDialog</code> with a given owner <code>JFrame</code> and <code>
   * FamilyTree</code>.
   */
  public AddPersonDialog(JFrame owner, FamilyTree tree) {
    super(owner, "Add New Person", true /* modal */);

    Container pane = this.getContentPane();
    pane.setLayout(new BorderLayout());

    JPanel infoPanel = new JPanel();
    infoPanel.setLayout(new GridLayout(0, 2));
    Border infoBorder = BorderFactory.createEmptyBorder(5, 5, 5, 5);
    infoPanel.setBorder(infoBorder);

    infoPanel.add(new JLabel("id:"));
    final JTextField idField = new JTextField();
    infoPanel.add(idField);

    final ButtonGroup group = new ButtonGroup();

    final JRadioButton male = new JRadioButton("male", true);
    group.add(male);
    infoPanel.add(male);

    final JRadioButton female = new JRadioButton("female");
    group.add(female);
    infoPanel.add(female);

    infoPanel.add(new JLabel("First name:"));
    final JTextField firstNameField = new JTextField();
    infoPanel.add(firstNameField);

    infoPanel.add(new JLabel("Middle name:"));
    final JTextField middleNameField = new JTextField();
    infoPanel.add(middleNameField);

    infoPanel.add(new JLabel("Last name:"));
    final JTextField lastNameField = new JTextField();
    infoPanel.add(lastNameField);

    infoPanel.add(new JLabel("Date of Birth:"));
    final JTextField dobField = new JTextField();
    infoPanel.add(dobField);

    infoPanel.add(new JLabel("Date of Death:"));
    final JTextField dodField = new JTextField();
    infoPanel.add(dodField);

    infoPanel.add(new JLabel("Father:"));
    JPanel fatherPanel = new JPanel();
    fatherPanel.setLayout(new FlowLayout());
    final JTextField fatherText = new JTextField("Click to choose");
    fatherText.setEditable(false);
    fatherText.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            // Pop up a PersonChooseDialog, place name in TextField
            System.out.println("Clicked father");
          }
        });
    fatherPanel.add(fatherText);
    infoPanel.add(fatherPanel);

    infoPanel.add(new JLabel("Mother:"));
    JPanel motherPanel = new JPanel();
    motherPanel.setLayout(new FlowLayout());
    final JTextField motherText = new JTextField("Click to choose");
    motherText.setEditable(false);
    motherText.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            // Pop up a PersonChooseDialog, place name in TextField
            System.out.println("Clicked mother");
          }
        });
    motherPanel.add(motherText);
    infoPanel.add(motherPanel);

    pane.add(infoPanel, BorderLayout.NORTH);

    // "Add" and "Cancel" buttons
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
    buttonPanel.add(Box.createHorizontalGlue());

    JButton addButton = new JButton("Add");
    addButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // Create a new person based on the information entered in
            // this dialog
            int id = 0;
            try {
              id = Integer.parseInt(idField.getText());

            } catch (NumberFormatException ex) {
              error("Invalid id: " + idField.getText());
              return;
            }

            String text = null;

            text = dobField.getText();
            Date dob = null;
            if (text != null && !text.equals("")) {
              dob = parseDate(dobField.getText());
              if (dob == null) {
                // Parse error
                return;
              }
            }

            text = dodField.getText();
            Date dod = null;
            if (text != null && !text.equals("")) {
              dod = parseDate(dodField.getText());
              if (dod == null) {
                // Parse error
                return;
              }
            }

            Person.Gender gender;
            if (group.getSelection().equals(male)) {
              gender = Person.MALE;

            } else {
              gender = Person.FEMALE;
            }

            // Okay, everything parsed alright
            newPerson = new Person(id, gender);
            newPerson.setFirstName(firstNameField.getText());
            newPerson.setMiddleName(middleNameField.getText());
            newPerson.setLastName(lastNameField.getText());
            newPerson.setDateOfBirth(dob);
            newPerson.setDateOfDeath(dod);

            if (mother != null) {
              newPerson.setMother(mother);
            }

            if (father != null) {
              newPerson.setFather(father);
            }

            // We're all happy
            AddPersonDialog.this.dispose();
          }
        });
    buttonPanel.add(addButton);

    buttonPanel.add(Box.createHorizontalGlue());

    JButton cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // Read my lips, no new Person!

            AddPersonDialog.this.newPerson = null;

            AddPersonDialog.this.dispose();
          }
        });
    buttonPanel.add(cancelButton);

    buttonPanel.add(Box.createHorizontalGlue());

    pane.add(buttonPanel, BorderLayout.SOUTH);
  }
  private void createUI() {
    try {
      this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
      Border border = BorderFactory.createEmptyBorder(5, 5, 5, 5);
      this.setBorder(border);
      JPanel panel = new JPanel();
      panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));

      Box box = Box.createVerticalBox();

      String[] args = new String[7];
      args[0] = "fileSelector"; // Name
      args[1] = "file selector"; // Description
      args[2] = "Input shapefile:"; // getTextValue(el, "LabelText");
      args[3] = Integer.toString(DialogFile.MODE_OPEN);
      args[4] = "true"; // getTextValue(el, "ShowButton").toLowerCase();
      args[5] = "ShapeFile (*.shp), SHP"; // getTextValue(el, "Filter");
      args[6] = "false"; // getTextValue(el, "MakeOptional").toLowerCase();

      df = new DialogFile(hostDialog);
      df.setArgs(args);
      df.addPropertyChangeListener("value", this);
      df.setTextFieldActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent evt) {
              okPressed();
            }
          });
      box.add(df);

      // list.addListSelectionListener(this);
      Box hbox = Box.createHorizontalBox();
      lbl = new JLabel(label);
      hbox.add(lbl);
      hbox.add(Box.createHorizontalGlue());
      box.add(hbox);
      box.add(Box.createHorizontalStrut(5));

      list = new JList();

      if (!multiSelect) {
        list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
      } else { // true
        list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
      }

      updateList();

      JScrollPane scroller1 = new JScrollPane(list);

      box.add(scroller1);
      box.setToolTipText(description);
      this.setToolTipText(description);
      list.setToolTipText(description);
      lbl.setToolTipText(description);
      panel.add(box);
      this.add(panel);
      this.add(Box.createHorizontalGlue());

      this.setMaximumSize(new Dimension(2500, 140));
      this.setPreferredSize(new Dimension(350, 140));

    } catch (Exception e) {
      System.out.println(e.getCause());
    }
  }
public class InfoPanelForDrawable extends SearchPanel // SearchPanel is JPanel
{
  private static final long serialVersionUID = 13100L;

  private static final Component STRUT = Box.createHorizontalStrut(10);
  private static final Component GLUE = Box.createHorizontalGlue();

  private static final String FORMAT = Const.INFOBOX_TIME_FORMAT;
  private static DecimalFormat fmt = null;
  private static TimeFormat tfmt = null;

  private static Border Normal_Border = null;
  private static Border Shadow_Border = null;

  private Drawable drawable;

  public InfoPanelForDrawable(
      final Map map_line2treenodes, final String[] y_colnames, final Drawable dobj) {
    super();
    super.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    /* Define DecialFormat for the displayed time */
    if (fmt == null) {
      fmt = (DecimalFormat) NumberFormat.getInstance();
      fmt.applyPattern(FORMAT);
    }
    if (tfmt == null) tfmt = new TimeFormat();
    if (Normal_Border == null) {
      /*
      Normal_Border = BorderFactory.createCompoundBorder(
                      BorderFactory.createRaisedBevelBorder(),
                      BorderFactory.createLoweredBevelBorder() );
      */
      Normal_Border = BorderFactory.createEtchedBorder();
    }
    if (Shadow_Border == null) {
      Shadow_Border =
          BorderFactory.createTitledBorder(
              Normal_Border,
              " Preview State ",
              TitledBorder.LEFT,
              TitledBorder.TOP,
              Const.FONT,
              Color.magenta);
    }

    drawable = dobj;

    // Set the CategoryLabel Icon
    Dimension panel_max_size;
    Category type = null;
    CategoryLabel label_type = null;
    JPanel top_panel = new JPanel();
    top_panel.setLayout(new BoxLayout(top_panel, BoxLayout.X_AXIS));
    if (drawable instanceof Shadow && ((Shadow) drawable).getSelectedSubCategory() != null) {
      type = ((Shadow) drawable).getSelectedSubCategory();
      label_type = new CategoryLabel(type);
      ((Shadow) drawable).clearSelectedSubCategory();
      top_panel.setBorder(Shadow_Border);
    } else {
      type = drawable.getCategory();
      label_type = new CategoryLabel(type);
      top_panel.setBorder(Normal_Border);
    }
    top_panel.add(STRUT);
    top_panel.add(label_type);
    top_panel.add(GLUE);
    top_panel.setAlignmentX(Component.LEFT_ALIGNMENT);
    panel_max_size = top_panel.getPreferredSize();
    panel_max_size.width = Short.MAX_VALUE;
    top_panel.setMaximumSize(panel_max_size);
    super.add(top_panel);

    // Determine the text of the drawable
    TextAreaBuffer textbuf;
    int num_cols, num_rows;
    textbuf = new TextAreaBuffer(map_line2treenodes, y_colnames);
    if (drawable instanceof Shadow) textbuf.setShadowText((Shadow) drawable, type);
    else if (drawable instanceof Composite) textbuf.setCompositeText((Composite) drawable);
    else textbuf.setPrimitiveText((Primitive) drawable);
    textbuf.finalized();
    num_cols = textbuf.getColumnCount();
    num_rows = textbuf.getRowCount();

    // Set the TextArea
    JTextArea text_area;
    int adj_num_cols;
    text_area = new JTextArea(textbuf.toString());
    adj_num_cols = Routines.getAdjNumOfTextColumns(text_area, num_cols);
    num_cols = (int) Math.ceil(adj_num_cols * 85.0d / 100.0d);
    text_area.setColumns(num_cols);
    text_area.setRows(num_rows);
    text_area.setEditable(false);
    text_area.setLineWrap(true);
    JScrollPane scroller = new JScrollPane(text_area);
    scroller.setAlignmentX(Component.LEFT_ALIGNMENT);
    super.add(scroller);
  }

  //  The following function is for Seach and Scan facility of the viewport.
  public Drawable getSearchedDrawable() {
    return drawable;
  }

  private class TextAreaBuffer {
    private Map map_line2treenodes;
    private String[] y_colnames;
    private StringBuffer strbuf;
    private String strbuf2str;
    private int num_cols;
    private int num_rows;

    public TextAreaBuffer(final Map in_map_line2treenodes, final String[] in_y_colnames) {
      map_line2treenodes = in_map_line2treenodes;
      y_colnames = in_y_colnames;
      strbuf = new StringBuffer();
      strbuf2str = null;

      // Initialize num_cols and num_rows.
      num_cols = 0;
      num_rows = 0;
    }

    // this.finalized() needs to be called before
    // getColumnCount()/getRowCount()/toString()
    public void finalized() {
      int num_lines;
      strbuf2str = strbuf.toString();
      num_lines = this.getNumOfLines();
      if (num_lines <= 3) num_rows = 3;
      else num_rows = 4;
    }

    public int getColumnCount() {
      return num_cols;
    }

    public int getRowCount() {
      return num_rows;
    }

    public String toString() {
      return strbuf2str;
    }

    private int getNumOfLines() {
      int num_lines;
      int str_length;
      int ipos;
      if (strbuf2str != null) {
        num_lines = 1;
        ipos = 0;
        str_length = strbuf2str.length();
        while (ipos >= 0 && ipos < str_length) {
          ipos = strbuf2str.indexOf('\n', ipos);
          if (ipos >= 0) {
            num_lines++;
            ipos++;
          }
        }
        return num_lines;
      } else return -1;
    }

    private void setCoordsText(final Coord[] coords, String description) {
      StringBuffer linebuf;
      Coord vertex;
      YaxisTreeNode node;
      TreeNode[] nodes;
      Integer lineID;
      double duration;
      int coords_length;
      int idx, ii;

      linebuf = new StringBuffer();
      coords_length = coords.length;
      if (coords_length > 1) {
        duration = coords[coords_length - 1].time - coords[0].time;
        linebuf.append("duration" + description + " = " + tfmt.format(duration));
        if (num_cols < linebuf.length()) num_cols = linebuf.length();
        num_rows++;
        strbuf.append(linebuf.toString() + "\n");
      }
      for (idx = 0; idx < coords_length; idx++) {
        linebuf = new StringBuffer("[" + idx + "]: ");
        vertex = coords[idx];
        lineID = new Integer(vertex.lineID);
        node = (YaxisTreeNode) map_line2treenodes.get(lineID);
        nodes = node.getPath();
        linebuf.append("time" + description + " = " + fmt.format(vertex.time));
        for (ii = 1; ii < nodes.length; ii++)
          linebuf.append(", " + y_colnames[ii - 1] + " = " + nodes[ii]);
        if (num_cols < linebuf.length()) num_cols = linebuf.length();
        num_rows++;
        strbuf.append(linebuf.toString());
        if (idx < coords_length - 1) strbuf.append("\n");
      }
    }

    private void setEndCoordsText(
        final Coord start_vtx,
        final Coord final_vtx,
        double earliest_time,
        double latest_time,
        int coords_length) {
      StringBuffer linebuf;
      Coord vertex;
      YaxisTreeNode node;
      TreeNode[] nodes;
      Integer lineID;
      double duration;
      int idx, ii;

      duration = latest_time - earliest_time;
      linebuf = new StringBuffer();
      linebuf.append("duration (max) = " + tfmt.format(duration));
      if (num_cols < linebuf.length()) num_cols = linebuf.length();
      num_rows++;
      strbuf.append(linebuf.toString());

      idx = 0;
      linebuf = new StringBuffer("[" + idx + "]: ");
      vertex = start_vtx;
      lineID = new Integer(vertex.lineID);
      node = (YaxisTreeNode) map_line2treenodes.get(lineID);
      nodes = node.getPath();
      linebuf.append("time (min) = " + fmt.format(earliest_time));
      for (ii = 1; ii < nodes.length; ii++)
        linebuf.append(", " + y_colnames[ii - 1] + " = " + nodes[ii]);
      if (num_cols < linebuf.length()) num_cols = linebuf.length();
      num_rows++;
      strbuf.append("\n" + linebuf.toString());

      idx = coords_length - 1;
      linebuf = new StringBuffer("[" + idx + "]: ");
      vertex = final_vtx;
      lineID = new Integer(vertex.lineID);
      node = (YaxisTreeNode) map_line2treenodes.get(lineID);
      nodes = node.getPath();
      linebuf.append("time (max) = " + fmt.format(latest_time));
      for (ii = 1; ii < nodes.length; ii++)
        linebuf.append(", " + y_colnames[ii - 1] + " = " + nodes[ii]);
      if (num_cols < linebuf.length()) num_cols = linebuf.length();
      num_rows++;
      strbuf.append("\n" + linebuf.toString());
    }

    // For Real Primitive
    public void setPrimitiveText(final Primitive prime) {
      this.setCoordsText(prime.getVertices(), "");

      String info_str;
      info_str = prime.toInfoBoxString().trim();
      if (info_str.length() > 0) {
        strbuf.append("\n" + info_str);
        num_rows++;
      }

      Drawable prime_parent;
      prime_parent = prime.getParent();
      if (prime_parent != null) {
        info_str = prime_parent.toInfoBoxString().trim();
        if (info_str.length() > 0) {
          strbuf.append("\n" + info_str);
          num_rows++;
        }
      }
    }

    private int getPrintStatus(final Topology topo) {
      if (topo.isState())
        if (Parameters.PREVIEW_STATE_DISPLAY.equals(PreviewState.CUMULATIVE_EXCLUSION)
            || Parameters.PREVIEW_STATE_DISPLAY.equals(PreviewState.OVERLAP_EXCLUSION))
          return CategoryWeight.PRINT_EXCL_RATIO;
        else return CategoryWeight.PRINT_INCL_RATIO;
      else // if ( topo.isArrow() )
      return CategoryWeight.PRINT_INCL_RATIO;
    }

    // For Shadow Primitive
    public void setShadowText(final Shadow shade, final Category type) {
      this.setEndCoordsText(
          shade.getStartVertex(),
          shade.getFinalVertex(),
          shade.getEarliestTime(),
          shade.getLatestTime(),
          shade.getVertices().length);
      strbuf.append("\n\n");
      this.setCoordsText(shade.getVertices(), " (ave)");
      strbuf.append("\n");

      StringBuffer linebuf;
      Topology shade_topo;
      CategoryWeight[] twgts;
      CategoryWeight twgt;
      String twgt_str;
      int print_status;
      int idx;

      shade_topo = shade.getCategory().getTopology();

      // linebuf = new StringBuffer( "Number of Real Drawables = " );
      linebuf = new StringBuffer("Number of Real ");
      linebuf.append(shade_topo + "s = ");
      linebuf.append(shade.getNumOfRealObjects());
      if (num_cols < linebuf.length()) num_cols = linebuf.length();
      num_rows++;
      strbuf.append("\n" + linebuf.toString());
      strbuf.append("\n");

      print_status = getPrintStatus(shade_topo);
      strbuf.append("\n" + CategoryWeight.getPrintTitle(print_status));
      twgts = shade.arrayOfCategoryWeights();
      for (idx = 0; idx < twgts.length; idx++) {
        twgt = twgts[idx];
        twgt_str = twgt.toInfoBoxString(print_status);
        if (twgt.getCategory().equals(type)) {
          twgt_str += "  <---";
          if (num_cols < twgt_str.length() + 6) num_cols = twgt_str.length() + 6;
        } else {
          if (num_cols < twgt_str.length()) num_cols = twgt_str.length();
        }
        num_rows++;
        strbuf.append("\n" + twgt_str);
      }
    }

    // For Real Composite
    public void setCompositeText(final Composite cmplx) {
      Coord[] cmplx_coords;
      cmplx_coords = new Coord[] {cmplx.getStartVertex(), cmplx.getFinalVertex()};
      this.setCoordsText(cmplx_coords, "");

      String info_str;
      info_str = cmplx.toInfoBoxString().trim();
      if (info_str.length() > 0) {
        strbuf.append("\n" + info_str);
        num_rows++;
      }

      Drawable cmplx_parent;
      cmplx_parent = cmplx.getParent();
      if (cmplx_parent != null) {
        info_str = cmplx_parent.toInfoBoxString().trim();
        if (info_str.length() > 0) {
          strbuf.append("\n" + info_str);
          num_rows++;
        }
      }
    }
  } //  End of   private class TextAreaBuffer
}