Example usage for javax.swing JToolBar JToolBar

List of usage examples for javax.swing JToolBar JToolBar

Introduction

In this page you can find the example usage for javax.swing JToolBar JToolBar.

Prototype

public JToolBar() 

Source Link

Document

Creates a new tool bar; orientation defaults to HORIZONTAL.

Usage

From source file:src.gui.ItSIMPLE.java

/**
 * This method initializes toolBar//from  ww  w.  j a va 2  s. c  om
 *
 * @return javax.swing.JToolBar
 */
private JToolBar getToolBar() {
    if (toolBar == null) {
        toolBar = new JToolBar();
        toolBar.setRollover(true);
        toolBar.add(newProjectAction).setToolTipText("New UML Project");
        toolBar.add(openProjectAction).setToolTipText("Open Project");
        toolBar.add(saveAction).setToolTipText("Save Project");
        toolBar.add(saveAllAction).setToolTipText("Save All");
        toolBar.addSeparator();

        perspectiveGroup = new ButtonGroup();

        //toolBar.add(modelingAction).setToolTipText("Modeling domains");
        modelingPerspectiveButton = new JToggleButton(modelingAction);
        modelingPerspectiveButton.setToolTipText("Modeling domains and problems");
        perspectiveGroup.add(modelingPerspectiveButton);
        toolBar.add(modelingPerspectiveButton);
        //set modeling perpective selected by dafault
        perspectiveGroup.setSelected(modelingPerspectiveButton.getModel(), true);

        //toolBar.add(analysisAction).setToolTipText("Model analysis with different techniques and formalism");
        analysisPerspectiveButton = new JToggleButton(analysisAction);
        analysisPerspectiveButton.setToolTipText("Model analysis using different techniques and formalism");
        perspectiveGroup.add(analysisPerspectiveButton);
        toolBar.add(analysisPerspectiveButton);

        //toolBar.add(planningAction).setToolTipText("Planning process and experiments with planners and solvers");
        planningPerspectiveButton = new JToggleButton(planningAction);
        planningPerspectiveButton.setToolTipText("Planning process and experiments using planners and solvers");
        perspectiveGroup.add(planningPerspectiveButton);
        toolBar.add(planningPerspectiveButton);

        toolBar.addSeparator();
        //toolBar.add(pddlTranslationPerspectiveAction).setToolTipText("UML to PDDL translation perspective");
        pddlTranslationPerspectiveButton = new JToggleButton(pddlTranslationPerspectiveAction);
        pddlTranslationPerspectiveButton.setToolTipText("UML to PDDL translation");
        perspectiveGroup.add(pddlTranslationPerspectiveButton);
        toolBar.add(pddlTranslationPerspectiveButton);

        //toolBar.addSeparator();
        //toolBar.add(umlPerspectiveAction).setToolTipText("Set UML perspective");
        //toolBar.add(pddlPerspectiveAction).setToolTipText("Set PDDL perspective");

    }
    return toolBar;
}

From source file:src.gui.ItSIMPLE.java

/**
 * @return Returns the PetriContainer.//  w w  w.  ja va2  s.  co  m
 */
