public static void init( JToolBar comp, Thing thing, Container parent, ActionContext actionContext) { JComponentCreator.init(comp, thing, parent, actionContext); Boolean borderPainted = JavaCreator.createBoolean(thing, "borderPainted"); if (borderPainted != null) { comp.setBorderPainted(borderPainted); } Boolean floatable = JavaCreator.createBoolean(thing, "floatable"); if (floatable != null) { comp.setFloatable(floatable); } Insets margin = AwtCreator.createInsets(thing, "margin", actionContext); if (margin != null) { comp.setMargin(margin); } Integer orientation = null; String v = thing.getString("orientation"); if ("HORIZONTAL".equals(v)) { orientation = JToolBar.HORIZONTAL; } else if ("VERTICAL".equals(v)) { orientation = JToolBar.VERTICAL; } if (orientation != null) { comp.setOrientation(orientation); } Boolean rollover = JavaCreator.createBoolean(thing, "rollover"); if (rollover != null) { comp.setRollover(rollover); } }
/** * Creates the Viewpoint Toolbar in the specified orientation. * * @param orientation orientation of the toolbar (JToolBar.VERTICAL or JToolBar.HORIZONTAL) * @return the toolbar component */ public Component doMakeViewPointToolBar(int orientation) { JToolBar toolbar = getViewpointControl().getToolBar(getToolbarsFloatable()); toolbar.setOrientation(orientation); return GuiUtils.top(toolbar); }
/** * This method creates a new JToolBar object with the given name and orientation. * * @param name Name assigned to undocked tool bar. * @param orientation JToolBar orientation (HORIZONTAL or VERTICAL) */ public JToolBar(String name, int orientation) { setName(name); setOrientation(orientation); setLayout(new DefaultToolBarLayout()); revalidate(); updateUI(); } // JToolBar()
/** kreiert das Menü oben */ private JToolBar createMenu() { JToolBar toolbar = new JToolBar(); toolbar.setOrientation(SwingConstants.HORIZONTAL); toolbar.setFloatable(false); toolbar.setMargin(new Insets(2, 35, 2, 0)); toolbar.setBackground(new Color(219, 255, 179)); zoomIn = FsmUtils.createButton(zoomInImg); zoomIn.setToolTipText("Vergr��ern"); zoomIn.addMouseListener(new ZoomInHandler(this)); zoomOut = FsmUtils.createButton(zoomOutImg); zoomOut.setToolTipText("Verkleinern"); zoomOut.addMouseListener(new ZoomOutHandler(this)); layout = FsmUtils.createButton(layoutImg); layout.setToolTipText("Automatisch layouten"); layout.addMouseListener(new LayoutHandler(this)); deterministic = new JRadioButton("deterministisch"); deterministic.setToolTipText("Der endliche Automat wird deterministisch"); deterministic.setBackground(new Color(219, 255, 179)); deterministic.addMouseListener(new TypeOfFsmHandler(this, false)); nondeterministic = new JRadioButton("nichtdeterministisch"); nondeterministic.setToolTipText("Der endliche Automat wird nichtdeterministisch"); nondeterministic.setBackground(new Color(219, 255, 179)); nondeterministic.addMouseListener(new TypeOfFsmHandler(this, true)); ButtonGroup group = new ButtonGroup(); group.add(deterministic); group.add(nondeterministic); if (this.getFsmProgram().isNondeterministic()) { group.setSelected(nondeterministic.getModel(), true); } else { group.setSelected(deterministic.getModel(), true); } toolbar.add(zoomIn); toolbar.add(Box.createHorizontalStrut(2)); toolbar.add(zoomOut); toolbar.add(Box.createHorizontalStrut(2)); toolbar.add(Box.createHorizontalStrut(2)); toolbar.add(layout); toolbar.addSeparator(); toolbar.add(deterministic); toolbar.add(nondeterministic); return toolbar; }
/** * Static component init. * * <pre> * - panel * - northPanel * - parameterPanel * - toolBar * - gridController * - confirmPanel * - statusBar * </pre> * * @throws Exception */ void jbInit() throws Exception { // [ 1707303 ] Account Combination Form(VAccountDialog) translation issue titledBorder = new TitledBorder( BorderFactory.createEtchedBorder(Color.white, new Color(134, 134, 134)), Msg.getMsg(Env.getCtx(), "Parameter")); // panelLayout.setHgap(5); panelLayout.setVgap(5); northLayout.setHgap(5); northLayout.setVgap(5); // parameterPanel.setLayout(parameterLayout); parameterPanel.setBorder(titledBorder); northPanel.setLayout(northLayout); toolBar.setOrientation(JToolBar.VERTICAL); toolBar.setBorder(null); toolBar.setRequestFocusEnabled(false); toolBar.setBorderPainted(false); toolBar.setMargin(new Insets(5, 5, 5, 5)); bSave.setIcon(new ImageIcon(ResourceFinder.getResource("images/Save24.gif"))); bSave.setMargin(new Insets(2, 2, 2, 2)); bSave.setToolTipText(Msg.getMsg(Env.getCtx(), "AccountNewUpdate")); bSave.addActionListener(this); bRefresh.setIcon(new ImageIcon(ResourceFinder.getResource("images/Refresh24.gif"))); bRefresh.setMargin(new Insets(2, 2, 2, 2)); bRefresh.setToolTipText(Msg.getMsg(Env.getCtx(), "Refresh")); bRefresh.addActionListener(this); bIgnore.setIcon(new ImageIcon(ResourceFinder.getResource("images/Ignore24.gif"))); bIgnore.setMargin(new Insets(2, 2, 2, 2)); bIgnore.setToolTipText(Msg.getMsg(Env.getCtx(), "Ignore")); bIgnore.addActionListener(this); // toolBar.addSeparator(); toolBar.add(bRefresh, null); toolBar.add(bIgnore, null); toolBar.add(bSave, null); // getContentPane().add(panel); panel.setLayout(panelLayout); panel.add(confirmPanel, BorderLayout.SOUTH); panel.add(northPanel, BorderLayout.NORTH); northPanel.add(parameterPanel, BorderLayout.CENTER); northPanel.add(toolBar, BorderLayout.EAST); // this.getContentPane().add(statusBar, BorderLayout.SOUTH); confirmPanel.addActionListener(this); } // jbInit
/** * Create a text tab and optionally request a toolbar. * * @since ARGO0.9.4 * @param title the title * @param withToolbar true if a toolbar is needed */ public TabText(String title, boolean withToolbar) { super(title); setIcon(new UpArrowIcon()); setLayout(new BorderLayout()); textArea.setFont(new Font("Monospaced", Font.PLAIN, 12)); textArea.setTabSize(4); add(new JScrollPane(textArea), BorderLayout.CENTER); textArea.getDocument().addDocumentListener(this); // If a toolbar was requested, create an empty one. if (withToolbar) { toolbar = (new ToolBarFactory(Collections.EMPTY_LIST)).createToolBar(); toolbar.setOrientation(SwingConstants.HORIZONTAL); toolbar.setFloatable(false); toolbar.setName(getTitle()); add(toolbar, BorderLayout.NORTH); } }
/** * Die Methode initialisiert die Text Panel mit bestimten Text Areas * * <p>Besteht: aus Label, Text Area und Toolbar mit 2 Button "addObject, addCondition" * * @return javax.swing.JPanel */ private JPanel getTextPanel(String typeName, Undomanager manager) { // Button init JButton addObject = new JButton( new ImageIcon( getClass().getClassLoader().getResource("images/table_relationship.png"))); JButton addCondition = new JButton(new ImageIcon(getClass().getClassLoader().getResource("images/script.png"))); addObject.setToolTipText(Main.myLang.getString("textArea.addObject")); addCondition.setToolTipText(Main.myLang.getString("textArea.addCondition")); // Label init JLabel typeLabel = new JLabel(typeName, JLabel.CENTER); typeLabel.setPreferredSize(new Dimension(150, 40)); // Text Area in Text Panel einfuegen JScrollPane scrol = new JScrollPane(); scrol = getTextScroll(typeName, manager, addObject, addCondition); // Fuer Entry Type Key keine Button erzeugen if (typeName == entryTypeKeyVar) { addObject.setVisible(false); addCondition.setVisible(false); } // ButtonBar init JToolBar buttonBar = new JToolBar(); buttonBar.setOrientation(HORIZONTAL); buttonBar.setFloatable(false); // Bottun on Toolbar einfuegen buttonBar.add(addObject); buttonBar.add(addCondition); // Label in Panel einfuegen & zusammenf�hren JPanel textFieldPanel = new JPanel(); textFieldPanel.setLayout(new BoxLayout(textFieldPanel, BoxLayout.LINE_AXIS)); textFieldPanel.setPreferredSize(new Dimension(0, 40)); textFieldPanel.add(typeLabel); textFieldPanel.add(scrol); textFieldPanel.add(buttonBar); textFieldPanel.setBorder(BorderFactory.createRaisedBevelBorder()); textFieldPanel.validate(); return textFieldPanel; }
private JPanel getFilePanel(String typeName, Undomanager manager) { // PopupMenu init tablePopupMenu = new JPopupMenu(); JMenuItem tableOpenItem = new JMenuItem("Open"); tableOpenItem.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { openFile(rightClickedElement); } }); tablePopupMenu.add(tableOpenItem); // Main Panel init JPanel textFieldPanel = new JPanel(); JLabel typeLabel = new JLabel(typeName, JLabel.CENTER); typeLabel.setPreferredSize(new Dimension(150, 35)); // Tabel Init if (isNewEntry == false) { fileTable = new JTable(new FileTableModel(theDb.getAllFiles(obj.getId()))); } else { fileTable = new JTable(new FileTableModel(new Vector<ContainerFile>())); } fileModel = (FileTableModel) fileTable.getModel(); fileTable.getTableHeader().setReorderingAllowed(false); TableColumn col = fileTable.getColumnModel().getColumn(0); col.setMinWidth(25); col.setMaxWidth(50); col.setPreferredWidth(25); col = fileTable.getColumnModel().getColumn(3); col.setMinWidth(35); col.setMaxWidth(50); col.setPreferredWidth(35); // Listener f�r clicks on file Table // Double-Click => Open Edit Fild // Right-Click => Context Menu => Open fileTable.addMouseListener( new MouseAdapter() { public void mousePressed(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON3 && fileTable.rowAtPoint(e.getPoint()) != -1) { rightClickedElement = (ContainerFile) fileModel.getDataAt(fileTable.rowAtPoint(e.getPoint())); tablePopupMenu.show(e.getComponent(), e.getX(), e.getY()); } else if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2 && fileTable.rowAtPoint(e.getPoint()) != -1) { new FileDialog( fileModel, (ContainerFile) fileModel.getDataAt(fileTable.rowAtPoint(e.getPoint())), fileTable.rowAtPoint(e.getPoint()), myFrame); } } }); // Scrollpane init JScrollPane scrollPane = new javax.swing.JScrollPane(); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setViewportView(fileTable); scrollPane.setPreferredSize(new Dimension(0, 100)); // Button init JButton add = new JButton(new ImageIcon(getClass().getClassLoader().getResource("images/add.png"))); add.setToolTipText(Main.myLang.getString("button.add")); add.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { new FileDialog(fileModel, ((Component) myFrame)); } }); JButton del = new JButton(new ImageIcon("images/delete.png")); del.setToolTipText(Main.myLang.getString("button.delete")); del.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { int selectedRow = fileTable.getSelectedRow(); if (selectedRow != -1) { fileModel.removeData(selectedRow); // TODO: } fileModel.fireTableDataChanged(); fileTable.repaint(); } }); JButton open = new JButton(new ImageIcon(getClass().getClassLoader().getResource("images/folder.png"))); open.setToolTipText(Main.myLang.getString("button.open")); open.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (fileTable.getSelectedRow() != -1) { openFile(((ContainerFile) fileModel.getDataAt(fileTable.getSelectedRow()))); } } }); // Toolbar init JToolBar buttonBar = new JToolBar(); buttonBar.setOrientation(VERTICAL); buttonBar.setFloatable(false); buttonBar.add(add); buttonBar.add(del); buttonBar.add(open); // Zusammenf�gen textFieldPanel.setLayout(new BoxLayout(textFieldPanel, BoxLayout.LINE_AXIS)); textFieldPanel.setBorder(BorderFactory.createRaisedBevelBorder()); textFieldPanel.add(typeLabel); textFieldPanel.add(scrollPane); textFieldPanel.add(buttonBar); textFieldPanel.validate(); return textFieldPanel; }
/** 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); }
/** Erstellt das Menü auf der linken Seite */ private JToolBar createFSMMenu() { JToolBar toolbar = new JToolBar(); toolbar.setOrientation(SwingConstants.VERTICAL); toolbar.setFloatable(false); toolbar.setMargin(new Insets(5, -3, 0, 2)); toolbar.setBackground(new Color(219, 255, 179)); editMode = FsmUtils.createToggleButton(editImg); editMode.setToolTipText("Editieren"); editMode.addMouseListener(new EditModeHandler(this.automataPanel)); deleteMode = FsmUtils.createToggleButton(deleteImg); deleteMode.setToolTipText("L�schen"); deleteMode.addMouseListener(new DeleteModeHandler(this.automataPanel)); createState = FsmUtils.createToggleButton(createStateImg); createState.setToolTipText("Zustand erzeugen"); createState.addMouseListener(new CreateStateHandler(this.automataPanel)); markStartState = FsmUtils.createToggleButton(markStartStateImg); markStartState.setToolTipText("Startzustand markieren"); markStartState.addMouseListener(new MarkStartStateHandler(this.automataPanel)); markFinalState = FsmUtils.createToggleButton(markFinalStateImg); markFinalState.setToolTipText("Endzustand markieren"); markFinalState.addMouseListener(new MarkFinalStateHandler(this.automataPanel)); createTransistion = FsmUtils.createToggleButton(createTransistionImg); createTransistion.setToolTipText("Transition erzeugen"); createTransistion.addMouseListener(new CreateTransistionHandler(this.automataPanel)); createComment = FsmUtils.createToggleButton(createCommentImg); createComment.setToolTipText("Kommentar erzeugen"); createComment.addMouseListener(new CreateCommentHandler(this.automataPanel)); // Nur ein Button darf aktiv sein ButtonGroup group = new ButtonGroup(); group.add(editMode); group.add(deleteMode); group.add(createState); group.add(markStartState); group.add(markFinalState); group.add(createTransistion); group.add(createComment); group.setSelected(editMode.getModel(), true); toolbar.add(editMode); toolbar.add(Box.createVerticalStrut(2)); toolbar.add(deleteMode); toolbar.addSeparator(); toolbar.add(createState); toolbar.add(Box.createVerticalStrut(2)); toolbar.add(markStartState); toolbar.add(Box.createVerticalStrut(2)); toolbar.add(markFinalState); toolbar.add(Box.createVerticalStrut(2)); toolbar.add(createTransistion); toolbar.add(Box.createVerticalStrut(2)); toolbar.add(createComment); return toolbar; }
public void setOrientation(int orientation) { super.setOrientation(orientation); if (bar != null) { bar.setOrientation(orientation); } }
/** * This is a convenience method for changing the orientation of the JToolBar. * * @param orientation The new orientation. */ public void setOrientation(int orientation) { toolBar.setOrientation(orientation); }
/** * This method is used at the end of a drag session to place the frame in either its original * parent as a docked JToolBar or in its floating frame. * * @param position The position of the mouse cursor relative to the JToolBar. * @param origin The screen position of the JToolBar before the drag session started. */ protected void floatAt(Point position, Point origin) { Point p = new Point(position); int aoc = areaOfClick(origParent, SwingUtilities.convertPoint(toolBar, p, origParent)); Container oldParent = toolBar.getParent(); oldParent.remove(toolBar); oldParent.doLayout(); oldParent.repaint(); Container newParent; if (aoc == -1) newParent = ((RootPaneContainer) floatFrame).getContentPane(); else { floatFrame.hide(); newParent = origParent; } String constraint; switch (aoc) { case SwingConstants.EAST: constraint = BorderLayout.EAST; break; case SwingConstants.NORTH: constraint = BorderLayout.NORTH; break; case SwingConstants.SOUTH: constraint = BorderLayout.SOUTH; break; case SwingConstants.WEST: constraint = BorderLayout.WEST; break; default: constraint = BorderLayout.CENTER; break; } int newOrientation = SwingConstants.HORIZONTAL; if ((aoc != -1) && ((aoc == SwingConstants.EAST) || (aoc == SwingConstants.WEST))) newOrientation = SwingConstants.VERTICAL; if (aoc != -1) { constraintBeforeFloating = constraint; lastGoodOrientation = newOrientation; } newParent.add(toolBar, constraint); setFloating(aoc == -1, null); toolBar.setOrientation(newOrientation); Insets insets = floatFrame.getInsets(); Dimension dims = toolBar.getPreferredSize(); p = dragWindow.getOffset(); setFloatingLocation( (position.x + origin.x) - p.x - ((insets.left + insets.right) / 2), (position.y + origin.y) - p.y - ((insets.top + insets.bottom) / 2)); if (aoc == -1) { floatFrame.pack(); floatFrame.setSize( dims.width + insets.left + insets.right, dims.height + insets.top + insets.bottom); floatFrame.show(); } newParent.invalidate(); newParent.validate(); newParent.repaint(); }
private void setupRightSideToolBar() { JToolBar fixedTools = new JToolBar(); fixedTools.setOrientation(JToolBar.HORIZONTAL); JButton cutB = new JButton(new ImageIcon(loadIcon(ICON_PATH + "cut.png").getImage())); cutB.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0)); cutB.setToolTipText("Cut selected (Ctrl+X)"); JButton copyB = new JButton(new ImageIcon(loadIcon(ICON_PATH + "page_copy.png").getImage())); copyB.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0)); copyB.setToolTipText("Copy selected (Ctrl+C)"); JButton pasteB = new JButton(new ImageIcon(loadIcon(ICON_PATH + "paste_plain.png").getImage())); pasteB.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0)); pasteB.setToolTipText("Paste from clipboard (Ctrl+V)"); JButton deleteB = new JButton(new ImageIcon(loadIcon(ICON_PATH + "delete.png").getImage())); deleteB.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0)); deleteB.setToolTipText("Delete selected (DEL)"); final JToggleButton snapToGridB = new JToggleButton(new ImageIcon(loadIcon(ICON_PATH + "shape_handles.png").getImage())); // m_snapToGridB.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0)); snapToGridB.setToolTipText("Snap to grid (Ctrl+G)"); JButton saveB = new JButton(new ImageIcon(loadIcon(ICON_PATH + "disk.png").getImage())); saveB.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0)); saveB.setToolTipText("Save layout (Ctrl+S)"); JButton saveBB = new JButton(new ImageIcon(loadIcon(ICON_PATH + "disk_multiple.png").getImage())); saveBB.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0)); saveBB.setToolTipText("Save layout with new name"); JButton loadB = new JButton(new ImageIcon(loadIcon(ICON_PATH + "folder_add.png").getImage())); loadB.setToolTipText("Open (Ctrl+O)"); loadB.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0)); JButton newB = new JButton(new ImageIcon(loadIcon(ICON_PATH + "page_add.png").getImage())); newB.setToolTipText("New layout (Ctrl+N)"); newB.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0)); newB.setEnabled(m_mainPerspective.getAllowMultipleTabs()); final JButton helpB = new JButton(new ImageIcon(loadIcon(ICON_PATH + "help.png").getImage())); helpB.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0)); helpB.setToolTipText("Display help (Ctrl+H)"); JButton togglePerspectivesB = new JButton(new ImageIcon(loadIcon(ICON_PATH + "cog_go.png").getImage())); togglePerspectivesB.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0)); togglePerspectivesB.setToolTipText("Show/hide perspectives toolbar (Ctrl+P)"); final JButton templatesB = new JButton(new ImageIcon(loadIcon(ICON_PATH + "application_view_tile.png").getImage())); templatesB.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0)); templatesB.setToolTipText("Load a template layout"); JButton noteB = new JButton(new ImageIcon(loadIcon(ICON_PATH + "note_add.png").getImage())); noteB.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0)); noteB.setToolTipText("Add a note to the layout (Ctrl+I)"); JButton selectAllB = new JButton(new ImageIcon(loadIcon(ICON_PATH + "shape_group.png").getImage())); selectAllB.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0)); selectAllB.setToolTipText("Select all (Ctrl+A)"); final JButton zoomInB = new JButton(new ImageIcon(loadIcon(ICON_PATH + "zoom_in.png").getImage())); zoomInB.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0)); zoomInB.setToolTipText("Zoom in (Ctrl++)"); final JButton zoomOutB = new JButton(new ImageIcon(loadIcon(ICON_PATH + "zoom_out.png").getImage())); zoomOutB.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0)); zoomOutB.setToolTipText("Zoom out (Ctrl+-)"); JButton undoB = new JButton(new ImageIcon(loadIcon(ICON_PATH + "arrow_undo.png").getImage())); undoB.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0)); undoB.setToolTipText("Undo (Ctrl+U)"); // actions final Action saveAction = new AbstractAction("Save") { @Override public void actionPerformed(ActionEvent e) { if (m_mainPerspective.getCurrentTabIndex() >= 0) { m_mainPerspective.saveLayout(m_mainPerspective.getCurrentTabIndex(), false); } } }; KeyStroke saveKey = KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK); m_mainPerspective.getActionMap().put("Save", saveAction); m_mainPerspective.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(saveKey, "Save"); saveB.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { saveAction.actionPerformed(e); } }); KeyStroke saveAsKey = KeyStroke.getKeyStroke(KeyEvent.VK_Y, InputEvent.CTRL_DOWN_MASK); final Action saveAsAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { m_mainPerspective.saveLayout(m_mainPerspective.getCurrentTabIndex(), true); } }; m_mainPerspective.getActionMap().put("SaveAS", saveAsAction); m_mainPerspective.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(saveAsKey, "SaveAS"); saveBB.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { saveAsAction.actionPerformed(e); } }); final Action openAction = new AbstractAction("Open") { @Override public void actionPerformed(ActionEvent e) { m_mainPerspective.loadLayout(); } }; KeyStroke openKey = KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK); m_mainPerspective.getActionMap().put("Open", openAction); m_mainPerspective.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(openKey, "Open"); loadB.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { openAction.actionPerformed(e); } }); final Action newAction = new AbstractAction("New") { @Override public void actionPerformed(ActionEvent e) { m_mainPerspective.addUntitledTab(); } }; KeyStroke newKey = KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_DOWN_MASK); m_mainPerspective.getActionMap().put("New", newAction); m_mainPerspective.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(newKey, "New"); newB.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { newAction.actionPerformed(ae); } }); final Action selectAllAction = new AbstractAction("SelectAll") { @Override public void actionPerformed(ActionEvent e) { if (m_mainPerspective.getCurrentLayout() != null && m_mainPerspective.getCurrentLayout().numSteps() > 0) { List<StepVisual> newSelected = newSelected = new ArrayList<StepVisual>(); newSelected.addAll(m_mainPerspective.getCurrentLayout().getRenderGraph()); // toggle if (newSelected.size() == m_mainPerspective.getCurrentLayout().getSelectedSteps().size()) { // unselect all m_mainPerspective.getCurrentLayout().setSelectedSteps(new ArrayList<StepVisual>()); } else { // select all m_mainPerspective.getCurrentLayout().setSelectedSteps(newSelected); } m_mainPerspective.revalidate(); m_mainPerspective.repaint(); m_mainPerspective.notifyIsDirty(); } } }; KeyStroke selectAllKey = KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_DOWN_MASK); m_mainPerspective.getActionMap().put("SelectAll", selectAllAction); m_mainPerspective.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(selectAllKey, "SelectAll"); selectAllB.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { selectAllAction.actionPerformed(e); } }); final Action zoomInAction = new AbstractAction("ZoomIn") { @Override public void actionPerformed(ActionEvent e) { if (m_mainPerspective.getCurrentLayout() != null) { int z = m_mainPerspective.getCurrentLayout().getZoomSetting(); z += 25; zoomOutB.setEnabled(true); if (z >= 200) { z = 200; zoomInB.setEnabled(false); } m_mainPerspective.getCurrentLayout().setZoomSetting(z); m_mainPerspective.revalidate(); m_mainPerspective.repaint(); m_mainPerspective.notifyIsDirty(); } } }; KeyStroke zoomInKey = KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, InputEvent.CTRL_DOWN_MASK); m_mainPerspective.getActionMap().put("ZoomIn", zoomInAction); m_mainPerspective.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(zoomInKey, "ZoomIn"); zoomInB.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { zoomInAction.actionPerformed(e); } }); final Action zoomOutAction = new AbstractAction("ZoomOut") { @Override public void actionPerformed(ActionEvent e) { if (m_mainPerspective.getCurrentLayout() != null) { int z = m_mainPerspective.getCurrentLayout().getZoomSetting(); z -= 25; zoomInB.setEnabled(true); if (z <= 50) { z = 50; zoomOutB.setEnabled(false); } m_mainPerspective.getCurrentLayout().setZoomSetting(z); m_mainPerspective.revalidate(); m_mainPerspective.repaint(); m_mainPerspective.notifyIsDirty(); } } }; KeyStroke zoomOutKey = KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, InputEvent.CTRL_DOWN_MASK); m_mainPerspective.getActionMap().put("ZoomOut", zoomOutAction); m_mainPerspective.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(zoomOutKey, "ZoomOut"); zoomOutB.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { zoomOutAction.actionPerformed(e); } }); final Action cutAction = new AbstractAction("Cut") { @Override public void actionPerformed(ActionEvent e) { if (m_mainPerspective.getCurrentLayout() != null && m_mainPerspective.getCurrentLayout().getSelectedSteps().size() > 0) { try { m_mainPerspective.getCurrentLayout().copySelectedStepsToClipboard(); m_mainPerspective.getCurrentLayout().removeSelectedSteps(); } catch (WekaException e1) { m_mainPerspective.showErrorDialog(e1); } } } }; KeyStroke cutKey = KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_DOWN_MASK); m_mainPerspective.getActionMap().put("Cut", cutAction); m_mainPerspective.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(cutKey, "Cut"); cutB.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cutAction.actionPerformed(e); } }); final Action deleteAction = new AbstractAction("Delete") { @Override public void actionPerformed(ActionEvent e) { if (m_mainPerspective.getCurrentLayout() != null) { try { m_mainPerspective.getCurrentLayout().removeSelectedSteps(); } catch (WekaException e1) { m_mainPerspective.showErrorDialog(e1); } } } }; KeyStroke deleteKey = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0); m_mainPerspective.getActionMap().put("Delete", deleteAction); m_mainPerspective.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(deleteKey, "Delete"); deleteB.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { deleteAction.actionPerformed(e); } }); final Action copyAction = new AbstractAction("Copy") { @Override public void actionPerformed(ActionEvent e) { if (m_mainPerspective.getCurrentLayout() != null && m_mainPerspective.getCurrentLayout().getSelectedSteps().size() > 0) { try { m_mainPerspective.getCurrentLayout().copySelectedStepsToClipboard(); m_mainPerspective.getCurrentLayout().setSelectedSteps(new ArrayList<StepVisual>()); } catch (WekaException e1) { m_mainPerspective.showErrorDialog(e1); } } } }; KeyStroke copyKey = KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_DOWN_MASK); m_mainPerspective.getActionMap().put("Copy", copyAction); m_mainPerspective.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(copyKey, "Copy"); copyB.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { copyAction.actionPerformed(e); } }); final Action pasteAction = new AbstractAction("Paste") { @Override public void actionPerformed(ActionEvent e) { if (m_mainPerspective.getCurrentLayout() != null && m_mainPerspective.getPasteBuffer().length() > 0) { m_mainPerspective.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); m_mainPerspective .getCurrentLayout() .setFlowLayoutOperation(VisibleLayout.LayoutOperation.PASTING); } } }; KeyStroke pasteKey = KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_DOWN_MASK); m_mainPerspective.getActionMap().put("Paste", pasteAction); m_mainPerspective.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(pasteKey, "Paste"); pasteB.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { pasteAction.actionPerformed(e); } }); final Action snapAction = new AbstractAction("Snap") { @Override public void actionPerformed(ActionEvent e) { // toggle first // snapToGridB.setSelected(!snapToGridB.isSelected()); if (snapToGridB.isSelected()) { if (m_mainPerspective.getCurrentLayout() != null) { m_mainPerspective.getCurrentLayout().snapSelectedToGrid(); } } } }; KeyStroke snapKey = KeyStroke.getKeyStroke(KeyEvent.VK_G, InputEvent.CTRL_DOWN_MASK); m_mainPerspective.getActionMap().put("Snap", snapAction); m_mainPerspective.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(snapKey, "Snap"); snapToGridB.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (snapToGridB.isSelected()) { snapAction.actionPerformed(e); } } }); final Action noteAction = new AbstractAction("Note") { @Override public void actionPerformed(ActionEvent e) { if (m_mainPerspective.getCurrentLayout() != null) { m_mainPerspective.getCurrentLayout().initiateAddNote(); } } }; KeyStroke noteKey = KeyStroke.getKeyStroke(KeyEvent.VK_I, InputEvent.CTRL_DOWN_MASK); m_mainPerspective.getActionMap().put("Note", noteAction); m_mainPerspective.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(noteKey, "Note"); noteB.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { noteAction.actionPerformed(e); } }); final Action undoAction = new AbstractAction("Undo") { @Override public void actionPerformed(ActionEvent e) { if (m_mainPerspective.getCurrentLayout() != null) { m_mainPerspective.getCurrentLayout().popAndLoadUndo(); } } }; KeyStroke undoKey = KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.CTRL_DOWN_MASK); m_mainPerspective.getActionMap().put("Undo", undoAction); m_mainPerspective.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(undoKey, "Undo"); undoB.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { undoAction.actionPerformed(e); } }); final Action helpAction = new AbstractAction("Help") { @Override public void actionPerformed(ActionEvent e) { popupHelp(helpB); } }; KeyStroke helpKey = KeyStroke.getKeyStroke(KeyEvent.VK_H, InputEvent.CTRL_DOWN_MASK); m_mainPerspective.getActionMap().put("Help", helpAction); m_mainPerspective.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(helpKey, "Help"); helpB.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { helpAction.actionPerformed(ae); } }); templatesB.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // createTemplateMenuPopup(); PopupMenu popupMenu = new PopupMenu(); List<String> builtinTemplates = m_mainPerspective.getTemplateManager().getBuiltinTemplateDescriptions(); List<String> pluginTemplates = m_mainPerspective.getTemplateManager().getPluginTemplateDescriptions(); for (final String desc : builtinTemplates) { MenuItem menuItem = new MenuItem(desc); menuItem.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { Flow templateFlow = m_mainPerspective.getTemplateManager().getTemplateFlow(desc); m_mainPerspective.addTab(desc); m_mainPerspective.getCurrentLayout().setFlow(templateFlow); } catch (WekaException ex) { m_mainPerspective.showErrorDialog(ex); } } }); popupMenu.add(menuItem); } if (builtinTemplates.size() > 0 && pluginTemplates.size() > 0) { popupMenu.addSeparator(); } for (final String desc : pluginTemplates) { MenuItem menuItem = new MenuItem(desc); menuItem.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { Flow templateFlow = m_mainPerspective.getTemplateManager().getTemplateFlow(desc); m_mainPerspective.addTab(desc); m_mainPerspective.getCurrentLayout().setFlow(templateFlow); } catch (WekaException ex) { m_mainPerspective.showErrorDialog(ex); } } }); popupMenu.add(menuItem); } templatesB.add(popupMenu); popupMenu.show(templatesB, 0, 0); } }); templatesB.setEnabled(m_mainPerspective.getTemplateManager().numTemplates() > 0); final Action togglePerspectivesAction = new AbstractAction("Toggle perspectives") { @Override public void actionPerformed(ActionEvent e) { if (!Utils.getDontShowDialog("weka.gui.knowledgeflow.PerspectiveInfo")) { JCheckBox dontShow = new JCheckBox("Do not show this message again"); Object[] stuff = new Object[2]; stuff[0] = "Perspectives are environments that take over the\n" + "Knowledge Flow UI and provide major additional functionality.\n" + "Many perspectives will operate on a set of instances. Instances\n" + "Can be sent to a perspective by placing a DataSource on the\n" + "layout canvas, configuring it and then selecting \"Send to perspective\"\n" + "from the contextual popup menu that appears when you right-click on\n" + "it. Several perspectives are built in to the Knowledge Flow, others\n" + "can be installed via the package manager.\n"; stuff[1] = dontShow; JOptionPane.showMessageDialog( m_mainPerspective, stuff, "Perspective information", JOptionPane.OK_OPTION); if (dontShow.isSelected()) { try { Utils.setDontShowDialog("weka.gui.Knowledgeflow.PerspectiveInfo"); } catch (Exception ex) { // quietly ignore } } } if (m_mainPerspective.getMainApplication().isPerspectivesToolBarVisible()) { m_mainPerspective.getMainApplication().hidePerspectivesToolBar(); } else { m_mainPerspective.getMainApplication().showPerspectivesToolBar(); } m_mainPerspective.revalidate(); m_mainPerspective.notifyIsDirty(); } }; KeyStroke togglePerspectivesKey = KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.CTRL_DOWN_MASK); m_mainPerspective.getActionMap().put("Toggle perspectives", togglePerspectivesAction); m_mainPerspective .getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) .put(togglePerspectivesKey, "Toggle perspectives"); togglePerspectivesB.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { togglePerspectivesAction.actionPerformed(e); } }); addWidgetToToolBar(fixedTools, Widgets.ZOOM_IN_BUTTON.toString(), zoomInB); addMenuItemToMenu("View", Widgets.ZOOM_IN_BUTTON.toString(), zoomInAction, zoomInKey); addWidgetToToolBar(fixedTools, Widgets.ZOOM_OUT_BUTTON.toString(), zoomOutB); addMenuItemToMenu("View", Widgets.ZOOM_OUT_BUTTON.toString(), zoomOutAction, zoomOutKey); fixedTools.addSeparator(); addWidgetToToolBar(fixedTools, Widgets.SELECT_ALL_BUTTON.toString(), selectAllB); addWidgetToToolBar(fixedTools, Widgets.CUT_BUTTON.toString(), cutB); addMenuItemToMenu("Edit", Widgets.CUT_BUTTON.toString(), cutAction, cutKey); addWidgetToToolBar(fixedTools, Widgets.COPY_BUTTON.toString(), copyB); addMenuItemToMenu("Edit", Widgets.COPY_BUTTON.toString(), copyAction, copyKey); addMenuItemToMenu("Edit", Widgets.PASTE_BUTTON.toString(), pasteAction, pasteKey); addWidgetToToolBar(fixedTools, Widgets.DELETE_BUTTON.toString(), deleteB); addMenuItemToMenu("Edit", Widgets.DELETE_BUTTON.toString(), deleteAction, deleteKey); addWidgetToToolBar(fixedTools, Widgets.PASTE_BUTTON.toString(), pasteB); addWidgetToToolBar(fixedTools, Widgets.UNDO_BUTTON.toString(), undoB); addMenuItemToMenu("Edit", Widgets.UNDO_BUTTON.toString(), undoAction, undoKey); addWidgetToToolBar(fixedTools, Widgets.NOTE_BUTTON.toString(), noteB); addMenuItemToMenu("Insert", Widgets.NOTE_BUTTON.toString(), noteAction, noteKey); fixedTools.addSeparator(); addWidgetToToolBar(fixedTools, Widgets.SNAP_TO_GRID_BUTTON.toString(), snapToGridB); fixedTools.addSeparator(); addWidgetToToolBar(fixedTools, Widgets.NEW_FLOW_BUTTON.toString(), newB); addMenuItemToMenu("File", Widgets.NEW_FLOW_BUTTON.toString(), newAction, newKey); addWidgetToToolBar(fixedTools, Widgets.SAVE_FLOW_BUTTON.toString(), saveB); addMenuItemToMenu("File", Widgets.LOAD_FLOW_BUTTON.toString(), openAction, openKey); addMenuItemToMenu("File", Widgets.SAVE_FLOW_BUTTON.toString(), saveAction, saveKey); addWidgetToToolBar(fixedTools, Widgets.SAVE_FLOW_AS_BUTTON.toString(), saveBB); addMenuItemToMenu("File", Widgets.SAVE_FLOW_AS_BUTTON.toString(), saveAction, saveAsKey); addWidgetToToolBar(fixedTools, Widgets.LOAD_FLOW_BUTTON.toString(), loadB); addWidgetToToolBar(fixedTools, Widgets.TEMPLATES_BUTTON.toString(), templatesB); fixedTools.addSeparator(); addWidgetToToolBar( fixedTools, Widgets.TOGGLE_PERSPECTIVES_BUTTON.toString(), togglePerspectivesB); addWidgetToToolBar(fixedTools, Widgets.HELP_BUTTON.toString(), helpB); Dimension d = undoB.getPreferredSize(); Dimension d2 = fixedTools.getMinimumSize(); Dimension d3 = new Dimension(d2.width, d.height + 4); fixedTools.setPreferredSize(d3); fixedTools.setMaximumSize(d3); fixedTools.setFloatable(false); add(fixedTools, BorderLayout.EAST); }
private void setupLeftSideToolBar() { JToolBar fixedTools2 = new JToolBar(); fixedTools2.setOrientation(JToolBar.HORIZONTAL); fixedTools2.setFloatable(false); JButton playB = new JButton(new ImageIcon(loadIcon(ICON_PATH + "resultset_next.png").getImage())); playB.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); playB.setToolTipText("Run this flow (all start points launched in parallel)"); final Action playParallelAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (m_mainPerspective.getCurrentLayout() != null) { boolean proceed = true; if (m_mainPerspective.isMemoryLow()) { proceed = m_mainPerspective.showMemoryIsLow(); } if (proceed) { try { m_mainPerspective.getCurrentLayout().executeFlow(false); } catch (WekaException e1) { m_mainPerspective.showErrorDialog(e1); } } } } }; playB.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { playParallelAction.actionPerformed(e); } }); JButton playBB = new JButton(new ImageIcon(loadIcon(ICON_PATH + "resultset_last.png").getImage())); playBB.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); playBB.setToolTipText("Run this flow (start points launched sequentially)"); final Action playSequentialAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (m_mainPerspective.getCurrentLayout() != null) { if (!Utils.getDontShowDialog("weka.gui.knowledgeflow.SequentialRunInfo")) { JCheckBox dontShow = new JCheckBox("Do not show this message again"); Object[] stuff = new Object[2]; stuff[0] = "The order that data sources are launched in can be\n" + "specified by setting a custom name for each data source that\n" + "that includes a number. E.g. \"1:MyArffLoader\". To set a name,\n" + "right-click over a data source and select \"Set name\"\n\n" + "If the prefix is not specified, then the order of execution\n" + "will correspond to the order that the components were added\n" + "to the layout. Note that it is also possible to prevent a data\n" + "source from executing by prefixing its name with a \"!\". E.g\n" + "\"!:MyArffLoader\""; stuff[1] = dontShow; JOptionPane.showMessageDialog( m_mainPerspective, stuff, "Sequential execution information", JOptionPane.OK_OPTION); if (dontShow.isSelected()) { try { Utils.setDontShowDialog("weka.gui.knowledgeFlow.SequentialRunInfo"); } catch (Exception e1) { } } } boolean proceed = true; if (m_mainPerspective.isMemoryLow()) { proceed = m_mainPerspective.showMemoryIsLow(); } if (proceed) { try { m_mainPerspective.getCurrentLayout().executeFlow(true); } catch (WekaException e1) { m_mainPerspective.showErrorDialog(e1); } } } } }; playBB.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { playSequentialAction.actionPerformed(e); } }); JButton stopB = new JButton(new ImageIcon(loadIcon(ICON_PATH + "shape_square.png").getImage())); stopB.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0)); stopB.setToolTipText("Stop all execution"); final Action stopAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (m_mainPerspective.getCurrentLayout() != null) { m_mainPerspective .getCurrentLayout() .getLogPanel() .statusMessage("@!@[KnowledgeFlow]|Attempting to stop all components..."); m_mainPerspective.getCurrentLayout().stopFlow(); m_mainPerspective .getCurrentLayout() .getLogPanel() .statusMessage("@!@[KnowledgeFlow]|OK."); } } }; stopB.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { stopAction.actionPerformed(e); } }); JButton pointerB = new JButton(new ImageIcon(loadIcon(ICON_PATH + "cursor.png").getImage())); pointerB.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); pointerB.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { m_mainPerspective.setPalleteSelectedStep(null); m_mainPerspective.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); m_mainPerspective.clearDesignPaletteSelection(); if (m_mainPerspective.getCurrentLayout() != null) { m_mainPerspective .getCurrentLayout() .setFlowLayoutOperation(VisibleLayout.LayoutOperation.NONE); } } }); addWidgetToToolBar(fixedTools2, Widgets.POINTER_BUTTON.toString(), pointerB); addWidgetToToolBar(fixedTools2, Widgets.PLAY_PARALLEL_BUTTON.toString(), playB); addWidgetToToolBar(fixedTools2, Widgets.PLAY_SEQUENTIAL_BUTTON.toString(), playBB); addWidgetToToolBar(fixedTools2, Widgets.STOP_BUTTON.toString(), stopB); Dimension d = playB.getPreferredSize(); Dimension d2 = fixedTools2.getMinimumSize(); Dimension d3 = new Dimension(d2.width, d.height + 4); fixedTools2.setPreferredSize(d3); fixedTools2.setMaximumSize(d3); add(fixedTools2, BorderLayout.WEST); }