Ejemplo n.º 1
0
 /** Creates the tool palette. */
 protected JToolBar createToolPalette() {
   JToolBar palette = new JToolBar();
   palette.setBackground(Color.lightGray);
   // use standard FlowLayout for JToolBar
   // palette.setLayout(new PaletteLayout(2,new Point(2,2)));
   return palette;
 }
Ejemplo n.º 2
0
    /** Returns the tool bar for the panel. */
    protected JComponent getToolBar() {
      JToolBar tbarDir = new JToolBar();
      JButton btnNew = new JButton();
      // m_btnSave = new JButton("Save File");
      // i118n
      // btnNew.setText("New Label");
      btnNew.setText(Util.getAdmLabel("_adm_New_Label"));
      btnNew.setActionCommand("new");
      // m_btnSave.setActionCommand("save");

      ActionListener alTool =
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              doAction(e);
            }
          };

      btnNew.addActionListener(alTool);
      // m_btnSave.addActionListener(alTool);

      tbarDir.setFloatable(false);
      tbarDir.add(btnNew);
      /*tbarDir.add(new JLabel("        "));
      tbarDir.add(m_btnSave);*/

      return tbarDir;
    }
  /**
   * Creates toolbars for the application. This class always returns an empty list. Subclasses may
   * return other values.
   */
  @Override
  public List<JToolBar> createToolBars(Application a, @Nullable View pr) {
    ResourceBundleUtil labels = ResourceBundleUtil.getBundle("org.jhotdraw.draw.Labels");
    DrawView p = (DrawView) pr;

    DrawingEditor editor;
    if (p == null) {
      editor = getSharedEditor();
    } else {
      editor = p.getEditor();
    }

    LinkedList<JToolBar> list = new LinkedList<JToolBar>();
    JToolBar tb;
    tb = new JToolBar();
    addCreationButtonsTo(tb, editor);
    tb.setName(labels.getString("window.drawToolBar.title"));
    list.add(tb);
    tb = new JToolBar();
    ButtonFactory.addAttributesButtonsTo(tb, editor);
    tb.setName(labels.getString("window.attributesToolBar.title"));
    list.add(tb);
    tb = new JToolBar();
    ButtonFactory.addAlignmentButtonsTo(tb, editor);
    tb.setName(labels.getString("window.alignmentToolBar.title"));
    list.add(tb);
    return list;
  }
Ejemplo n.º 4
0
  /**
   * Activate/Deactivate Rotate-Button
   *
   * @param b
   */
  public void activateRotation(boolean b) {

    if (showRotate && b) {
      rotatePanel.setVisible(b);
      rotateSlider.setValue(((ShapeItem) board.getSelectedItems()[0]).getRotation());

    } else {
      rotatePanel.setVisible(false);
    }
    rotate.setEnabled(b);
  }
Ejemplo n.º 5
0
  /** Installs default Tools (Cursor, Add and Remove Point, Rotate, TextBox) into the toolbar */
  private void initDefaultTools() {
    cursorTool = currentTool = ToolFactory.getCursorTool();
    this.installToolInToolBar(toolbar, currentTool);
    toolbar.addSeparator();
    installAddRemovePointButtons();
    cursorButton = currentButton = (JButton) toolbar.getComponent(0);

    toolbar.addSeparator();
    this.installToolInToolBar(toolbar, ToolFactory.getTextBoxTool());
    toolbar.addSeparator();

    this.installRotateButton();
    toolbar.addSeparator();
  }
Ejemplo n.º 6
0
  /** Initialisation */
  private void initComponents() {
    setBackground(new java.awt.Color(114, 159, 255));
    addWindowListener(
        new java.awt.event.WindowAdapter() {
          public void windowClosing(java.awt.event.WindowEvent evt) {
            closeDialog();
          }
        });
    getContentPane().setLayout(new java.awt.BorderLayout());

    JPanel actionPanel = new JPanel();
    actionPanel.setLayout(new java.awt.GridLayout(1, 0));
    detailedArea.setEditable(false);
    detailedArea.setVisible(true);
    detailedArea.setSize(500, 300);
    detailedArea.setFont(new java.awt.Font("Arial", java.awt.Font.PLAIN, 11));
    StringWriter opDetail = new StringWriter();
    actionPrint(new PrintWriter(opDetail));
    detailedArea.setText(new String(opDetail.getBuffer()));
    JScrollPane scroll = new JScrollPane(detailedArea);
    actionPanel.add(scroll);
    getContentPane().add(actionPanel, "Center");

    northToolBar = new javax.swing.JToolBar();
    northToolBar.setLayout(new java.awt.FlowLayout());
    northToolBar.setFloatable(false);

    jbn_Print = new javax.swing.JButton();
    jbn_Print.setText("   Print   ");
    jbn_Print.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jbn_PrintActionPerformed();
          }
        });
    northToolBar.add(jbn_Print);

    jbn_OK = new javax.swing.JButton();
    jbn_OK.setText("   Close   ");
    jbn_OK.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jbn_OKActionPerformed();
          }
        });
    northToolBar.add(jbn_OK);

    getContentPane().add(northToolBar, "South");
  }
Ejemplo n.º 7
0
  /**
   * Constructs a ClutoTree diaplay which is initialized with tableModel as the data model, and the
   * given selection model.
   *
   * @param clutoSolution The clustering solution
   * @param tableContext The context which manages views and selections.
   * @param tableModel the data model for the parallel coordinate display
   */
  public ClutoTree(ClutoSolution clutoSolution, TableContext tableContext, TableModel tableModel) {
    ctx = tableContext;
    tm = tableModel;
    lsm = ctx.getRowSelectionModel(tm);

    // labelModel
    int ncol = tm.getColumnCount();
    for (int i = 0; i < ncol; i++) {
      labelModel.addElement(tm.getColumnName(i));
    }

    setLayout(new BorderLayout());
    btnP = new JToolBar();
    add(btnP, BorderLayout.NORTH);
    labelChoice.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
              labelColumn = 0;
              String ln = (String) e.getItem();
              if (ln != null) {
                for (int c = 0; c < tm.getColumnCount(); c++) {
                  if (ln.equals(tm.getColumnName(c))) {
                    labelColumn = c;
                    break;
                  }
                }
              }
              graph.invalidate();
              validate();
              repaint();
            }
          }
        });
    btnP.add(labelChoice);

    graph = new SimpleGraph();
    graph.getGraphDisplay().setOpaque(true);
    graph.getGraphDisplay().setBackground(Color.white);
    graph.getGraphDisplay().setGridColor(new Color(220, 220, 220));
    graph.showGrid(false);
    graph.showAxis(BorderLayout.WEST, false);
    graph.showAxis(BorderLayout.EAST, true);
    graph.getAxisDisplay(BorderLayout.EAST).setZoomable(true);
    graph.getAxisDisplay(BorderLayout.EAST).setAxisLabeler(labeler);
    ((LinearAxis) graph.getYAxis()).setTickIncrement(-1.);
    graph.getAxisDisplay(BorderLayout.SOUTH).setZoomable(true);
    gs = new GraphSegments();
    gs.setColor(Color.blue);
    idxSelColor = new IndexSelectColor(Color.cyan, null, new DefaultListSelectionModel());
    gs.setIndexedColor(idxSelColor);
    graph.addGraphItem(gs);
    graph.getGraphDisplay().addMouseListener(ma);

    add(graph);
    if (lsm != null) {
      lsm.addListSelectionListener(selListener);
    }
    display(makeTree(clutoSolution));
  }
Ejemplo n.º 8
0
  /** Install Add and Remove Buttons into the toolbar */
  private void installAddRemovePointButtons() {
    URL imgURL = ClassLoader.getSystemResource("ch/tbe/pics/plus.gif");
    ImageIcon plus = new ImageIcon(imgURL);
    imgURL = ClassLoader.getSystemResource("ch/tbe/pics/minus.gif");
    ImageIcon minus = new ImageIcon(imgURL);
    add = new JButton(plus);
    rem = new JButton(minus);
    add.setToolTipText(workingViewLabels.getString("plus"));
    rem.setToolTipText(workingViewLabels.getString("minus"));
    add.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            WorkingView.this.addRemovePoint(true);
          }
        });
    rem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            WorkingView.this.addRemovePoint(false);
          }
        });

    add.setContentAreaFilled(false);
    add.setBorderPainted(false);
    rem.setContentAreaFilled(false);
    rem.setBorderPainted(false);
    toolbar.add(add);
    toolbar.add(rem);
  }
Ejemplo n.º 9
0
  /**
   * Installs a Tool in the Toolbar
   *
   * @param toolbar as JToolbar
   * @param tool, Tool to install
   */
  public void installToolInToolBar(JToolBar toolbar, final Tool tool) {
    final JButton button;
    button = new JButton();

    button.setMargin(new Insets(0, 0, 0, 0));

    if (tool.getItemType() != null) {
      button.setIcon(tool.getItemType().getIcon());
      button.setToolTipText(tool.getItemType().getDescription());

    } else {
      button.setText("Tool"); // For Debugging
    }
    toolbar.add(button);
    toolButtons.add(button);
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            WorkingView.this.setTool(tool, button);
          }
        });
    button.setContentAreaFilled(false);
    button.setBorderPainted(false);
    button.addMouseListener(
        new MouseAdapter() {
          public void mouseEntered(MouseEvent e) {
            ((JButton) e.getSource()).setBorderPainted(true);
          }

          public void mouseExited(MouseEvent e) {
            ((JButton) e.getSource()).setBorderPainted(false);
          }
        });
  }