private JXTaskPaneContainer getPetriContainer() {
    if (projectPetriContainer == null) {
        projectPetriContainer = new JXTaskPaneContainer();

        //project
        projectPetriTaskPane = new JXTaskPane();
        projectPetriTaskPane.setTitle("Project");
        projectPetriTaskPane.setIcon(new ImageIcon("resources/images/projects.png"));
        projectPetriTaskPane.setSpecial(true);

        //state chart diagrams
        stateMachinePetriTaskPane = new JXTaskPane();
        stateMachinePetriTaskPane.setTitle("State Chart Diagrams");
        stateMachinePetriTaskPane.setIcon(new ImageIcon("resources/images/planningProblem.png"));
        stateMachinePetriTaskPane.setLayout(new BorderLayout());
        stateMachinePetriPanel = new JPanel(new BorderLayout());

        stateMachineJList = new JList(new DefaultListModel());
        ItListRenderer renderer = new ItListRenderer();
        renderer.setIcon(new ImageIcon("resources/images/stateMachineDiagram.png"));
        stateMachineJList.setCellRenderer(renderer);

        stateMachinePetriPanel.add(stateMachineJList, BorderLayout.CENTER);
        JToolBar toolBar = new JToolBar();
        toolBar.setRollover(true);
        stateMachineButton = new JButton(openPetriNetGroup);
        toolBar.add(stateMachineButton);

        stateMachinePetriTaskPane.add(stateMachinePetriPanel, BorderLayout.CENTER);
        stateMachinePetriTaskPane.add(toolBar, BorderLayout.SOUTH);
        /*petriCheckBoxList = new CheckBoxList();
        stateMachinePetriTaskPane.add(petriCheckBoxList, BorderLayout.CENTER);*/

        //details
        detailPetriTaskPane = new JXTaskPane();
        detailPetriTaskPane.setTitle("Details");
        detailPetriTaskPane.setIcon(new ImageIcon("resources/images/details.png"));

        detailPetriTaskPane.add(getPetriDetailsTextPane());
        petriDetailsTextPane.setBackground(petriDetailsTextPane.getParent().getBackground());

        projectPetriContainer.add(projectPetriTaskPane);
        projectPetriContainer.add(stateMachinePetriTaskPane);
        projectPetriContainer.add(detailPetriTaskPane);

    }

    return projectPetriContainer;
}

From source file:src.gui.ItSIMPLE.java

/**
 * This method initializes movieMakerToolBar
 *
 * @return javax.swing.JToolBar//from  ww w .  j  a  va2s  . c o  m
 */
