/** 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; }
/** 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; }