Ejemplo n.º 10
0
  private void addCreationButtonsTo(JToolBar tb, final DrawingEditor editor) {
    // AttributeKeys for the entitie sets
    HashMap<AttributeKey, Object> attributes;

    ResourceBundleUtil drawLabels = ResourceBundleUtil.getBundle("org.jhotdraw.draw.Labels");

    ButtonFactory.addSelectionToolTo(
        tb, editor, ButtonFactory.createDrawingActions(editor), createSelectionActions(editor));
    tb.addSeparator();

    attributes = new HashMap<AttributeKey, Object>();
    attributes.put(AttributeKeys.FILL_COLOR, Color.white);
    attributes.put(AttributeKeys.STROKE_COLOR, Color.black);
    ButtonFactory.addToolTo(
        tb,
        editor,
        new CreationTool(new SVGRectFigure(), attributes),
        "edit.createRectangle",
        drawLabels);
    ButtonFactory.addToolTo(
        tb,
        editor,
        new CreationTool(new SVGEllipseFigure(), attributes),
        "edit.createEllipse",
        drawLabels);
    ButtonFactory.addToolTo(
        tb,
        editor,
        new PathTool(new SVGPathFigure(), new SVGBezierFigure(true), attributes),
        "edit.createPolygon",
        drawLabels);
    attributes = new HashMap<AttributeKey, Object>();
    attributes.put(AttributeKeys.FILL_COLOR, null);
    attributes.put(AttributeKeys.STROKE_COLOR, Color.black);
    ButtonFactory.addToolTo(
        tb,
        editor,
        new CreationTool(new SVGPathFigure(), attributes),
        "edit.createLine",
        drawLabels);
    ButtonFactory.addToolTo(
        tb,
        editor,
        new PathTool(new SVGPathFigure(), new SVGBezierFigure(false), attributes),
        "edit.createScribble",
        drawLabels);
    attributes = new HashMap<AttributeKey, Object>();
    attributes.put(AttributeKeys.FILL_COLOR, Color.black);
    attributes.put(AttributeKeys.STROKE_COLOR, null);
    ButtonFactory.addToolTo(
        tb,
        editor,
        new CreationTool(new SVGTextFigure(), attributes),
        "edit.createText",
        drawLabels);
    TextAreaCreationTool tat = new TextAreaCreationTool(new SVGTextAreaFigure(), attributes);
    tat.setRubberbandColor(Color.BLACK);
    ButtonFactory.addToolTo(tb, editor, tat, "edit.createTextArea", drawLabels);
  }
Ejemplo n.º 11
0
 /** Simple convenience routine for adding a button/icon to a Toolbar */
 public static JButton addTool(JToolBar toolBar, String name) {
   JButton b;
   b = new JButton(new ImageIcon("images/" + name + ".gif", name));
   toolBar.add(b);
   b.setToolTipText(name);
   b.setMargin(new Insets(0, 0, 0, 0));
   b.getAccessibleContext().setAccessibleName(name);
   return b;
 }
Ejemplo n.º 12
0
 /** Installs Shape and Arrow Tools into the toolbar */
 private void initSportTools() {
   for (ShapeTool s : ToolFactory.getShapeTools(sport)) {
     this.installToolInToolBar(toolbar, s);
   }
   toolbar.addSeparator();
   for (ArrowTool a : ToolFactory.getArrowTools(sport)) {
     this.installToolInToolBar(toolbar, a);
   }
 }
Ejemplo n.º 13
0
 // arranges the tool bar
 protected void arrangeToolBar() {
   toolBar.setSize(new Dimension(TOOLBAR_WIDTH, TOOLBAR_HEIGHT));
   toolBar.add(loadButton);
   toolBar.add(saveButton);
   toolBar.addSeparator(separatorDimension);
   toolBar.add(singleStepButton);
   toolBar.add(ffwdButton);
   toolBar.add(stopButton);
   toolBar.add(rewindButton);
   toolBar.addSeparator(separatorDimension);
   toolBar.add(fullTranslationButton);
 }
Ejemplo n.º 14
0
 private JToolBar buildToolBar() {
   // build tool bar
   JToolBar toolBar = new JToolBar("Toolbar");
   toolBar.add(makeToolbarButton("stock_new.png", "New file", "New"));
   toolBar.add(makeToolbarButton("stock_open.png", "Open file", "Open"));
   toolBar.add(makeToolbarButton("stock_save.png", "Save file", "Save"));
   // run button is special
   runButton = makeToolbarButton("Play24.gif", "Run Program", "Run");
   toolBar.add(runButton);
   toolBar.add(makeToolbarButton("stock_text_left.png", "Pretty Print", "Pretty"));
   toolBar.addSeparator();
   toolBar.add(new JButton(copyAction));
   toolBar.add(new JButton(cutAction));
   toolBar.add(new JButton(pasteAction));
   return toolBar;
 }
  protected JToolBar createToolBar() {

    JToolBar jtoolbar = new JToolBar();

    jtoolbar.putClientProperty("JToolBar.isRollover", Boolean.TRUE);

    // ---------------------------------------
    JButton jbuttonClear = new JButton("Clear SQL Statement");

    jbuttonClear.setToolTipText("Clear SQL Statement");
    jbuttonClear.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent actionevent) {
            clear();
          }
        });

    // ---------------------------------------
    JButton jbuttonExecute = new JButton("Execute SQL Statement");

    jbuttonExecute.setToolTipText("Execute SQL Statement");
    jbuttonExecute.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent actionevent) {
            execute();
          }
        });
    jtoolbar.addSeparator();
    jtoolbar.add(jbuttonClear);
    jtoolbar.addSeparator();
    jtoolbar.add(jbuttonExecute);
    jtoolbar.addSeparator();
    jbuttonClear.setAlignmentY(0.5F);
    jbuttonClear.setAlignmentX(0.5F);
    jbuttonExecute.setAlignmentY(0.5F);
    jbuttonExecute.setAlignmentX(0.5F);

    return jtoolbar;
  }
 /** Adds the controls to the toolbar. */
 protected void arrangeToolBar() {
   toolBar.add(loadProgramButton);
   toolBar.addSeparator(separatorDimension);
   toolBar.add(singleStepButton);
   toolBar.add(stepOverButton);
   toolBar.add(ffwdButton);
   toolBar.add(stopButton);
   toolBar.add(rewindButton);
   toolBar.addSeparator(separatorDimension);
   toolBar.add(scriptButton);
   toolBar.add(breakButton);
   toolBar.addSeparator(separatorDimension);
   toolBar.add(speedSlider);
   toolBar.add(animationCombo);
   toolBar.add(additionalDisplayCombo);
   toolBar.add(formatCombo);
 }
Ejemplo n.º 17
0
  public void createGUI() {
    setLayout(new BorderLayout());
    toolBar = new JToolBar("options", JToolBar.HORIZONTAL);
    toolBar.setFloatable(false);
    toolBar.setOpaque(true);
    toolBar.setBackground(new Color(154, 12, 12));
    toolBar.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 15));
    selectAllCB = new JCheckBox("Select All");
    selectAllCB.setVisible(false);
    selectAllCB.setForeground(Color.white);
    selectAllCB.addActionListener(this);
    refreshBut = new JButton(new ImageIcon(this.getClass().getResource("/images/reloadIcon.png")));
    refreshBut.setVisible(false);
    refreshBut.setToolTipText("Refresh");
    refreshBut.setForeground(new Color(20, 88, 49));
    refreshBut.addActionListener(this);
    backBut = new JButton(new ImageIcon(this.getClass().getResource("/images/backIcon.png")));
    backBut.setVisible(false);
    backBut.setToolTipText("Back");
    backBut.setForeground(new Color(20, 88, 49));
    backBut.addActionListener(this);
    deleteBut = new JButton(new ImageIcon(this.getClass().getResource("/images/trashIcon.png")));
    deleteBut.setToolTipText("Delete");
    deleteBut.setForeground(Color.red);
    deleteBut.setVisible(false);
    deleteBut.addActionListener(this);
    deleteBut.setBackground(Color.red);
    restoreBut = new JButton(new ImageIcon(this.getClass().getResource("/images/restoreIcon.png")));
    restoreBut.setToolTipText("Restore");
    restoreBut.setForeground(Color.blue);
    restoreBut.setVisible(false);
    restoreBut.addActionListener(this);
    toolBar.addSeparator(new Dimension(10, 5));
    toolBar.add(selectAllCB);
    toolBar.add(backBut);
    toolBar.add(refreshBut);
    toolBar.add(deleteBut);
    toolBar.add(restoreBut);
    add(toolBar, "North");
    JPanel centPan = new JPanel(new GridBagLayout());
    centPan.setBackground(new Color(52, 86, 70));
    JLabel label = new JLabel("Select A Category From Left Pane");
    label.setFont(new Font("arial", Font.BOLD, 35));
    label.setForeground(Color.yellow);
    centPan.add(label);
    contentPan = new JScrollPane(centPan);
    contentPan.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    add(contentPan, "Center");
    contentPan.repaint();

    db = new Database();
    //        inboxSet = db.getData("SELECT * FROM messages WHERE tag='inbox' ORDER BY msg_id
    // desc");
    //        sentmailSet = db.getData("SELECT * FROM messages WHERE tag='sentmail' ORDER BY msg_id
    // desc");
    //        draftSet = db.getData("SELECT * FROM messages WHERE tag='draft' ORDER BY msg_id
    // desc");
    //        outboxSet = db.getData("SELECT * FROM messages WHERE tag='outbox' ORDER BY msg_id
    // desc");
    //        trashSet = db.getData("SELECT * FROM messages,trash WHERE messages.tag='trash' and
    // messages.msg_id=trash.msg_id ORDER BY deleted_at desc");

  }