private JToolBar getMovieMakerToolBar() {

    JToolBar movieMakerToolBar = new JToolBar();
    movieMakerToolBar.setRollover(true);

    // create the buttons

    // generate movie
    JButton generateMovieButton = new JButton("Generate Movie",
            new ImageIcon("resources/images/makemovie.png"));
    generateMovieButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent e) {

            // the thread is created so the status bar can be refreshed
            new Thread() {
                public void run() {
                    ItTreeNode selectedNode = (ItTreeNode) problemsPlanTree.getLastSelectedPathComponent();
                    if (selectedNode != null && selectedNode.getLevel() == 3) {

                        Element problem = selectedNode.getData();
                        movie = PlanSimulator.getMovie(xmlPlan, problem);
                        //XMLUtilities.printXML(xmlPlan);
                        //XMLUtilities.printXML(movie);

                        //IN CASE WE WANT TO RUN THE METRICS WITH SIMULATION
                        //Element domain = problem.getParentElement().getParentElement();
                        //Element metrics = PlanSimulator.createMetricsNode(problem, domain);
                        //if(metrics.getChildren().size() > 0){
                        //    PlanSimulator.createMetricDatasets(metrics, xmlPlan, problem, domain, movie);
                        //}
                        //XMLUtilities.printXML(metrics);

                        PlanNavigationList.getInstance().setList(xmlPlan, movie,
                                problem.getParentElement().getParentElement(),
                                (JPanel) movieMakerSplitPane.getLeftComponent(),
                                (JPanel) movieMakerSplitPane.getRightComponent());
                        replanMenu.setEnabled(true);
                    }
                }
            }.start();
        }
    });
    movieMakerToolBar.add(generateMovieButton);

    // back
    JButton backButton = new JButton("Backward", new ImageIcon("resources/images/backward.png"));
    backButton.setToolTipText("Backward");
    backButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JList navigationList = PlanNavigationList.getInstance().getPlanList();
            final int selected = navigationList.getSelectedIndex();
            if (selected > 0) {
                navigationList.setSelectedIndex(selected - 1);
            }
        }

    });
    movieMakerToolBar.add(backButton);

    // forward
    JButton forwardButton = new JButton("Forward", new ImageIcon("resources/images/forward.png"));
    forwardButton.setToolTipText("Forward");
    forwardButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JList navigationList = PlanNavigationList.getInstance().getPlanList();
            final int selected = navigationList.getSelectedIndex();
            if (selected > -1 && selected < navigationList.getModel().getSize() - 1) {
                navigationList.setSelectedIndex(selected + 1);
            }
        }

    });
    movieMakerToolBar.add(forwardButton);

    movieMakerToolBar.addSeparator();

    // zoom in
    //JButton zoomInButton = new JButton("Zoom In",new ImageIcon("resources/images/zoomIN.png"));
    JButton zoomInButton = new JButton(new ImageIcon("resources/images/zoomIN.png"));
    zoomInButton.setToolTipText("Zoom In");
    zoomInButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent e) {

            try {
                ItGraph leftGraph = (ItGraph) ((JScrollPane) ((JPanel) movieMakerSplitPane.getLeftComponent())
                        .getComponent(0)).getViewport().getView();
                leftGraph.setScale(leftGraph.getScale() * 1.25);

                ItGraph rightGraph = (ItGraph) ((JScrollPane) ((JPanel) movieMakerSplitPane.getRightComponent())
                        .getComponent(0)).getViewport().getView();
                rightGraph.setScale(rightGraph.getScale() * 1.25);
            } catch (Exception e1) {
            }

        }
    });
    movieMakerToolBar.add(zoomInButton);

    // zoom out
    //JButton zoomOutButton = new JButton("Zoom Out",new ImageIcon("resources/images/zoomOUT.png"));
    JButton zoomOutButton = new JButton(new ImageIcon("resources/images/zoomOUT.png"));
    zoomOutButton.setToolTipText("Zoom Out");
    zoomOutButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent e) {

            try {
                ItGraph leftGraph = (ItGraph) ((JScrollPane) ((JPanel) movieMakerSplitPane.getLeftComponent())
                        .getComponent(0)).getViewport().getView();
                leftGraph.setScale(leftGraph.getScale() * 0.8);

                ItGraph rightGraph = (ItGraph) ((JScrollPane) ((JPanel) movieMakerSplitPane.getRightComponent())
                        .getComponent(0)).getViewport().getView();
                rightGraph.setScale(rightGraph.getScale() * 0.8);
            } catch (Exception e1) {
            }

        }
    });
    movieMakerToolBar.add(zoomOutButton);

    // 1:1
    JButton oneToOneScaleButton = new JButton("1:1");
    oneToOneScaleButton.setToolTipText("1:1");
    oneToOneScaleButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent e) {

            try {
                ItGraph leftGraph = (ItGraph) ((JScrollPane) ((JPanel) movieMakerSplitPane.getLeftComponent())
                        .getComponent(0)).getViewport().getView();
                leftGraph.setScale(1.0);

                ItGraph rightGraph = (ItGraph) ((JScrollPane) ((JPanel) movieMakerSplitPane.getRightComponent())
                        .getComponent(0)).getViewport().getView();
                rightGraph.setScale(1.0);
            } catch (Exception e1) {
            }

        }
    });
    movieMakerToolBar.add(oneToOneScaleButton);

    movieMakerToolBar.addSeparator();

    // edit state
    JButton editStateButton = new JButton("Edit", new ImageIcon("resources/images/edit.png"));
    editStateButton.setToolTipText("Edit current state");
    editStateButton.addActionListener(new java.awt.event.ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            // take the current state
            Element currentState = PlanNavigationList.getInstance().getCurrentState();

            ItTreeNode problemNode = (ItTreeNode) problemsPlanTree.getLastSelectedPathComponent();
            ItTreeNode domainNode = (ItTreeNode) problemNode.getParent();
            ItTreeNode projectNode = (ItTreeNode) domainNode.getParent();

            // the object diagram must have parent
            //add the current state to the domain
            Element currentStateClone = (Element) currentState.clone();
            problemNode.getData().getChild("objectDiagrams").addContent(currentStateClone);

            graphTabbedPane.openEditStateTab(currentStateClone, domainNode.getData(), projectNode.getData());

            //mainTabbedPane.setSelectedIndex(0);
            CardLayout cl = (CardLayout) (mainTabbedPane.getLayout());
            cl.show(mainTabbedPane, "UML");
        }
    });
    movieMakerToolBar.add(editStateButton);

    movieMakerToolBar.addSeparator();
    // plan evaluation

    /*
    JButton planEvaluationButton = new JButton("Evaluate Plan", new ImageIcon("resources/images/eval.png"));
    planEvaluationButton.setToolTipText("<html>Generate a plan evaluation in the planReport. <br> This is restricted to non-time-based domain only.</html>");
    planEvaluationButton.addActionListener(new java.awt.event.ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
        //RUN plan evaluation
    generateEvaluatioReport.actionPerformed(e);
    }
    });
    movieMakerToolBar.add( planEvaluationButton);
     */

    // virtual reality

    JButton virtualRealityButton = new JButton("Virtual Prototyping",
            new ImageIcon("resources/images/virtualprototype.png"));
    virtualRealityButton.setToolTipText("Generate virtual prototype files");
    virtualRealityButton.addActionListener(new java.awt.event.ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            ItTreeNode problemNode = (ItTreeNode) problemsPlanTree.getLastSelectedPathComponent();
            ItTreeNode domainNode = (ItTreeNode) problemNode.getParent();
            //ItTreeNode projectNode = (ItTreeNode)domainNode.getParent();
            try {

                VirtualPrototypingBlender.generatePrototypeFiles(domainNode.getData(), problemNode.getData(),
                        xmlPlan);
                //VirtualRealityRobotNavigationDomain.generateBackgroundFile(problemNode.getData(), xmlPlan);
            } catch (IOException ex) {
                Logger.getLogger(ItSIMPLE.class.getName()).log(Level.SEVERE, null, ex);
            }
            //VirtualRealityRobotNavigationDomain.generateBackgroundFile(problemNode.getData(), xmlPlan);
        }
    });
    movieMakerToolBar.add(virtualRealityButton);

    return movieMakerToolBar;
}

From source file:src.gui.ItSIMPLE.java

private JToolBar getPlanEvaluationToolBar() {

    JToolBar planEvaluationToolBar = new JToolBar();
    planEvaluationToolBar.setRollover(true);

    // create the buttons

    // plan evaluation

    JButton planEvaluationButton = new JButton("Evaluate Plan", new ImageIcon("resources/images/eval.png"));
    planEvaluationButton.setToolTipText(
            "<html>Evaluate current plan based on the specified metrics. <br> This is restricted to non-time-based domain only.</html>");
    planEvaluationButton.addActionListener(new java.awt.event.ActionListener() {
        @Override/*from w ww.j a  v a2  s .co  m*/
        public void actionPerformed(ActionEvent e) {
            //RUN plan evaluation
            quickEvaluation.actionPerformed(e);
        }
    });
    planEvaluationToolBar.add(planEvaluationButton);

    JButton planEvaluationReportButton = new JButton("Evaluation Report",
            new ImageIcon("resources/images/viewreport.png"));
    planEvaluationReportButton.setToolTipText(
            "<html>Generate a html plan evaluation in the planReport. <br> This is restricted to non-time-based domain only.</html>");
    planEvaluationReportButton.addActionListener(new java.awt.event.ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            //RUN plan evaluation
            generateEvaluationReport.actionPerformed(e);
        }
    });
    planEvaluationToolBar.add(planEvaluationReportButton);

    JButton editEvaluationButton = new JButton("Edit Evaluation", new ImageIcon("resources/images/edit.png"));
    editEvaluationButton.setToolTipText("<html>Modify plan classification and its metrics evaluation.</html>");
    editEvaluationButton.addActionListener(new java.awt.event.ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            //RUN plan evaluation edit
            changePlanEvaluationAction.actionPerformed(e);
        }
    });
    planEvaluationToolBar.add(editEvaluationButton);

    //JButton applyNewEvaluationButton = new JButton("Apply Modified Evaluation",  new ImageIcon("resources/images/apply.png"));
    //planEvaluationToolBar.add(applyNewEvaluationButton);

    planEvaluationToolBar.addSeparator();

    JButton insertRationaleButton = new JButton("Insert Rationale",
            new ImageIcon("resources/images/feedbackrationale.png"));
    insertRationaleButton.addActionListener(new java.awt.event.ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            //RUN plan evaluation edit
            insertPlanEvaluationRationaleAction.actionPerformed(e);
        }
    });
    planEvaluationToolBar.add(insertRationaleButton);

    checkExistingRationaleButton = new JButton("Reuse Existing Rationales",
            new ImageIcon("resources/images/feedbackrationale.png"));
    checkExistingRationaleButton.setActionCommand("reuse");
    checkExistingRationaleButton.addActionListener(new java.awt.event.ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            //RUN rationales reuse
            if (checkExistingRationaleButton.getActionCommand().equals("reuse")) {
                checkExistingRationaleButton.setActionCommand("stop");
                checkExistingRationaleButton.setText("Stop Reasoning");
                reuseRationalesAction.actionPerformed(e);
            } else {
                //stop the thread
                if (reuserationaleThread.isAlive()) {
                    try {
                        // waits for the thread to return
                        reuserationaleThread.join(2000);// 2 seconds time-out
                    } catch (InterruptedException e1) {
                        e1.printStackTrace();
                    }
                    if (reuserationaleThread.isAlive()) {
                        reuserationaleThread.interrupt();
                    }
                }
                checkExistingRationaleButton.setActionCommand("reuse");
                checkExistingRationaleButton.setText("Reuse Existing Rationales");
                planSimStatusBar.setText("Status: Reasoning process stopped.");

            }

            /*
            try {
                    
                        
                String theoryText = "casa(a1). \n"+
                "casa(a2).\n"+
                "casa(a3).\n";
                         
                Prolog engine = new Prolog();
                Theory t = new Theory(new java.io.FileInputStream("/home/tiago/Desktop/base.pl"));
                //Theory t = new Theory(theoryText);
                engine.setTheory(t);
                //SolveInfo answer = engine.solve("casa(X).");
                        
                SolveInfo answer = engine.solve("teste(p1,_).");
                while (answer.isSuccess()) {
                    System.out.println("solution: " + answer.getSolution() + " - bindings: " + answer);                                
                    System.out.println("X: " + answer.getTerm("X"));
                    if (engine.hasOpenAlternatives()) {
                try {
                    answer = engine.solveNext();
                } catch (NoMoreSolutionException ex) {
                    Logger.getLogger(ItSIMPLE.class.getName()).log(Level.SEVERE, null, ex);
                }
                    } else {
                        break;
                    }
                }
                    
                //engine.solveHalt();
                    
                        
            } catch (UnknownVarException ex) {
                Logger.getLogger(ItSIMPLE.class.getName()).log(Level.SEVERE, null, ex);
            } catch (NoSolutionException ex) {
                Logger.getLogger(ItSIMPLE.class.getName()).log(Level.SEVERE, null, ex);
            } catch (MalformedGoalException ex) {
                Logger.getLogger(ItSIMPLE.class.getName()).log(Level.SEVERE, null, ex);
            } catch (InvalidTheoryException ex) {
                Logger.getLogger(ItSIMPLE.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(ItSIMPLE.class.getName()).log(Level.SEVERE, null, ex);
            }
            */

        }
    });
    planEvaluationToolBar.add(checkExistingRationaleButton);

    //JButton addPlanToDatabaseButton = new JButton("Add Plan to Database",  new ImageIcon("resources/images/addplantodatabase.png"));
    //addPlanToDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
    //        @Override
    //        public void actionPerformed(ActionEvent e) {
    //            //RUN plan evaluation edit
    //            insertPlanIntoDatabaseAction.actionPerformed(e);
    //        }
    //});
    //planEvaluationToolBar.add(addPlanToDatabaseButton);

    return planEvaluationToolBar;
}