Ejemplo n.º 18
0
 /** Shows/Hide Toolbar */
 public void hideToolbar() {
   toolbar.setVisible(!this.toolbar.isVisible());
   tbe.getMenu().setVisibleToolbar(!this.toolbar.isVisible());
 }
Ejemplo n.º 19
0
 /** Shows/Hide Sidebar */
 public void hideSidebar() {
   sideBar.setVisible(!this.sideBar.isVisible());
   tbe.getMenu().setVisibleSidebar(!this.sideBar.isVisible());
 }
Ejemplo n.º 20
0
  /** Construct the TV object - that is, the main GUI for the program */
  public TV(JFrame f, TD mod) {
    super();
    frm = f;
    theTD = mod;
    JButton b;

    // Build the GUI

    toolBar = new JToolBar();
    toolBar.setFloatable(false);
    toolBar.getAccessibleContext().setAccessibleName("File Toolbar");
    toolBar.addSeparator();
    b = addTool(toolBar, "Cut");
    b = addTool(toolBar, "Copy");
    b = addTool(toolBar, "Paste");
    toolBar.addSeparator();
    toolBar.putClientProperty("JToolBar.isRollover", Boolean.FALSE);

    // The Slider
    numSlider = new JSlider(JSlider.HORIZONTAL, 1, 40, 1);
    numSlider.setPaintTicks(true);
    numSlider.setPaintLabels(false);
    numSlider.setMajorTickSpacing(10);
    numSlider.setMinorTickSpacing(2);
    numSlider.setExtent(1);
    numSlider.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent ce) {
            // System.out.println("CHANGE: " + ce);
            setQNumber(((JSlider) (ce.getSource())).getValue());
          }
        });
    numSlider.setToolTipText("Slide to select question by number");
    toolBar.add(numSlider);

    // The Question# textfield
    toolBar.add(numTF = new JTextField("01"));
    numTF.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String num = ((JTextField) e.getSource()).getText();
            int n = Integer.parseInt(num.trim());
            setQNumber(n);
          }
        });
    numTF.setToolTipText("Type number to select question by number");

    // The First Button
    b = addTool(toolBar, "First");
    b.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            setQNumber(1);
          }
        });

    // The Previous Button
    b = addTool(toolBar, "Previous");
    b.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (getQNumber() <= 1) return;
            setQNumber(getQNumber() - 1);
          }
        });

    // The Next Button
    b = addTool(toolBar, "Next");
    b.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (getQNumber() >= getNumQuestions()) return;
            setQNumber(getQNumber() + 1);
          }
        });

    // The "Last" Button
    b = addTool(toolBar, "Last");
    b.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            setQNumber(getNumQuestions());
          }
        });

    add(BorderLayout.NORTH, toolBar);

    // Rest is a panel to hold the questions, one at a time.
    questionsPanel = new JPanel();
    questionsPanel.setLayout(myCardLayout = new CardLayout());

    add(BorderLayout.SOUTH, questionsPanel);

    fc = new FileDialog(frm);
    fc.setFilenameFilter(
        new FilenameFilter() {
          public boolean accept(File ff, String fname) {
            // System.out.println("accept("+fname+")");
            // XXX TODO list of extentions, from properties.
            return fname.endsWith(".xam");
          }
        });
    TV.centre(fc);
  }
Ejemplo n.º 21
0
  /** Install the Rotate-Button into the toolbar */
  private void installRotateButton() {
    URL imgURL = ClassLoader.getSystemResource("ch/tbe/pics/rotate.gif");
    ImageIcon rotateIcon = new ImageIcon(imgURL);
    rotate = new JButton(rotateIcon);
    rotate.setEnabled(false);
    rotatePanel = new JToolBar();
    rotatePanel.setOrientation(1);
    rotatePanel.setLayout(new BorderLayout(0, 1));
    rotateSlider = new JSlider();
    rotateSlider.setMaximum(359);
    rotateSlider.setMinimum(0);
    rotateSlider.setMaximumSize(new Dimension(100, 100));
    rotateSlider.setOrientation(1);
    Box box = Box.createVerticalBox();

    sliderValue.setPreferredSize(new Dimension(30, 20));

    rotateSlider.setAlignmentY(Component.TOP_ALIGNMENT);
    box.add(sliderValue);
    box.add(rotateSlider);
    sliderValue.setAlignmentY(Component.TOP_ALIGNMENT);
    rotatePanel.add(box, BorderLayout.NORTH);

    sliderValue.addFocusListener(
        new FocusListener() {

          private int oldValue = 0;

          public void focusGained(FocusEvent arg0) {
            oldValue = Integer.parseInt(sliderValue.getText());
          }

          public void focusLost(FocusEvent arg0) {
            int newValue = 0;
            try {
              newValue = Integer.parseInt(sliderValue.getText());
            } catch (Exception ex) {
              sliderValue.setText(Integer.toString(oldValue));
            }
            if (newValue >= 0 && newValue <= 359) {

              RotateCommand rc = new RotateCommand(board.getSelectedItems());
              ArrayList<Command> actCommands = new ArrayList<Command>();
              actCommands.add(rc);
              TBE.getInstance().addCommands(actCommands);
              rotateSlider.setValue(newValue);
            } else {
              sliderValue.setText(Integer.toString(oldValue));
            }
          }
        });

    rotateSlider.addChangeListener(
        new ChangeListener() {

          public void stateChanged(ChangeEvent arg0) {

            if (board.getSelectionCount() == 1
                && board.getSelectionCells()[0] instanceof ShapeItem) {
              sliderValue.setText(Integer.toString(rotateSlider.getValue()));
              ShapeItem s = (ShapeItem) board.getSelectionCells()[0];
              board.removeItem(new ItemComponent[] {s});
              s.setRotation(rotateSlider.getValue());
              board.addItem(s);
            }
          }
        });
    rotateSlider.addMouseListener(
        new MouseAdapter() {

          private int value;

          public void mousePressed(MouseEvent e) {
            value = rotateSlider.getValue();
          }

          public void mouseReleased(MouseEvent e) {
            if (value != rotateSlider.getValue()) {
              RotateCommand rc = new RotateCommand(board.getSelectedItems());
              ArrayList<Command> actCommands = new ArrayList<Command>();
              actCommands.add(rc);
              TBE.getInstance().addCommands(actCommands);
              rc.setRotation(value);
            }
          }
        });

    rotate.setToolTipText(workingViewLabels.getString("rotate"));

    rotate.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (board.getSelectionCount() == 1
                && board.getSelectedItems()[0] instanceof ShapeItem) {
              rotateSlider.setValue(((ShapeItem) board.getSelectedItems()[0]).getRotation());
            }
            rotatePanel.setVisible(!rotatePanel.isVisible());
            showRotate = !showRotate;
          }
        });

    rotate.setContentAreaFilled(false);
    rotate.setBorderPainted(false);
    toolbar.add(rotate);
    rotatePanel.setVisible(false);
    this.add(rotatePanel, BorderLayout.EAST);
  }