From source file:src.gui.ItSIMPLE.java

private JToolBar getPlanDatabaseToolBar() {

    JToolBar planDatabaseToolBar = new JToolBar();
    planDatabaseToolBar.setRollover(true);

    // create the buttons

    //select plans from data base

    JButton searchButton = new JButton("Search", new ImageIcon("resources/images/searchdatabase.png"));
    searchButton.setToolTipText("Search plans in the database");
    searchButton.addActionListener(new java.awt.event.ActionListener() {
        @Override//ww w . j a v  a2  s  .  c  o m
        public void actionPerformed(ActionEvent e) {
            //RUN search plan from database
            searchPlanInDatabaseAction.actionPerformed(e);
        }
    });
    planDatabaseToolBar.add(searchButton);

    final JButton filterButton = new JButton("Filter",
            new ImageIcon("resources/images/filtersearchdatabase.png"));
    filterButton
            .setToolTipText("Filter the search for plans in the database (use colunms of table 'plan' only)");
    filterButton.addActionListener(new java.awt.event.ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            //hide/show filter panel
            if (planFilterPanel.isVisible()) {
                planFilterPanel.setVisible(false);
                filterButton.setText("Filter");
            } else {
                planFilterPanel.setVisible(true);
                filterButton.setText("Don't filter");
            }
        }
    });
    planDatabaseToolBar.add(filterButton);

    planDatabaseToolBar.addSeparator();

    //insert plan into data base
    JButton addPlanToDatabaseButton = new JButton("Add Plan",
            new ImageIcon("resources/images/addplantodatabase.png"));
    addPlanToDatabaseButton.setToolTipText("Add current plan to the database");
    addPlanToDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            //RUN plan evaluation edit
            insertPlanIntoDatabaseAction.actionPerformed(e);
        }
    });
    planDatabaseToolBar.add(addPlanToDatabaseButton);

    //load plan from data base
    JButton loadPlanFromDatabaseButton = new JButton("Load Plan",
            new ImageIcon("resources/images/getfromdatabase.png"));
    loadPlanFromDatabaseButton.setToolTipText("Load selected plan into itSIMPLE");
    loadPlanFromDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            //RUN loading plan
            loadPlanFromDatabaseAction.actionPerformed(e);
        }
    });
    planDatabaseToolBar.add(loadPlanFromDatabaseButton);

    //delete plan from data base
    JButton deletePlanFromDatabaseButton = new JButton("Delete Plan",
            new ImageIcon("resources/images/deleteplanfromdatabase.png"));
    deletePlanFromDatabaseButton.setToolTipText("Delete selected plan");
    deletePlanFromDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            //RUN loading plan
            deletePlanFromDatabaseAction.actionPerformed(e);
        }
    });
    planDatabaseToolBar.add(deletePlanFromDatabaseButton);

    //update plan from data base
    JButton updatePlanFromDatabaseButton = new JButton("Update Plan",
            new ImageIcon("resources/images/updateplanfromdatabase.png"));
    updatePlanFromDatabaseButton.setToolTipText("Update current plan");
    updatePlanFromDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            //RUN update plan
            updatePlanFromDatabaseAction.actionPerformed(e);
        }
    });
    planDatabaseToolBar.add(updatePlanFromDatabaseButton);

    return planDatabaseToolBar;
}

From source file:src.gui.ItSIMPLE.java

private JToolBar getRationaleDatabaseToolBar() {

    JToolBar rationaleDatabaseToolBar = new JToolBar();
    rationaleDatabaseToolBar.setRollover(true);

    // create the buttons

    //select rationales from data base
    JButton searchButton = new JButton("Search", new ImageIcon("resources/images/searchdatabase.png"));
    searchButton.setToolTipText("Search rationales in the database");
    searchButton.addActionListener(new java.awt.event.ActionListener() {
        @Override//  ww w.  j a va  2  s.c  om
        public void actionPerformed(ActionEvent e) {
            //RUN search plan from database
            searchRationaleInDatabaseAction.actionPerformed(e);
        }
    });
    rationaleDatabaseToolBar.add(searchButton);

    rationaleDatabaseToolBar.addSeparator();

    /*
    //insert new rationale into data base
    JButton addRationaleToDatabaseButton = new JButton("Add Plan",  new ImageIcon("resources/images/addplantodatabase.png"));
    addRationaleToDatabaseButton.setToolTipText("Add current plan to the database");
    addRationaleToDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                //RUN plan evaluation edit
                insertPlanIntoDatabaseAction.actionPerformed(e);
            }
    });
    rationaleDatabaseToolBar.add(addRationaleToDatabaseButton);
     */

    //edit rationale from database
    JButton editRatioanleFromDatabaseButton = new JButton("Edit Rationale",
            new ImageIcon("resources/images/editrationalefromdatabase.png"));
    editRatioanleFromDatabaseButton.setToolTipText("Edit selected rationale");
    editRatioanleFromDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            //RUN editing plan
            editRationaleFromDatabaseAction.actionPerformed(e);
        }
    });
    rationaleDatabaseToolBar.add(editRatioanleFromDatabaseButton);

    //delete rationale from database
    JButton deleteRationaleFromDatabaseButton = new JButton("Delete Rationale",
            new ImageIcon("resources/images/deleteplanfromdatabase.png"));
    deleteRationaleFromDatabaseButton.setToolTipText("Delete selected rationale");
    deleteRationaleFromDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            //RUN loading plan
            deleteRationaleFromDatabaseAction.actionPerformed(e);
        }
    });
    rationaleDatabaseToolBar.add(deleteRationaleFromDatabaseButton);

    rationaleDatabaseToolBar.addSeparator();

    //load reference plan from database
    JButton loadReferencePlanFromDatabaseButton = new JButton("Load Plan",
            new ImageIcon("resources/images/getfromdatabase.png"));
    loadReferencePlanFromDatabaseButton.setToolTipText("Load reference plan of the selected rationale");
    loadReferencePlanFromDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            //RUN editing plan
            loadReferencePlanFromDatabaseAction.actionPerformed(e);
        }
    });
    rationaleDatabaseToolBar.add(loadReferencePlanFromDatabaseButton);

    return rationaleDatabaseToolBar;
}