Ejemplo n.º 22
0
  public MainWindow() {
    JMenuItem showTextItem, showContentItem, showStatsItem;
    JMenuItem consoleWinItem, treeWinItem, traceWinItem;

    // our libgist execution thread
    opThread = new OpThread(this);
    Libgist.setBreakHandler(opThread);
    opThread.start();
    cmd = new LibgistCommand();

    menuBar = new JMenuBar();
    setJMenuBar(menuBar);

    // create toolbar and console window with text area

    getContentPane().removeAll();
    getContentPane().setLayout(new BorderLayout());
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());

    // desktop pane + console frame
    desktop = new JDesktopPane();
    desktop.setOpaque(true);
    desktop.setBackground(Color.lightGray);
    consoleFrame = new ConsoleWindow(200, desktop);
    desktop.add(consoleFrame, JLayeredPane.PALETTE_LAYER);

    // debugging actions for toolbar:
    // notify opThread of what to do when it hits a breakpoint
    stepAction =
        new AbstractAction("Step") {
          public void actionPerformed(ActionEvent e) {
            opThread.step();
          }
        };
    cancelAction =
        new AbstractAction("Cancel") {
          public void actionPerformed(ActionEvent e) {
            scriptWasCancelled = true; // don't call it after next line!
            opThread.cancel();
          }
        };
    nextAction =
        new AbstractAction("Next") {
          public void actionPerformed(ActionEvent e) {
            opThread.next();
          }
        };
    contAction =
        new AbstractAction("Continue") {
          public void actionPerformed(ActionEvent e) {
            opThread.cont();
          }
        };

    // opThread is currently executing a script and we want it to stop:
    // tell libgist directly to suspend execution once opThread is done
    // with the current operation
    stopAction =
        new AbstractAction("Stop") {
          public void actionPerformed(ActionEvent e) {
            Libgist.singleStep();
          }
        };

    // toolbar
    JToolBar toolbar = new JToolBar();
    toolbar.add(stepAction).setText("Step");
    toolbar.add(nextAction).setText("Next");
    toolbar.add(contAction).setText("Continue");
    toolbar.add(stopAction).setText("Stop");
    toolbar.add(cancelAction).setText("Cancel");

    panel.add(toolbar, BorderLayout.NORTH);
    panel.add(desktop, BorderLayout.CENTER);
    getContentPane().add(panel);

    createFileMenu();
    createOpsMenu();
    createDebugMenu();
    createTreeStatsMenu();
    createAnalysisMenu();
    createWindowsMenu();

    setGuiState(INITSTATE); // nothing opened yet

    // addWindowListener(this); // So we do the right thing on window closing.
  }
Ejemplo n.º 23
0
 /**
  * Creates the tools. By default only the selection tool is added. Override this method to add
  * additional tools. Call the inherited method to include the selection tool.
  *
  * @param palette the palette where the tools are added.
  */
 protected void createTools(JToolBar palette) {
   Tool tool = createSelectionTool();
   fDefaultToolButton = createToolButton(IMAGES + "SEL", "Selection Tool", tool);
   palette.add(fDefaultToolButton);
 }
  public void addDefaultCreationButtonsTo(
      JToolBar tb,
      final DrawingEditor editor,
      Collection<Action> drawingActions,
      Collection<Action> selectionActions) {
    ResourceBundleUtil labels = ResourceBundleUtil.getBundle("org.jhotdraw.draw.Labels");

    ButtonFactory.addSelectionToolTo(tb, editor, drawingActions, selectionActions);
    tb.addSeparator();

    AbstractAttributedFigure af;
    CreationTool ct;
    ConnectionTool cnt;
    ConnectionFigure lc;

    ButtonFactory.addToolTo(
        tb, editor, new CreationTool(new RectangleFigure()), "edit.createRectangle", labels);
    ButtonFactory.addToolTo(
        tb,
        editor,
        new CreationTool(new RoundRectangleFigure()),
        "edit.createRoundRectangle",
        labels);
    ButtonFactory.addToolTo(
        tb, editor, new CreationTool(new EllipseFigure()), "edit.createEllipse", labels);
    ButtonFactory.addToolTo(
        tb, editor, new CreationTool(new DiamondFigure()), "edit.createDiamond", labels);
    ButtonFactory.addToolTo(
        tb, editor, new CreationTool(new TriangleFigure()), "edit.createTriangle", labels);
    ButtonFactory.addToolTo(
        tb, editor, new CreationTool(new LineFigure()), "edit.createLine", labels);
    ButtonFactory.addToolTo(
        tb, editor, ct = new CreationTool(new LineFigure()), "edit.createArrow", labels);
    af = (AbstractAttributedFigure) ct.getPrototype();
    af.set(END_DECORATION, new ArrowTip(0.35, 12, 11.3));
    ButtonFactory.addToolTo(
        tb,
        editor,
        new ConnectionTool(new LineConnectionFigure()),
        "edit.createLineConnection",
        labels);
    ButtonFactory.addToolTo(
        tb,
        editor,
        cnt = new ConnectionTool(new LineConnectionFigure()),
        "edit.createElbowConnection",
        labels);
    lc = cnt.getPrototype();
    lc.setLiner(new ElbowLiner());
    ButtonFactory.addToolTo(
        tb,
        editor,
        cnt = new ConnectionTool(new LineConnectionFigure()),
        "edit.createCurvedConnection",
        labels);
    lc = cnt.getPrototype();
    lc.setLiner(new CurvedLiner());
    ButtonFactory.addToolTo(
        tb, editor, new BezierTool(new BezierFigure()), "edit.createScribble", labels);
    ButtonFactory.addToolTo(
        tb, editor, new BezierTool(new BezierFigure(true)), "edit.createPolygon", labels);
    ButtonFactory.addToolTo(
        tb, editor, new TextCreationTool(new TextFigure()), "edit.createText", labels);
    ButtonFactory.addToolTo(
        tb, editor, new TextAreaCreationTool(new TextAreaFigure()), "edit.createTextArea", labels);
    ButtonFactory.addToolTo(
        tb, editor, new ImageTool(new ImageFigure()), "edit.createImage", labels);
  }
  // Initializes this component.
  private void jbInit() {
    fileChooser.setFileFilter(new ScriptFileFilter());
    this.getContentPane().setLayout(null);

    Hashtable<Integer, JLabel> labelTable = new Hashtable<Integer, JLabel>();

    JLabel slowLabel = new JLabel("Slow");
    slowLabel.setFont(Utilities.thinLabelsFont);
    JLabel fastLabel = new JLabel("Fast");
    fastLabel.setFont(Utilities.thinLabelsFont);
    labelTable.put(1, slowLabel);
    labelTable.put(5, fastLabel);

    speedSlider.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            SpeedSlider_stateChanged(e);
          }
        });
    speedSlider.setLabelTable(labelTable);
    speedSlider.setMajorTickSpacing(1);
    speedSlider.setPaintTicks(true);
    speedSlider.setPaintLabels(true);
    speedSlider.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
    speedSlider.setPreferredSize(new Dimension(95, 50));
    speedSlider.setMinimumSize(new Dimension(95, 50));
    speedSlider.setToolTipText("Speed");
    speedSlider.setMaximumSize(new Dimension(95, 50));

    final Dimension buttonSize = new Dimension(39, 39);

    loadProgramButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            loadProgramButton_actionPerformed();
          }
        });
    loadProgramButton.setMaximumSize(buttonSize);
    loadProgramButton.setMinimumSize(buttonSize);
    loadProgramButton.setPreferredSize(buttonSize);
    loadProgramButton.setSize(buttonSize);
    loadProgramButton.setToolTipText("Load Program");
    loadProgramButton.setIcon(loadProgramIcon);

    ffwdButton.setMaximumSize(buttonSize);
    ffwdButton.setMinimumSize(buttonSize);
    ffwdButton.setPreferredSize(buttonSize);
    ffwdButton.setToolTipText("Run");
    ffwdButton.setIcon(ffwdIcon);
    ffwdButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            ffwdButton_actionPerformed();
          }
        });

    stopButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            stopButton_actionPerformed();
          }
        });
    stopButton.setMaximumSize(buttonSize);
    stopButton.setMinimumSize(buttonSize);
    stopButton.setPreferredSize(buttonSize);
    stopButton.setToolTipText("Stop");
    stopButton.setIcon(stopIcon);

    rewindButton.setMaximumSize(buttonSize);
    rewindButton.setMinimumSize(buttonSize);
    rewindButton.setPreferredSize(buttonSize);
    rewindButton.setToolTipText("Reset");
    rewindButton.setIcon(rewindIcon);
    rewindButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            rewindButton_actionPerformed();
          }
        });

    scriptButton.setMaximumSize(buttonSize);
    scriptButton.setMinimumSize(buttonSize);
    scriptButton.setPreferredSize(buttonSize);
    scriptButton.setToolTipText("Load Script");
    scriptButton.setIcon(scriptIcon);
    scriptButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            scriptButton_actionPerformed();
          }
        });

    breakButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            breakButton_actionPerformed();
          }
        });
    breakButton.setMaximumSize(buttonSize);
    breakButton.setMinimumSize(buttonSize);
    breakButton.setPreferredSize(buttonSize);
    breakButton.setToolTipText("Open breakpoint panel");
    breakButton.setIcon(breakIcon);

    breakpointWindow.addBreakpointListener(this);

    singleStepButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            singleStepButton_actionPerformed();
          }
        });
    singleStepButton.setMaximumSize(buttonSize);
    singleStepButton.setMinimumSize(buttonSize);
    singleStepButton.setPreferredSize(buttonSize);
    singleStepButton.setSize(buttonSize);
    singleStepButton.setToolTipText("Single Step");
    singleStepButton.setIcon(singleStepIcon);

    stepOverButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            stepOverButton_actionPerformed();
          }
        });
    stepOverButton.setMaximumSize(buttonSize);
    stepOverButton.setMinimumSize(buttonSize);
    stepOverButton.setPreferredSize(buttonSize);
    stepOverButton.setSize(buttonSize);
    stepOverButton.setToolTipText("Step Over");
    stepOverButton.setIcon(stepOverIcon);

    animationCombo.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            animationCombo_actionPerformed();
          }
        });

    formatCombo.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            formatCombo_actionPerformed();
          }
        });

    additionalDisplayCombo.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            additionalDisplayCombo_actionPerformed();
          }
        });

    messageLbl.setFont(Utilities.statusLineFont);
    messageLbl.setBorder(BorderFactory.createLoweredBevelBorder());
    messageLbl.setBounds(new Rectangle(0, 667, CONTROLLER_WIDTH - 8, 25));

    toolBar = new JToolBar();
    toolBar.setSize(new Dimension(TOOLBAR_WIDTH, TOOLBAR_HEIGHT));
    toolBar.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 0));
    toolBar.setFloatable(false);
    toolBar.setLocation(0, 0);
    toolBar.setBorder(BorderFactory.createEtchedBorder());
    arrangeToolBar();
    this.getContentPane().add(toolBar, null);
    toolBar.revalidate();
    toolBar.repaint();
    repaint();

    // Creating the menu bar
    menuBar = new JMenuBar();
    arrangeMenu();
    setJMenuBar(menuBar);

    this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    this.getContentPane().add(messageLbl, null);

    setControllerSize();

    // sets the frame to be visible.
    setVisible(true);
  }
Ejemplo n.º 26
0
  public static JToolBar getToolbar(String label, int size, boolean hasStrings) {
    JToolBar toolBar = new JToolBar();

    JButton buttonCut = new JButton(hasStrings ? "cut" : null, getIcon(size + "/edit-cut"));
    buttonCut.putClientProperty(SubstanceLookAndFeel.BUTTON_NO_MIN_SIZE_PROPERTY, Boolean.TRUE);
    toolBar.add(buttonCut);
    JButton buttonCopy = new JButton(hasStrings ? "copy" : null, getIcon(size + "/edit-copy"));
    buttonCopy.putClientProperty(SubstanceLookAndFeel.BUTTON_NO_MIN_SIZE_PROPERTY, Boolean.TRUE);
    buttonCopy.setEnabled(false);
    toolBar.add(buttonCopy);
    JButton buttonPaste = new JButton(getIcon(size + "/edit-paste"));
    toolBar.add(buttonPaste);
    JButton buttonSelectAll = new JButton(getIcon(size + "/edit-select-all"));
    toolBar.add(buttonSelectAll);
    JButton buttonDelete = new JButton(getIcon(size + "/edit-delete"));
    toolBar.add(buttonDelete);
    toolBar.addSeparator();

    // add an inner toolbar to check the painting of toolbar
    // gradient and drop shadows under different skins.
    JToolBar innerToolbar = new JToolBar(JToolBar.HORIZONTAL);
    innerToolbar.setFloatable(false);
    JToggleButton buttonFormatCenter = new JToggleButton(getIcon(size + "/format-justify-center"));
    buttonFormatCenter.putClientProperty(SubstanceLookAndFeel.CORNER_RADIUS, 5.0f);
    innerToolbar.add(buttonFormatCenter);
    JToggleButton buttonFormatLeft = new JToggleButton(getIcon(size + "/format-justify-left"));
    innerToolbar.add(buttonFormatLeft);
    JToggleButton buttonFormatRight = new JToggleButton(getIcon(size + "/format-justify-right"));
    innerToolbar.add(buttonFormatRight);
    JToggleButton buttonFormatFill = new JToggleButton(getIcon(size + "/format-justify-fill"));
    buttonFormatFill.putClientProperty(SubstanceLookAndFeel.CORNER_RADIUS, 0.0f);
    innerToolbar.add(buttonFormatFill);

    toolBar.add(innerToolbar);
    toolBar.addSeparator();

    if (size > 20) {
      JToolBar innerToolbar2 = new JToolBar(JToolBar.HORIZONTAL);
      innerToolbar2.setFloatable(false);

      JPanel innerPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
      innerToolbar2.add(innerPanel, BorderLayout.CENTER);

      final JToggleButton buttonStyleBold = new JToggleButton(getIcon(size + "/format-text-bold"));
      Set<Side> rightSide = EnumSet.of(Side.RIGHT);
      buttonStyleBold.putClientProperty(SubstanceLookAndFeel.BUTTON_OPEN_SIDE_PROPERTY, rightSide);
      buttonStyleBold.putClientProperty(SubstanceLookAndFeel.CORNER_RADIUS, 3.0f);

      final JToggleButton buttonStyleItalic =
          new JToggleButton(getIcon(size + "/format-text-italic"));
      buttonStyleItalic.putClientProperty(SubstanceLookAndFeel.CORNER_RADIUS, 0.0f);
      buttonStyleItalic.putClientProperty(
          SubstanceLookAndFeel.BUTTON_OPEN_SIDE_PROPERTY, rightSide);

      final JToggleButton buttonStyleUnderline =
          new JToggleButton(getIcon(size + "/format-text-underline"));
      buttonStyleUnderline.putClientProperty(SubstanceLookAndFeel.CORNER_RADIUS, 0.0f);
      buttonStyleUnderline.putClientProperty(
          SubstanceLookAndFeel.BUTTON_OPEN_SIDE_PROPERTY, rightSide);

      final JToggleButton buttonStyleStrikethrough =
          new JToggleButton(getIcon(size + "/format-text-strikethrough"));
      buttonStyleStrikethrough.putClientProperty(
          SubstanceLookAndFeel.BUTTON_SIDE_PROPERTY, EnumSet.of(Side.LEFT));
      buttonStyleStrikethrough.putClientProperty(SubstanceLookAndFeel.CORNER_RADIUS, 3.0f);
      buttonStyleBold.setSelected(true);

      innerPanel.add(buttonStyleBold);
      innerPanel.add(buttonStyleItalic);
      innerPanel.add(buttonStyleUnderline);
      innerPanel.add(buttonStyleStrikethrough);

      toolBar.add(innerToolbar2);
    }

    toolBar.add(Box.createGlue());
    JButton buttonExit = new JButton(getIcon(size + "/process-stop"));
    buttonExit.setToolTipText("Closes the test application");
    buttonExit.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            System.exit(0);
          }
        });
    toolBar.add(buttonExit);

    return toolBar;
  }