From source file:nz.ac.massey.cs.gql4jung.browser.ResultBrowser.java

private void initToolbar() {
    toolbar = new JToolBar();
    toolbar.setFloatable(false);//from   ww  w  . j  a  v a 2 s .com
    mainPanel.add(toolbar, BorderLayout.NORTH);
    toolbar.add(actLoadData);
    toolbar.add(actLoadQuery);
    toolbar.addSeparator();
    toolbar.add(actRunQuery);
    toolbar.add(actCancelQuery);
    toolbar.addSeparator();
    toolbar.add(actPreviousMajorInstance);
    toolbar.add(actNextMajorInstance);
    toolbar.addSeparator();
    toolbar.add(actPreviousMinorInstance);
    toolbar.add(actNextMinorInstance);
    toolbar.addSeparator();
    toolbar.add(actExport2CSV);
}

From source file:org.aaloa.zb4osgi.network.browser.ui.NetworkGraph.java

private Component getToolBar() {
    if (jToolBar != null)
        return jToolBar;

    jToolBar = new JToolBar();
    addButton(jToolBar, "P", new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            DefaultModalGraphMouse<ZigBeeNode, Paint> hci = new DefaultModalGraphMouse<ZigBeeNode, Paint>();
            hci.setMode(ModalGraphMouse.Mode.PICKING);
            getGraphViewer().setGraphMouse(hci);
            statusMiddle.setText("Pick Mode");

        }//from w  ww.  j a v  a  2s.  c  o m
    });
    addButton(jToolBar, "T", new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            DefaultModalGraphMouse<ZigBeeNode, Paint> hci = new DefaultModalGraphMouse<ZigBeeNode, Paint>();
            hci.setMode(ModalGraphMouse.Mode.TRANSFORMING);
            getGraphViewer().setGraphMouse(hci);
            statusMiddle.setText("Transform Mode");

        }
    });
    return jToolBar;
}