Ejemplo n.º 27
0
  /**
   * Constructs a simple frame with the specified world and orientation.
   *
   * @param world the world view.
   * @param ao the axes orientation.
   */
  public RSFFrame(World world, AxesOrientation ao) {
    super(new PlotPanel());
    if (world == null) world = new World();
    if (ao == null) ao = AxesOrientation.XRIGHT_YOUT_ZDOWN;
    _world = world;
    _view = new OrbitView(_world);
    _view.setAxesOrientation(ao);
    _canvas = new ViewCanvas();
    _canvas.setView(_view);
    _canvas.setBackground(Color.WHITE);

    _points = new ArrayList<PointGroup>();
    _lines = new ArrayList<LineGroup>();

    _d = null;
    _tpx = null;
    _tpy = null;
    _ipg = null;

    _etc = null;
    _coord = null;

    ModeManager mm = new ModeManager();
    mm.add(_canvas);
    OrbitViewMode ovm = new OrbitViewMode(mm);
    SelectDragMode sdm = new SelectDragMode(mm);

    JPopupMenu.setDefaultLightWeightPopupEnabled(false);
    ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);

    JMenu fileMenu = new JMenu("File");
    fileMenu.setMnemonic('F');
    Action exitAction =
        new AbstractAction("Exit") {
          public void actionPerformed(ActionEvent event) {
            System.exit(0);
          }
        };

    Action cubeAction =
        new AbstractAction("Add Cube") {
          public void actionPerformed(ActionEvent event) {
            String filename = chooseFile(".");
            if (filename != null) addRSFCube(filename);
          }
        };

    Action lineAction =
        new AbstractAction("Add Line") {
          public void actionPerformed(ActionEvent event) {
            String filename = chooseFile(".");
            if (filename != null) addRSFLine(filename);
          }
        };

    Action pointAction =
        new AbstractAction("Add Points") {
          public void actionPerformed(ActionEvent event) {
            String filename = chooseFile(".");
            if (filename != null) addRSFPoint(filename);
          }
        };

    Action loadViewAction =
        new AbstractAction("Load Viewpoint") {
          public void actionPerformed(ActionEvent event) {
            String filename = chooseFile(".");
            if (filename != null) loadView(filename);
          }
        };

    Action saveViewAction =
        new AbstractAction("Save Viewpoint") {
          public void actionPerformed(ActionEvent event) {
            JFileChooser chooser = new JFileChooser(new File("."));
            int returnVal = chooser.showSaveDialog(new JFrame());
            String filename = null;
            if (returnVal == JFileChooser.APPROVE_OPTION) {
              filename = chooser.getSelectedFile().getPath();
              saveView(filename);
            }
          }
        };

    Action saveFrameAction =
        new AbstractAction("Save to PNG") {
          public void actionPerformed(ActionEvent event) {
            JFileChooser chooser = new JFileChooser(new File("."));
            int returnVal = chooser.showSaveDialog(new JFrame());
            String filename = null;
            if (returnVal == JFileChooser.APPROVE_OPTION) {
              filename = chooser.getSelectedFile().getPath();
              saveFrametoPNG(filename);
            }
          }
        };

    JMenuItem cubeItem = fileMenu.add(cubeAction);
    cubeItem.setMnemonic('C');

    JMenuItem lineItem = fileMenu.add(lineAction);
    lineItem.setMnemonic('L');

    JMenuItem pointItem = fileMenu.add(pointAction);
    pointItem.setMnemonic('P');

    JMenuItem saveViewItem = fileMenu.add(saveViewAction);
    saveViewItem.setMnemonic('V');

    JMenuItem loadViewItem = fileMenu.add(loadViewAction);
    loadViewItem.setMnemonic('I');

    JMenuItem saveFrameItem = fileMenu.add(saveFrameAction);
    saveFrameItem.setMnemonic('S');

    JMenuItem exitItem = fileMenu.add(exitAction);
    exitItem.setMnemonic('X');

    JMenu colorMenu = new JMenu("Color");

    Action jetAction =
        new AbstractAction("Jet") {
          public void actionPerformed(ActionEvent event) {
            _color = ColorList.JET;
            setColorMap();
          }
        };

    Action prismAction =
        new AbstractAction("Prism") {
          public void actionPerformed(ActionEvent event) {
            _color = ColorList.PRISM;
            setColorMap();
          }
        };

    Action grayAction =
        new AbstractAction("Gray") {
          public void actionPerformed(ActionEvent event) {
            _color = ColorList.GRAY;
            setColorMap();
          }
        };

    Action rwbAction =
        new AbstractAction("Red-White-Blue") {
          public void actionPerformed(ActionEvent event) {
            _color = ColorList.RWB;
            setColorMap();
          }
        };

    colorMenu.add(jetAction);
    colorMenu.add(prismAction);
    colorMenu.add(grayAction);
    colorMenu.add(rwbAction);

    JMenu clipMenu = new JMenu("% Clip");
    Action clipUp =
        new AbstractAction("Set max pclip") {
          public void actionPerformed(ActionEvent event) {
            String value =
                JOptionPane.showInputDialog(new JFrame(), "Percentile Clip Max (0-100.0):", _pmax);
            try {
              _pmax = Float.parseFloat(value);
              if (_pmax > 100.0f) _pmax = 100.0f;
              if (_pmax < _pmin) _pmax = _pmin + 1.0f;
              System.out.printf("pclip: (%f,%f) \n", _pmin, _pmax);
              _ipg.setPercentiles(_pmin, _pmax);

            } catch (Exception e) {
              System.out.println(e);
            }
          }
        };
    Action clipDown =
        new AbstractAction("Set min pclip") {
          public void actionPerformed(ActionEvent event) {
            String value =
                JOptionPane.showInputDialog(
                    new JFrame(), String.format("Percentile Clip Min (0-%f):", _pmax), _pmin);
            try {
              _pmin = Float.parseFloat(value);
              if (_pmin < 0.0f) _pmin = 0.0f;
              if (_pmin > _pmax) _pmin = _pmax - 1.0f;
              System.out.printf("pclip: (%f,%f) \n", _pmin, _pmax);
              _ipg.setPercentiles(_pmin, _pmax);

            } catch (Exception e) {
              System.out.println(e);
            }
          }
        };

    clipMenu.add(clipUp);
    clipMenu.add(clipDown);

    JMenu modeMenu = new JMenu("Mode");
    modeMenu.setMnemonic('M');
    JMenuItem ovmItem = new JMenuItem(ovm);
    modeMenu.add(ovmItem);
    JMenuItem sdmItem = new JMenuItem(sdm);
    modeMenu.add(sdmItem);

    JMenu tensorMenu = new JMenu("Tensor");

    Action tenLoadAction =
        new AbstractAction("Load Tensors") {
          public void actionPerformed(ActionEvent event) {
            String filename = chooseFile(".");
            if (filename != null) loadTensors(filename);
          }
        };

    Action tenCoordLoadAction =
        new AbstractAction("Load Tensor Coordinates") {
          public void actionPerformed(ActionEvent event) {
            String filename = chooseFile(".");
            if (filename != null) loadTensorCoords(filename);
          }
        };

    Action showTenAction =
        new AbstractAction("Show Tensors at Coordinates") {
          public void actionPerformed(ActionEvent event) {

            String filename;
            int sel;

            if (_ipg == null) {
              sel =
                  JOptionPane.showConfirmDialog(
                      null,
                      "An RSF Cube (Image) needs to be loaded. " + " Would you like to load one?",
                      "Notice",
                      JOptionPane.OK_CANCEL_OPTION,
                      JOptionPane.QUESTION_MESSAGE);
              if (sel == JOptionPane.OK_OPTION) {
                filename = chooseFile(".");
                if (filename != null) addRSFCube(filename);
              } else {
                JOptionPane.showConfirmDialog(
                    null,
                    "Cannot load tensors because an RFC cube was not loaded.",
                    "Error",
                    JOptionPane.DEFAULT_OPTION,
                    JOptionPane.ERROR_MESSAGE);
                return;
              }
            }
            if (_coord == null) {
              sel =
                  JOptionPane.showConfirmDialog(
                      null,
                      "The tensors coordinates need to be loaded. "
                          + " Would you like to load them?",
                      "Notice",
                      JOptionPane.OK_CANCEL_OPTION,
                      JOptionPane.QUESTION_MESSAGE);
              if (sel == JOptionPane.OK_OPTION) {
                filename = chooseFile(".");
                if (filename != null) loadCoord(filename);
              } else {
                JOptionPane.showConfirmDialog(
                    null,
                    "Error loading coordinates.",
                    "Error",
                    JOptionPane.DEFAULT_OPTION,
                    JOptionPane.ERROR_MESSAGE);
                return;
              }
            }
            if (_etc == null) {
              sel =
                  JOptionPane.showConfirmDialog(
                      null,
                      "The tensors at coordinates need to be loaded. "
                          + " Would you like to load them?",
                      "Notice",
                      JOptionPane.OK_CANCEL_OPTION,
                      JOptionPane.QUESTION_MESSAGE);
              if (sel == JOptionPane.OK_OPTION) {
                filename = chooseFile(".");
                if (filename != null) loadTensorCoords(filename);
                return;
              } else {
                JOptionPane.showConfirmDialog(
                    null,
                    "Cannot show tensors because the tensors at coordinates" + " were not loaded.",
                    "Error",
                    JOptionPane.DEFAULT_OPTION,
                    JOptionPane.ERROR_MESSAGE);
                return;
              }
            }
            /*
            if(_d == null) {
            	sel = JOptionPane.showConfirmDialog(null,
            						"The tensors need to be loaded. "
            						+ " Would you like to load them?",
            						"Notice",
            						JOptionPane.OK_CANCEL_OPTION,
            						JOptionPane.QUESTION_MESSAGE);
            	if(sel == JOptionPane.OK_OPTION) {
            		filename = chooseFile(".");
            		if (filename != null) loadTensors(filename);
            	} else {
            		JOptionPane.showConfirmDialog(null,
            				"Cannot show tensors because the tensors were not loaded.",
            				"Error",
            				JOptionPane.DEFAULT_OPTION,
            				JOptionPane.ERROR_MESSAGE);
            		return;
            	}
            }
            if(_etg == null) {
            	sel = JOptionPane.showConfirmDialog(null,
            						"The tensor coordinates need to be loaded. "
            						+ " Would you like to load them?",
            						"Notice",
            						JOptionPane.OK_CANCEL_OPTION,
            						JOptionPane.QUESTION_MESSAGE);
            	if(sel == JOptionPane.OK_OPTION) {
            		filename = chooseFile(".");
            		if (filename != null) loadTensorCoords(filename);
            		return;
            	} else {
            		JOptionPane.showConfirmDialog(null,
            				"Cannot show tensors because the tensor coordinates"
            				+ " were not loaded.",
            				"Error",
            				JOptionPane.DEFAULT_OPTION,
            				JOptionPane.ERROR_MESSAGE);
            		return;
            	}
            }
            */
            _world.addChild(_etg);
          }
        };

    Action hideTenAction =
        new AbstractAction("Hide Tensors at Coordinates") {
          public void actionPerformed(ActionEvent event) {
            if (_etg != null) _world.removeChild(_etg);
          }
        };

    Action showTenPanAction =
        new AbstractAction("Show Tensor Panels") {
          public void actionPerformed(ActionEvent event) {

            String filename;
            int sel;
            if (_ipg == null) {
              sel =
                  JOptionPane.showConfirmDialog(
                      null,
                      "An RSF Cube (Image) needs to be loaded. " + " Would you like to load one?",
                      "Notice",
                      JOptionPane.OK_CANCEL_OPTION,
                      JOptionPane.QUESTION_MESSAGE);
              if (sel == JOptionPane.OK_OPTION) {
                filename = chooseFile(".");
                if (filename != null) addRSFCube(filename);
              } else {
                JOptionPane.showConfirmDialog(
                    null,
                    "Cannot load tensors because an RFC cube was not loaded.",
                    "Error",
                    JOptionPane.DEFAULT_OPTION,
                    JOptionPane.ERROR_MESSAGE);
                return;
              }
            }

            if (_d == null) {
              sel =
                  JOptionPane.showConfirmDialog(
                      null,
                      "The tensors need to be loaded. " + " Would you like to load them?",
                      "Notice",
                      JOptionPane.OK_CANCEL_OPTION,
                      JOptionPane.QUESTION_MESSAGE);
              if (sel == JOptionPane.OK_OPTION) {
                filename = chooseFile(".");
                if (filename != null) loadTensors(filename);
                addRSFTensorEllipsoids();
              } else {
                JOptionPane.showConfirmDialog(
                    null,
                    "Cannot show tensors because the tensors were not loaded.",
                    "Error",
                    JOptionPane.DEFAULT_OPTION,
                    JOptionPane.ERROR_MESSAGE);
                return;
              }
            } else if (_tpx == null || _tpy == null) {
              addRSFTensorEllipsoids();
            } else {
              ImagePanel ipx = _ipg.getImagePanel(Axis.X);
              ImagePanel ipy = _ipg.getImagePanel(Axis.Y);
              ipx.getFrame().addChild(_tpx);
              ipy.getFrame().addChild(_tpy);
            }
          }
        };

    Action hideTenPanAction =
        new AbstractAction("Hide Tensor Panels") {
          public void actionPerformed(ActionEvent event) {
            if (_tpx != null) {
              ImagePanel ipx = _ipg.getImagePanel(Axis.X);
              ipx.getFrame().removeChild(_tpx);
            }
            if (_tpy != null) {
              ImagePanel ipy = _ipg.getImagePanel(Axis.Y);
              ipy.getFrame().removeChild(_tpy);
            }
          }
        };

    JMenuItem tensorItem0 = tensorMenu.add(tenLoadAction);
    tensorItem0.setMnemonic('L');

    JMenuItem tensorItem2 = tensorMenu.add(tenCoordLoadAction);
    tensorItem2.setMnemonic('C');

    JMenuItem tensorItem1 = tensorMenu.add(showTenPanAction);
    tensorItem1.setMnemonic('T');

    JMenuItem tensorItem5 = tensorMenu.add(hideTenPanAction);
    tensorItem5.setMnemonic('R');

    JMenuItem tensorItem4 = tensorMenu.add(showTenAction);
    tensorItem4.setMnemonic('S');

    JMenuItem tensorItem3 = tensorMenu.add(hideTenAction);
    tensorItem3.setMnemonic('H');

    JMenuBar menuBar = new JMenuBar();
    menuBar.add(fileMenu);
    menuBar.add(modeMenu);
    menuBar.add(tensorMenu);
    menuBar.add(colorMenu);
    menuBar.add(clipMenu);

    JToolBar toolBar = new JToolBar(SwingConstants.VERTICAL);
    toolBar.setRollover(true);
    JToggleButton ovmButton = new ModeToggleButton(ovm);
    toolBar.add(ovmButton);
    JToggleButton sdmButton = new ModeToggleButton(sdm);
    toolBar.add(sdmButton);

    _cb = new ColorBar();
    _cb.setWidthMinimum(45);
    _cb.setFont(_cb.getFont().deriveFont(18.f));
    // _ipg.addColorMapListener(_cb);

    ovm.setActive(true);

    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setSize(new Dimension(SIZE, SIZE));
    this.add(_canvas, BorderLayout.CENTER);
    this.add(toolBar, BorderLayout.WEST);
    this.add(_cb, BorderLayout.EAST);
    this.setJMenuBar(menuBar);
    this.setVisible(true);
  }
Ejemplo n.º 28
0
  protected void createTools(JToolBar palette) {
    super.createTools(palette);

    Tool tool = new UndoableTool(new TextTool(this, new TextFigure()));
    palette.add(createToolButton(IMAGES + "TEXT", "Text Tool", tool));

    tool = new UndoableTool(new ConnectedTextTool(this, new TextFigure()));
    palette.add(createToolButton(IMAGES + "ATEXT", "Connected Text Tool", tool));

    tool = new URLTool(this);
    palette.add(createToolButton(IMAGES + "URL", "URL Tool", tool));

    tool = new UndoableTool(new CreationTool(this, new RectangleFigure()));
    palette.add(createToolButton(IMAGES + "RECT", "Rectangle Tool", tool));

    tool = new UndoableTool(new CreationTool(this, new RoundRectangleFigure()));
    palette.add(createToolButton(IMAGES + "RRECT", "Round Rectangle Tool", tool));

    tool = new UndoableTool(new CreationTool(this, new EllipseFigure()));
    palette.add(createToolButton(IMAGES + "ELLIPSE", "Ellipse Tool", tool));

    tool = new UndoableTool(new PolygonTool(this));
    palette.add(createToolButton(IMAGES + "POLYGON", "Polygon Tool", tool));

    tool = new UndoableTool(new CreationTool(this, new TriangleFigure()));
    palette.add(createToolButton(IMAGES + "TRIANGLE", "Triangle Tool", tool));

    tool = new UndoableTool(new CreationTool(this, new DiamondFigure()));
    palette.add(createToolButton(IMAGES + "DIAMOND", "Diamond Tool", tool));

    tool = new UndoableTool(new CreationTool(this, new LineFigure()));
    palette.add(createToolButton(IMAGES + "LINE", "Line Tool", tool));

    tool = new UndoableTool(new ConnectionTool(this, new LineConnection()));
    palette.add(createToolButton(IMAGES + "CONN", "Connection Tool", tool));

    tool = new UndoableTool(new ConnectionTool(this, new ElbowConnection()));
    palette.add(createToolButton(IMAGES + "OCONN", "Elbow Connection Tool", tool));

    tool = new UndoableTool(new ScribbleTool(this));
    palette.add(createToolButton(IMAGES + "SCRIBBL", "Scribble Tool", tool));

    tool = new UndoableTool(new BorderTool(this));
    palette.add(createToolButton(IMAGES + "BORDDEC", "Border Tool", tool));
  }
Ejemplo n.º 29
0
  // initializes the internal component of the translator
  protected void jbInit() {
    this.getContentPane().setLayout(new GridBagLayout());

    loadButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            loadButton_actionPerformed(e);
          }
        });
    loadButton.setMaximumSize(new Dimension(39, 39));
    loadButton.setMinimumSize(new Dimension(39, 39));
    loadButton.setPreferredSize(new Dimension(39, 39));
    loadButton.setSize(new Dimension(39, 39));
    loadButton.setToolTipText("Load Source File");
    loadButton.setIcon(loadIcon);

    saveButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            saveButton_actionPerformed(e);
          }
        });
    saveButton.setMaximumSize(new Dimension(39, 39));
    saveButton.setMinimumSize(new Dimension(39, 39));
    saveButton.setPreferredSize(new Dimension(39, 39));
    saveButton.setSize(new Dimension(39, 39));
    saveButton.setToolTipText("Save Destination File");
    saveButton.setIcon(saveIcon);

    singleStepButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            singleStepButton_actionPerformed(e);
          }
        });
    singleStepButton.setMaximumSize(new Dimension(39, 39));
    singleStepButton.setMinimumSize(new Dimension(39, 39));
    singleStepButton.setPreferredSize(new Dimension(39, 39));
    singleStepButton.setSize(new Dimension(39, 39));
    singleStepButton.setToolTipText("Single Step");
    singleStepButton.setIcon(singleStepIcon);

    ffwdButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            ffwdButton_actionPerformed(e);
          }
        });
    ffwdButton.setMaximumSize(new Dimension(39, 39));
    ffwdButton.setMinimumSize(new Dimension(39, 39));
    ffwdButton.setPreferredSize(new Dimension(39, 39));
    ffwdButton.setSize(new Dimension(39, 39));
    ffwdButton.setToolTipText("Fast Forward");
    ffwdButton.setIcon(ffwdIcon);

    rewindButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            rewindButton_actionPerformed(e);
          }
        });
    rewindButton.setMaximumSize(new Dimension(39, 39));
    rewindButton.setMinimumSize(new Dimension(39, 39));
    rewindButton.setPreferredSize(new Dimension(39, 39));
    rewindButton.setSize(new Dimension(39, 39));
    rewindButton.setToolTipText("Rewind");
    rewindButton.setIcon(rewindIcon);

    stopButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            stopButton_actionPerformed(e);
          }
        });
    stopButton.setMaximumSize(new Dimension(39, 39));
    stopButton.setMinimumSize(new Dimension(39, 39));
    stopButton.setPreferredSize(new Dimension(39, 39));
    stopButton.setSize(new Dimension(39, 39));
    stopButton.setToolTipText("Stop");
    stopButton.setIcon(stopIcon);

    fullTranslationButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            fullTranslationButton_actionPerformed(e);
          }
        });
    fullTranslationButton.setMaximumSize(new Dimension(39, 39));
    fullTranslationButton.setMinimumSize(new Dimension(39, 39));
    fullTranslationButton.setPreferredSize(new Dimension(39, 39));
    fullTranslationButton.setSize(new Dimension(39, 39));
    fullTranslationButton.setToolTipText("Fast Translation");
    fullTranslationButton.setIcon(fullTranslationIcon);

    messageLbl.setFont(Utilities.statusLineFont);
    messageLbl.setLineWrap(true);
    messageLbl.setEditable(false);
    messageLbl.setCursor(null);
    messageLbl.setOpaque(false);
    messageLbl.setFocusable(false);
    messageLblPane.setBorder(BorderFactory.createLoweredBevelBorder());
    // messageLblPane.setBounds(new Rectangle(0, 672, TRANSLATOR_WIDTH - 8, 20));
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.ipadx = 0;
    c.ipady = 0;
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 3;
    c.anchor = GridBagConstraints.CENTER;
    c.gridx = 0;
    c.gridy = 2;
    this.getContentPane().add(messageLblPane, c);

    // arrowLabel.setBounds(new Rectangle(290, 324, 88, 71));
    arrowLabel.setIcon(arrowIcon);

    // source.setVisibleRows(31);
    // destination.setVisibleRows(31);
    // source.setBounds(new Rectangle(35,100,source.getWidth(),source.getHeight()));
    // destination.setBounds(new Rectangle(375,100,destination.getWidth(),destination.getHeight()));

    c.fill = GridBagConstraints.BOTH;
    c.ipadx = 0;
    c.ipady = 0;
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = 1;
    c.anchor = GridBagConstraints.CENTER;
    c.gridx = 0;
    c.gridy = 1;
    this.getContentPane().add(source, c);

    c.fill = GridBagConstraints.NONE;
    c.ipadx = 0;
    c.ipady = 0;
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.anchor = GridBagConstraints.CENTER;
    c.gridx = 1;
    c.gridy = 1;
    this.getContentPane().add(arrowLabel, c);

    c.fill = GridBagConstraints.BOTH;
    c.ipadx = 0;
    c.ipady = 0;
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = 1;
    c.anchor = GridBagConstraints.CENTER;
    c.gridx = 2;
    c.gridy = 1;
    this.getContentPane().add(destination, c);

    // Adding the tool bar to this container.
    toolBar.setFloatable(false);
    toolBar.setLocation(0, 0);
    toolBar.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 0));
    toolBar.setBorder(BorderFactory.createEtchedBorder());
    arrangeToolBar();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.ipadx = 0;
    c.ipady = 0;
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 3;
    c.anchor = GridBagConstraints.CENTER;
    c.gridx = 0;
    c.gridy = 0;
    this.getContentPane().add(toolBar, c);
    toolBar.revalidate();
    toolBar.repaint();
    repaint();

    // Creating the menu bar
    arrangeMenu();
    setJMenuBar(menuBar);

    // initializing the window size and visibility
    setDefaultCloseOperation(3);
    setSize(new Dimension(TRANSLATOR_WIDTH, TRANSLATOR_HEIGHT));
    setVisible(true);
  }