From source file:org.apache.cayenne.modeler.CayenneModelerFrame.java

/** Initializes main toolbar. */
protected void initToolbar() {
    JToolBar toolBar = new JToolBar();

    toolBar.add(getAction(NewProjectAction.class).buildButton());
    toolBar.add(getAction(OpenProjectAction.class).buildButton());
    toolBar.add(getAction(SaveAction.class).buildButton());

    toolBar.addSeparator();//from   ww  w  . j a  v a2  s.c o  m
    toolBar.add(getAction(RemoveAction.class).buildButton());

    toolBar.addSeparator();

    toolBar.add(getAction(CutAction.class).buildButton());
    toolBar.add(getAction(CopyAction.class).buildButton());
    toolBar.add(getAction(PasteAction.class).buildButton());

    toolBar.addSeparator();

    toolBar.add(getAction(UndoAction.class).buildButton());
    toolBar.add(getAction(RedoAction.class).buildButton());

    toolBar.addSeparator();

    toolBar.add(getAction(CreateNodeAction.class).buildButton());
    toolBar.add(getAction(CreateDataMapAction.class).buildButton());

    toolBar.addSeparator();

    toolBar.add(getAction(CreateDbEntityAction.class).buildButton());
    toolBar.add(getAction(CreateProcedureAction.class).buildButton());

    toolBar.addSeparator();

    toolBar.add(getAction(CreateObjEntityAction.class).buildButton());
    toolBar.add(getAction(CreateEmbeddableAction.class).buildButton());
    toolBar.add(getAction(CreateQueryAction.class).buildButton());

    toolBar.addSeparator();

    toolBar.add(getAction(NavigateBackwardAction.class).buildButton());
    toolBar.add(getAction(NavigateForwardAction.class).buildButton());

    JPanel east = new JPanel(new BorderLayout()); // is used to place search feature
    // components the most right on a
    // toolbar
    final JTextField findField = new JTextField(10);
    findField.addKeyListener(new KeyListener() {

        public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() != KeyEvent.VK_ENTER) {
                findField.setBackground(Color.white);
            }
        }

        public void keyReleased(KeyEvent e) {
        }

        public void keyTyped(KeyEvent e) {
        }

    });
    findField.setAction(getAction(FindAction.class));
    JLabel findLabel = new JLabel("Search:");
    findLabel.setLabelFor(findField);
    Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

        public void eventDispatched(AWTEvent event) {

            if (event instanceof KeyEvent) {

                if (((KeyEvent) event).getModifiers() == Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()
                        && ((KeyEvent) event).getKeyCode() == KeyEvent.VK_F) {
                    findField.requestFocus();
                }
            }
        }

    }, AWTEvent.KEY_EVENT_MASK);

    JPanel box = new JPanel(); // is used to place label and text field one after
    // another
    box.setLayout(new BoxLayout(box, BoxLayout.X_AXIS));
    box.add(findLabel);
    box.add(findField);
    east.add(box, BorderLayout.EAST);
    toolBar.add(east);

    getContentPane().add(toolBar, BorderLayout.NORTH);
}

From source file:org.apache.cayenne.modeler.editor.AbstractCallbackMethodsTab.java

/**
 * GUI components initialization/*from   w  w w  .jav  a2 s  .  com*/
 */
protected void init() {
    this.setLayout(new BorderLayout());

    toolBar = new JToolBar();
    toolBar.add(getRemoveCallbackMethodAction().buildButton());
    toolBar.addSeparator(new Dimension(10, 0));
    toolBar.add(getCopyCallbackMethodAction().buildButton());
    toolBar.add(getCutCallbackMethodAction().buildButton());
    toolBar.add(getPasteCallbackMethodAction().buildButton());

    add(toolBar, BorderLayout.NORTH);

    auxPanel = new JPanel();
    auxPanel.setOpaque(false);
    auxPanel.setLayout(new BorderLayout());

    popupMenu = createPopup();

    createTables();

    add(new JScrollPane(auxPanel), BorderLayout.CENTER);
}