Ejemplo n.º 30
0
    public DrawViewPanel() {

      setLayout(new BorderLayout());
      splitPane = new JSplitPane();
      fromList.setBorder(BorderFactory.createTitledBorder("Select FROM node to Connect"));
      toList.setBorder(BorderFactory.createTitledBorder("Select TO node to Connect"));
      fromList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
      toList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
      JPanel nodePanel = new JPanel();
      JPanel toNodePanel = new JPanel();
      JList arcList = new JList(arcListModel);

      nodePanel.setLayout(new BorderLayout());
      toNodePanel.setLayout(new BorderLayout());
      fromListScrollPane = new JScrollPane(fromList);

      nodePanel.add(fromListScrollPane, BorderLayout.CENTER);
      toNodePanel.add(new JScrollPane(toList), BorderLayout.CENTER);
      nodePanel.add(toNodePanel, BorderLayout.SOUTH);

      JPanel arcButtonPanel = new JPanel();
      arcButtonPanel.setLayout(new GridLayout(1, 2));
      JPanel northArcButtonPanel = new JPanel();
      JPanel southArcButtonPanel = new JPanel();

      northArcButtonPanel.setLayout(new BorderLayout());
      southArcButtonPanel.setLayout(new BorderLayout());

      JButton addDirArcButton = new JButton("==>>");
      addDirArcButton.setToolTipText("Add Directed Arc from left node to right node");
      addDirArcButton.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent e) {
              addDirectedArc();
            }
          });
      JButton addUndirArcButton = new JButton("<==>");
      addUndirArcButton.setToolTipText("Add Undrected Arc between selected nodes");
      addUndirArcButton.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent e) {
              addUndirectedArc();
            }
          });

      /** Adding Dijkstra button to the viewer* */
      JButton runDijkstraButton = new JButton("Dijkstra");
      runDijkstraButton.setToolTipText("Runs Dijsktra's algorithm on the given graph");
      runDijkstraButton.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent e) {
              try {
                runDijkstra();
              } catch (NotMemberException e1) {
                JOptionPane.showMessageDialog(GraphViewer.this, e1.getMessage());
              }
            }

            private void runDijkstra() throws NotMemberException {

              graph.dijkstra(fromList.getSelectedValue(), toList.getSelectedValue(), Graph.DIRECT);
              graph.printoutShortestPath();
            }
          });

      /** Adding DijkstraReverse button to the viewer* */
      JButton runDijkstraReverseButton = new JButton("DijkstraRev");
      runDijkstraReverseButton.setToolTipText(
          "Runs Dijsktra's algorithm (in reverse order) on the given graph");
      runDijkstraReverseButton.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent e) {
              try {
                runDijkstraReverse();
              } catch (NotMemberException e1) {
                JOptionPane.showMessageDialog(GraphViewer.this, e1.getMessage());
              }
            }

            private void runDijkstraReverse() throws NotMemberException {
              Node lastNode = null;
              graph.dijkstraReverse(graph.findNode("12a"));
              graph.printoutShortestPath();
            }
          });

      /** Adding BiDijkstra button to the viewer* */
      JButton runBiDijkstraButton = new JButton("BiDijkstra");
      runBiDijkstraButton.setToolTipText(
          "Runs Bidirectional Dijsktra's algorithm on the given graph");
      runBiDijkstraButton.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent e) {
              try {
                runBiDijkstra();
              } catch (NotMemberException e1) {
                JOptionPane.showMessageDialog(GraphViewer.this, e1.getMessage());
              }
            }

            private void runBiDijkstra() throws NotMemberException {
              Node firstNode = null;
              Node lastNode = null;
              graph.biDijkstra(fromList.getSelectedValue(), toList.getSelectedValue());
              graph.printoutShortestPath();
            }
          });
      northArcButtonPanel.add(addDirArcButton, BorderLayout.EAST);
      southArcButtonPanel.add(addUndirArcButton, BorderLayout.WEST);
      arcButtonPanel.add(northArcButtonPanel);
      arcButtonPanel.add(southArcButtonPanel);
      toNodePanel.add(arcButtonPanel, BorderLayout.NORTH);

      splitPane.setLeftComponent(nodePanel);

      // right component
      //			rightPanel = new JPanel();

      graph.addListener(layouter);
      canvas = new Draw2DPanel(layouter, null);
      layouter.settCanvas(canvas);

      JTabbedPane tabbedPane = new JTabbedPane();
      splitPane.setRightComponent(tabbedPane);

      if (hasOption(VIEW_2D)) {
        tabbedPane.addTab("Graph2D", canvas);
      }

      if (hasOption(VIEW_WF)) {
        canvasWF = new DrawWFPanel(layouterWF3D, null);
        layouterWF3D.setCanvasWF(canvasWF);
        tabbedPane.addTab("WireFrame3D", canvasWF);
      }
      if (hasOption(VIEW_3D)) {
        canvasAnim = new AnimPanel(layouterWF3D, null, new Vector3d(10.0, 10.0, 50.0), false);
        layouterWF3D.setCanvasAnim(canvasAnim);
        tabbedPane.addTab("Graph3D", canvasAnim);
      }
      //			rightPanel.setLayout(new BorderLayout());
      arcList.setBorder(BorderFactory.createTitledBorder("Arcs in the graph"));
      //			rightPanel.add(new JScrollPane (arcList), BorderLayout.CENTER);
      JToolBar toolBar = new JToolBar();

      // toolbar buttons
      JButton openFileButton = new JButton("File");
      JButton addNodeButton = new JButton("AN");
      JButton addArcButton = new JButton("Add Arc");
      JButton deleteNodeButton = new JButton("Delete Node");
      JButton deleteArcButton = new JButton("Delete Arc");
      JButton showBordersButton = new JButton("SB");

      openFileButton.setToolTipText("Open File");

      openFileButton.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent e) {
              openFile();
            }
          });

      addNodeButton.setToolTipText("Add Node");
      addNodeButton.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent e) {
              addNode();
            }
          });

      deleteNodeButton.setToolTipText("Delete Node");
      deleteNodeButton.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent e) {
              deleteNode();
            }
          });

      deleteArcButton.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent e) {
              deleteArc();
            }
          });
      showBordersButton.setToolTipText("ShowBorders");
      showBordersButton.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent e) {
              showBorders = !showBorders;
              changeBorderDisplay();
            }
          });
      toolBar.add(openFileButton);
      toolBar.add(addNodeButton);
      toolBar.add(addArcButton);
      toolBar.add(deleteNodeButton);
      toolBar.add(deleteArcButton);
      toolBar.add(showBordersButton);
      toolBar.add(runDijkstraButton);
      toolBar.add(runDijkstraReverseButton);
      toolBar.add(runBiDijkstraButton);

      add(splitPane, BorderLayout.CENTER);
      add(toolBar, BorderLayout.SOUTH);
    }