Example usage for javax.swing JTabbedPane JTabbedPane

List of usage examples for javax.swing JTabbedPane JTabbedPane

Introduction

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

Prototype

public JTabbedPane() 

Source Link

Document

Creates an empty TabbedPane with a default tab placement of JTabbedPane.TOP.

Usage

From source file:analysis.postRun.PostRunWindow.java

/**
  * Method which redraws all tabs./*  ww w.  j a  va 2s . c om*/
  */
private void redrawAll() {
    MainPanel.remove(tabbedPane);
    tabbedPane = new JTabbedPane();
    failureTab(true);
    cpuTab(true);
    servTab(true);
    costTab(true);
    consistencyTab(true);
    tabbedPane.setSelectedIndex(0);
    MainPanel.add(tabbedPane, BorderLayout.CENTER);
    MainPanel.revalidate(); //makes it actually appear on redraw!
}

From source file:com.project.traceability.GUI.ProjectCreateWindow.java

/**
 * Create contents of the window.//from ww  w .  j av  a  2  s . com
 */
protected void createContents() {
    shell = new Shell();
    shell.setSize(622, 833);
    shell.setText("SWT Application");

    Dimension.toCenter(shell);// set the shell into center point
    Group group = new Group(shell, SWT.NONE);
    group.setText("Project");
    group.setBounds(20, 42, 556, 137);

    Label label = new Label(group, SWT.NONE);
    label.setText("New Workspace Path");
    label.setBounds(0, 5, 175, 18);

    lalProjectWrkspace = new Label(shell, SWT.NONE);
    lalProjectWrkspace.setText(StaticData.workspace);
    lalProjectWrkspace.setBounds(221, 10, 347, 17);

    textWrkspace = new Text(group, SWT.BORDER);
    textWrkspace.addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent e) {

            if (e.keyCode == 10) {

                // The Project work space is entered and pressed enter
                // button
                String path = textWrkspace.getText().toString();
                File file = new File(path);

                if (!(file.isDirectory() || file.exists())) {
                    txtProjectName.setEnabled(true);
                    if (!(path.lastIndexOf(File.separator) == path.length() - 1)) {
                        path.concat(File.separator);
                    }
                    StaticData.workspace = path;
                } else {
                    MessageBox messageBox;
                    messageBox = new MessageBox(shell, SWT.ERROR);
                    messageBox.setMessage("Given Path is Invalid");
                    messageBox.setText("Invalid Path Exception");
                    messageBox.open();
                }
            }
        }
    });
    textWrkspace.setEnabled(false);
    textWrkspace.setEditable(false);
    textWrkspace.setBounds(181, 5, 290, 23);

    final Button buttonWrkspace = new Button(group, SWT.NONE);
    buttonWrkspace.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {

            DirectoryDialog dialog = new DirectoryDialog(shell);
            String str = dialog.open();

            if (!str.equals("")) {
                txtProjectName.setEnabled(true);
                textWrkspace.setText(str);
                lalProjectWrkspace.setText(str);
            }
        }
    });
    buttonWrkspace.setText("Browse");
    buttonWrkspace.setEnabled(false);
    buttonWrkspace.setBounds(477, 5, 75, 25);

    Label label_1 = new Label(group, SWT.NONE);
    label_1.setText("Traceabilty Project Name");
    label_1.setBounds(0, 75, 175, 21);

    Group group_1 = new Group(shell, SWT.NONE);
    group_1.setText("Import Required Files");
    group_1.setBounds(20, 190, 556, 174);

    Label label_3 = new Label(group_1, SWT.NONE);
    label_3.setText("Requirement File");
    label_3.setBounds(10, 37, 137, 18);

    txtRequirementPath = new Text(group_1, SWT.BORDER);
    txtRequirementPath.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {

            if (!txtRequirementPath.getText().equals("")) {
                if (!txtUmlPath.getText().equals("") && !txtProjectPath.getText().equals("")
                        && !text_1.getText().equals("") && !text_2.getText().equals("")
                        && !text_3.getText().equals("") && !text_5.getText().equals("")
                        && !text_6.getText().equals("")) {
                    btnFinish.setEnabled(true);
                }
            } else {
                btnFinish.setEnabled(false);
            }
        }
    });
    txtRequirementPath.setEnabled(false);
    txtRequirementPath.setEditable(false);
    txtRequirementPath.setBounds(153, 31, 317, 27);

    btnReqBrwse = new Button(group_1, SWT.NONE);
    btnReqBrwse.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {

            org.eclipse.swt.widgets.FileDialog fileDialog = new org.eclipse.swt.widgets.FileDialog(shell,
                    SWT.SINGLE);
            fileDialog.setText("Open");
            fileDialog.setFilterExtensions(req_formats); // Windows
            fileDialog.setFilterPath(PropertyFile.docsFilePath);
            localFilePath = fileDialog.open();
            if (localFilePath != null) {
                PropertyFile.docsFilePath = localFilePath;
                txtRequirementPath.setText(PropertyFile.docsFilePath);
            }
        }
    });
    btnReqBrwse.setText("Browse");
    btnReqBrwse.setEnabled(false);
    btnReqBrwse.setBounds(476, 31, 75, 29);

    Label label_4 = new Label(group_1, SWT.NONE);
    label_4.setText("Design Diagram File");
    label_4.setBounds(10, 81, 137, 18);

    txtUmlPath = new Text(group_1, SWT.BORDER);
    txtUmlPath.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {

            if (!txtUmlPath.getText().equals("")) {
                if (!txtRequirementPath.getText().equals("") && !txtProjectPath.getText().equals("")
                        && !text_1.getText().equals("") && !text_2.getText().equals("")
                        && !text_3.getText().equals("") && !text_5.getText().equals("")
                        && !text_6.getText().equals("")) {
                    btnFinish.setEnabled(true);
                }
            } else {
                btnFinish.setEnabled(false);
            }

        }
    });
    txtUmlPath.setEnabled(false);
    txtUmlPath.setEditable(false);
    txtUmlPath.setBounds(153, 72, 317, 27);

    final Button btnUmlBrwse = new Button(group_1, SWT.NONE);
    btnUmlBrwse.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {

            org.eclipse.swt.widgets.FileDialog fileDialog = new org.eclipse.swt.widgets.FileDialog(shell,
                    SWT.MULTI);
            fileDialog.setText("Open");
            fileDialog.setFilterExtensions(uml_formats); // Windows
            fileDialog.setFilterPath(StaticData.umlFilePath);
            localFilePath = fileDialog.open();
            StaticData.umlFilePath = localFilePath;
            localFilePath = localFilePath.replace(Paths.get(localFilePath).getFileName().toString(), "");
            if (localFilePath != null) {
                txtUmlPath.setText(StaticData.umlFilePath);
            }
        }
    });
    btnUmlBrwse.setText("Browse");
    btnUmlBrwse.setEnabled(false);
    btnUmlBrwse.setBounds(476, 74, 75, 27);

    Label label_5 = new Label(group_1, SWT.NONE);
    label_5.setText("Project Path");
    label_5.setBounds(10, 126, 137, 18);

    txtProjectPath = new Text(group_1, SWT.BORDER);
    txtProjectPath.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            if (!txtProjectPath.getText().equals("")) {
                if (!txtRequirementPath.getText().equals("") && !txtUmlPath.getText().equals("")
                        && !text_1.getText().equals("") && !text_2.getText().equals("")
                        && !text_3.getText().equals("") && !text_5.getText().equals("")
                        && !text_6.getText().equals("")) {
                    btnFinish.setEnabled(true);
                }
            } else {
                btnFinish.setEnabled(false);
            }

        }
    });
    txtProjectPath.setEnabled(false);
    txtProjectPath.setEditable(false);
    txtProjectPath.setBounds(153, 120, 317, 27);

    final Button btnSrcBrwse = new Button(group_1, SWT.NONE);
    btnSrcBrwse.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {

            /*
             * Pop up File Chooser Window
             */
            DirectoryDialog directoryDialog = new DirectoryDialog(shell);
            directoryDialog.setText("Open");
            localFilePath = directoryDialog.open();
            StaticData.sourceFilePath = localFilePath;
            localFilePath = localFilePath.replace(Paths.get(localFilePath).getFileName().toString(), "");
            String root = "";// HomeGUI.tree.getToolTipText() +
                             // File.separator +
                             // txtProjectName.getText();
            String path = root + File.separator + FilePropertyName.SOURCE_CODE;
            srcJavaDir = new File(path);
            if (localFilePath != null) {
                txtProjectPath.setText(StaticData.sourceFilePath);
                boolean src = AccessProject.javaFilesExists(new File(StaticData.sourceFilePath.toString()));
                System.out.println("Java Files " + src);

                // &&!text_1.getText().equals("")&&!text_2.getText().equals("")&&!text_3.getText().equals("")&&!text_5.getText().equals("")&&!text_6.getText().equals("")
                if (src) {
                    if (!txtRequirementPath.getText().equals("") && !txtUmlPath.getText().equals("")) {

                        btnFinish.setEnabled(true);
                    }
                } else {
                    txtProjectPath.setText("");
                    // JOptionPane.showMessageDialog(null, "Error in java
                    // project file path...", "Java Project Error",
                    // JOptionPane.ERROR_MESSAGE);
                }
            }
        }
    });
    btnSrcBrwse.setText("Browse");
    btnSrcBrwse.setEnabled(false);
    btnSrcBrwse.setBounds(476, 120, 75, 27);

    final Button btnOk = new Button(group, SWT.NONE);
    btnOk.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            path_workspacepath = lalProjectWrkspace.getText();
            name_project = txtProjectName.getText();
            path_testfolder = path_workspacepath + File.separator + name_project;
            System.out.println(path_testfolder);
            try {
                FileUtils.forceMkdir(new File(path_testfolder));

            } catch (IOException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }

            String projectName = txtProjectName.getText();
            if (isNameValid(projectName)) {
                txtRequirementPath.setEnabled(true);
                txtUmlPath.setEnabled(true);
                txtProjectPath.setEnabled(true);
                text_1.setEnabled(true);
                text_2.setEnabled(true);
                text_3.setEnabled(true);
                text_5.setEnabled(true);
                text_6.setEnabled(true);

                btnReqBrwse.setEnabled(true);
                btnSrcBrwse.setEnabled(true);
                btnUmlBrwse.setEnabled(true);
                button.setEnabled(true);
                button_1.setEnabled(true);
                button_3.setEnabled(true);
                button_5.setEnabled(true);
                button_6.setEnabled(true);

            } else {
                /*
                 * name is not valid produce pop up message to user
                 * 
                 */
            }
        }
    });
    btnOk.setBounds(477, 67, 77, 29);
    btnOk.setText("Ok");
    Composite composite = new Composite(shell, SWT.NONE);
    composite.setBounds(20, 648, 556, 62);

    final Label lblNewLabel = new Label(composite, SWT.NONE);
    lblNewLabel.setBounds(24, 10, 459, 17);
    lblNewLabel.setText("");
    lblNewLabel.setForeground(new org.eclipse.swt.graphics.Color(Display.getCurrent(), 255, 0, 0));

    txtProjectName = new Text(group, SWT.BORDER);
    txtProjectName.addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent e) {
            //
            // File file = new
            // File(StaticData.workspace,txtProjectName.getText());
            // if(file.exists()){
            // btnOk.setEnabled(false);
            // }else{
            // btnOk.setEnabled(true);
            // }
        }

        @Override
        public void keyReleased(KeyEvent e) {

            File file = new File(StaticData.workspace, txtProjectName.getText());
            String typedName = txtProjectName.getText();
            boolean isProjectNameExists = isProjectExists(typedName);
            lblNewLabel.setText("");
            if (file.exists() || isProjectNameExists) {
                btnOk.setEnabled(false);

                txtRequirementPath.setEnabled(false);
                txtUmlPath.setEnabled(false);
                txtProjectPath.setEnabled(false);

                btnReqBrwse.setEnabled(false);
                btnSrcBrwse.setEnabled(false);
                btnUmlBrwse.setEnabled(false);

                btnFinish.setEnabled(false);

                if (!typedName.equals(""))
                    lblNewLabel.setText(
                            "You typed project name exists in " + allProjectsNamePathMap.get(typedName));
                else
                    lblNewLabel.setText("Project Name should not empty");
            } else {
                btnOk.setEnabled(true);
                lblNewLabel.setForeground(new org.eclipse.swt.graphics.Color(Display.getCurrent(), 255, 0, 0));
                lblNewLabel.setText("Project Name is valid");
            }
        }

        private boolean isProjectExists(String text) {
            // TODO Auto-generated method stub
            boolean isExits = false;
            if (allProjectsNamePathMap != null && allProjectsNamePathMap.containsKey(text)) {
                isExits = false;
            } else {
                // no need
                List<String> names = new ArrayList<>(allProjectsNamePathMap.keySet());
                for (String name : names) {
                    if (name.equals(text)) {
                        isExits = true;
                        return isExits;
                    }
                }
                isExits = false;
            }

            return isExits;
        }
    });
    txtProjectName.setText("");
    txtProjectName.setEnabled(true);
    txtProjectName.setBounds(182, 72, 278, 24);

    final Button btnNewWrkspace = new Button(group, SWT.CHECK);
    btnNewWrkspace.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {

            if (!btnNewWrkspace.getSelection()) {
                buttonWrkspace.setEnabled(false);
                textWrkspace.setEnabled(false);
                txtProjectName.setEnabled(true);
                btnOk.setEnabled(true);
            } else {
                buttonWrkspace.setEnabled(true);
                textWrkspace.setEnabled(true);
                txtProjectName.setEnabled(false);
                btnOk.setEnabled(false);
            }
        }
    });
    btnNewWrkspace.setText("Create New Workspace");
    btnNewWrkspace.setBounds(270, 34, 199, 24);

    button_2 = new Button(composite, SWT.NONE);
    button_2.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            shell.dispose();
        }
    });

    lblNewLabel.setText("");
    lblNewLabel.setForeground(new org.eclipse.swt.graphics.Color(Display.getCurrent(), 255, 0, 0));

    button_2.setText("Cancel");
    // button_2.setImage(SWTResourceManager.getImage("null"));
    button_2.setBounds(10, 29, 75, 25);

    btnFinish = new Button(composite, SWT.NONE);
    btnFinish.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {

            // MainClass mainClass = new
            // MainClass(text_5.getText(),text_6.getText());
            // mainClass.startConfig();
            //
            // Main m = new Main(text_1.getText(),text_2.getText());
            // m.startDeployment();
            //
            //
            // try {
            // TestAST testAST = new TestAST(text_3.getText());
            // testAST.TestingTraceability();
            // } catch (IOException e1) {
            // // TODO Auto-generated catch block
            // e1.printStackTrace();
            // } catch (TransformerException e1) {
            // // TODO Auto-generated catch block
            // e1.printStackTrace();
            // }
            //

            String projectName = txtProjectName.getText();

            // making script file for this project
            File file_root_script_folder = new File(PropertyFile.configuration_root + "scripts");
            if (!file_root_script_folder.exists())// home/shiyam/SAT_CONFIGS/scripts/
                file_root_script_folder.mkdirs(); // making script file for
            // each projects

            File script_file = FilePropertyName.createScriptFile(projectName + ".py");

            String scripts = ScriptContents.getContents(projectName);
            FilePropertyName.writeScriptContent(script_file, scripts);
            // finished the script file creation

            String reqFilePath = PropertyFile.docsFilePath;
            String umFilePath = StaticData.umlFilePath;
            String srcFilePath = StaticData.sourceFilePath;

            if (!(StaticData.workspace.lastIndexOf(File.separator) == StaticData.workspace.length() - 1)) {
                StaticData.workspace += (File.separator);
            }

            File projectRoot = new File(StaticData.workspace + projectName + File.separator);
            try {
                projectRoot.mkdir();
                ProjectCreateWindow.projectName = projectName;
            } catch (Exception e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
            File reqFile = new File(reqFilePath);
            File umlFile = new File(umFilePath);
            File srcFile = new File(srcFilePath);

            String projectAbsoulutePath = projectRoot.getAbsolutePath();
            System.out.println("!234");
            if (!(projectAbsoulutePath.lastIndexOf(File.separator) == projectAbsoulutePath.length() - 1)) {
                projectAbsoulutePath += (File.separator);
            }

            File srcFolder = new File(projectAbsoulutePath + FilePropertyName.SOURCE_CODE);
            try {
                srcFolder.mkdir();
                FilePropertyName.copyFolder(srcFile, srcFolder);

                File txtFolder = new File(projectAbsoulutePath + FilePropertyName.REQUIREMENT);
                txtFolder.mkdir();

                FilePropertyName.copyFile(reqFile, txtFolder);

                File umlFolder = new File(projectAbsoulutePath + FilePropertyName.UML);
                umlFolder.mkdir();

                FilePropertyName.copyFile(umlFile, umlFolder);

                File xmlFolder = new File(projectAbsoulutePath + FilePropertyName.XML);
                xmlFolder.mkdir();
                // PropertyFile.setRelationshipXMLPath(xmlFolder +
                // File.separator + FilePropertyName.RELATION_NAME);

                RelationManager.createXML(projectAbsoulutePath.substring(0, projectAbsoulutePath.length() - 1));
                // RelationManager.createXML(projectAbsoulutePath+FilePropertyName.XML);

                File propertyFolder = new File(projectAbsoulutePath + FilePropertyName.PROPERTY);
                propertyFolder.mkdir();

                // projectPath = PropertyFile.filePath + File.separator;
                projectPath = PropertyFile.filePath;
                System.out.println("---Project create window : line473 : " + projectPath);
                PropertyFile.setProjectName(projectName);
                PropertyFile.setGraphDbPath(projectPath + File.separator + FilePropertyName.PROPERTY
                        + File.separator + projectName + ".graphdb");
                PropertyFile.setGeneratedGexfFilePath(projectPath + File.separator + FilePropertyName.PROPERTY
                        + File.separator + projectName + ".gexf");
                PropertyFile.setRelationshipXMLPath(projectPath + "Relations.xml");

                HomeGUI.shell.setText("SAT- " + projectName);
                HomeGUI.newTab.setVisible(true);
                HomeGUI.tree.setVisible(true);

                System.out.println("---Project create window : line486 : " + projectPath);
                RelationManager.createXML(projectPath + projectName);

                /*
                 * write the sat_configuration.xml file with new project
                 * node and workspace node if needed
                 */
                Adapter.wrkspace = StaticData.workspace;
                Adapter.projectPath = StaticData.workspace + projectName;
                Adapter.createProjectNode();

                String temp = lalProjectWrkspace.getText().concat(File.separator);

                if (!temp.equals(StaticData.workspace)) {
                    StaticData.workspace = temp;
                    Adapter.createwrkpace("false");
                } else {
                    StaticData.workspace = temp;
                    Adapter.changeExistingWrkspaceStatus(StaticData.workspace, false);
                }
                System.out.println("Name: " + reqFilePath);
                // String[] names=reqFilePath.split(""+File.separator);
                // String requirementFileName=names[names.length-1];
                String requirementFileName = reqFilePath.substring(reqFilePath.lastIndexOf(File.separator));
                System.out.println("Re: " + requirementFileName);
                StaticData.requirementFilePath = projectAbsoulutePath + FilePropertyName.REQUIREMENT
                        + File.separator + requirementFileName;
                System.out
                        .println("----------Requirement file path--------- " + StaticData.requirementFilePath);

                Thread requirementThread = new Thread(new Runnable() {
                    public void run() {
                        try {
                            XMLConversion.convertRequirementFile();
                        } catch (Exception ex) {
                            Exceptions.printStackTrace(ex);
                        }
                    }
                });
                requirementThread.start();

                Thread javaFilesThread = new Thread(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            XMLConversion.convertJavaFiles();
                        } catch (Exception ex) {
                            Exceptions.printStackTrace(ex);
                        }
                    }
                });
                javaFilesThread.start();

                Thread umlThread = new Thread(new Runnable() {
                    @Override
                    public void run() {
                        XMLConversion.convertUMLFile();
                    }
                });
                umlThread.start();

                while (requirementThread.isAlive() || javaFilesThread.isAlive() || umlThread.isAlive()) {
                    StringBuilder aliveThread = new StringBuilder();
                    if (requirementThread.isAlive()) {
                        aliveThread.append("Requirement");
                        aliveThread.append(" ");
                    }
                    if (javaFilesThread.isAlive()) {
                        aliveThread.append("Source Code");
                        aliveThread.append(" ");
                    }
                    if (umlThread.isAlive()) {
                        aliveThread.append("UML");
                        aliveThread.append(" ");
                    }

                    lblNewLabel.setText(aliveThread.toString() + " Extraction On Progress");

                }
                System.out.println("Thread finished");
                /*
                 * XMLConversion.convertRequirementFile();
                 * XMLConversion.convertUMLFile();
                 * XMLConversion.convertJavaFiles();
                 */
                shell.dispose();
                HomeGUI.closeMain(HomeGUI.shell);
                HomeGUI.main(null);

            } catch (IOException e1) {
                displayError(e1.toString());
            } catch (Exception e12) {
                displayError(e12.toString());
                shell.dispose();
                HomeGUI.closeMain(HomeGUI.shell);
                HomeGUI.main(null);
            }
            // System.out.println("NLP OK...........");

        }

    });
    btnFinish.setText("Development");
    btnFinish.setEnabled(false);
    btnFinish.setBounds(471, 29, 75, 25);

    Button btnConfiguration = new Button(composite, SWT.NONE);
    btnConfiguration.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent arg0) {
            MainClass mainClass = new MainClass(text_5.getText(), text_6.getText());
            mainClass.startConfig();
            panels.put("config", config(configname));

            JTabbedPane pane = new JTabbedPane();
            pane.add("Config", panels.get("config"));

            if (panels.containsKey("test")) {
                pane.add("Test", panels.get("test"));
            }
            if (panels.containsKey("deploy")) {
                pane.add("Deploy", panels.get("deploy"));
            }
            frame1.remove(jTabbedPane);
            frame1.add(pane);
            jTabbedPane = pane;
            frame1.pack();
            frame1.setVisible(true);
        }
    });
    btnConfiguration.setText("Configuration");
    btnConfiguration.setEnabled(true);
    btnConfiguration.setBounds(120, 29, 94, 25);

    Button btnDeployment = new Button(composite, SWT.NONE);
    btnDeployment.setBounds(367, 29, 75, 25);
    btnDeployment.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent arg0) {
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            Main m = new Main(text_1.getText(), text_2.getText());
            m.startDeployment();

            panels.put("deploy", deploy(deployname));

            JTabbedPane pane = new JTabbedPane();
            pane.add("Deploy", panels.get("deploy"));

            if (panels.containsKey("test")) {
                pane.add("Test", panels.get("test"));
            }
            if (panels.containsKey("config")) {
                pane.add("Config", panels.get("config"));
            }
            frame1.remove(jTabbedPane);
            frame1.add(pane);
            jTabbedPane = pane;
            frame1.pack();
            frame1.setVisible(true);
        }
    });
    btnDeployment.setText("Deployment");
    btnDeployment.setEnabled(true);

    Button btnTesting = new Button(composite, SWT.NONE);
    btnTesting.setBounds(251, 29, 75, 25);
    btnTesting.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent arg0) {
            try {
                TestAST testAST = new TestAST(text_3.getText());
                testAST.TestingTraceability(path_testfolder);

                panels.put("test", test(testname));
                JTabbedPane pane = new JTabbedPane();
                pane.add("Test", panels.get("test"));

                if (panels.containsKey("config")) {
                    pane.add("Config", panels.get("config"));
                }
                if (panels.containsKey("deploy")) {
                    pane.add("Deploy", panels.get("deploy"));
                }

                frame1.remove(jTabbedPane);
                frame1.add(pane);
                jTabbedPane = pane;
                frame1.pack();
                frame1.setVisible(true);

            } catch (IOException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            } catch (TransformerException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
        }
    });
    btnTesting.setText("Testing");
    btnTesting.setEnabled(true);

    Label label_6 = new Label(shell, SWT.NONE);
    label_6.setText("New project will be created ");
    label_6.setBounds(20, 10, 189, 17);

    Group grpExetendedSatAnalizer = new Group(shell, SWT.NONE);
    grpExetendedSatAnalizer.setText("Exetended SAT Analizer");
    grpExetendedSatAnalizer.setBounds(20, 370, 556, 272);

    Label lblDeploymentDiagramFile = new Label(grpExetendedSatAnalizer, SWT.NONE);
    lblDeploymentDiagramFile.setText("Deployment Diagram File");
    lblDeploymentDiagramFile.setBounds(10, 34, 137, 18);

    text_1 = new Text(grpExetendedSatAnalizer, SWT.BORDER);
    text_1.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {

            if (!text_1.getText().equals("")) {
                if (!txtUmlPath.getText().equals("") && !txtProjectPath.getText().equals("")
                        && !txtRequirementPath.getText().equals("") && !text_2.getText().equals("")
                        && !text_3.getText().equals("") && !text_5.getText().equals("")
                        && !text_6.getText().equals("")) {
                    btnFinish.setEnabled(true);
                }
            } else {
                btnFinish.setEnabled(false);
            }
        }
    });
    text_1.setEnabled(false);
    text_1.setEditable(false);
    text_1.setBounds(153, 28, 317, 27);

    button = new Button(grpExetendedSatAnalizer, SWT.NONE);
    button.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {

            org.eclipse.swt.widgets.FileDialog fileDialog = new org.eclipse.swt.widgets.FileDialog(shell,
                    SWT.SINGLE);
            fileDialog.setText("Open");
            fileDialog.setFilterExtensions(all_formats); // Windows
            fileDialog.setFilterPath(PropertyFile.docsFilePath);
            localFilePath = fileDialog.open();
            if (localFilePath != null) {
                // PropertyFile.docsFilePath = localFilePath;
                text_1.setText(localFilePath);
            }
        }
    });
    button.setText("Browse");
    button.setEnabled(false);
    button.setBounds(476, 30, 75, 27);

    Label lblDockerFile = new Label(grpExetendedSatAnalizer, SWT.NONE);
    lblDockerFile.setText("Docker File");
    lblDockerFile.setBounds(10, 79, 137, 18);

    text_2 = new Text(grpExetendedSatAnalizer, SWT.BORDER);
    text_2.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {

            if (!text_2.getText().equals("")) {
                if (!txtUmlPath.getText().equals("") && !txtProjectPath.getText().equals("")
                        && !txtRequirementPath.getText().equals("") && !text_1.getText().equals("")
                        && !text_3.getText().equals("") && !text_5.getText().equals("")
                        && !text_6.getText().equals("")) {
                    btnFinish.setEnabled(true);
                }
            } else {
                btnFinish.setEnabled(false);
            }
        }
    });
    text_2.setEnabled(false);
    text_2.setEditable(false);
    text_2.setBounds(153, 73, 317, 27);

    button_1 = new Button(grpExetendedSatAnalizer, SWT.NONE);
    button_1.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {

            org.eclipse.swt.widgets.FileDialog fileDialog = new org.eclipse.swt.widgets.FileDialog(shell,
                    SWT.SINGLE);
            fileDialog.setText("Open");
            fileDialog.setFilterExtensions(all_formats); // Windows
            fileDialog.setFilterPath(PropertyFile.docsFilePath);
            localFilePath = fileDialog.open();
            if (localFilePath != null) {
                // PropertyFile.docsFilePath = localFilePath;
                text_2.setText(localFilePath);
            }
        }
    });
    button_1.setText("Browse");
    button_1.setEnabled(false);
    button_1.setBounds(476, 75, 75, 27);

    Label lblTestCases = new Label(grpExetendedSatAnalizer, SWT.NONE);
    lblTestCases.setText("Test case Path");
    lblTestCases.setBounds(10, 124, 137, 18);

    text_3 = new Text(grpExetendedSatAnalizer, SWT.BORDER);
    text_3.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {

            if (!text_3.getText().equals("")) {
                if (!txtUmlPath.getText().equals("") && !txtProjectPath.getText().equals("")
                        && !txtRequirementPath.getText().equals("") && !text_1.getText().equals("")
                        && !text_2.getText().equals("") && !text_5.getText().equals("")
                        && !text_6.getText().equals("")) {
                    btnFinish.setEnabled(true);
                }
            } else {
                btnFinish.setEnabled(false);
            }
        }
    });
    text_3.setEnabled(false);
    text_3.setEditable(false);
    text_3.setBounds(153, 118, 317, 27);

    button_3 = new Button(grpExetendedSatAnalizer, SWT.NONE);
    button_3.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {

            /*
             * Pop up File Chooser Window
             */
            DirectoryDialog directoryDialog = new DirectoryDialog(shell);
            directoryDialog.setText("Open");
            localFilePath = directoryDialog.open();
            StaticData.sourceFilePath = localFilePath;
            localFilePath = localFilePath.replace(Paths.get(localFilePath).getFileName().toString(), "");
            String root = "";// HomeGUI.tree.getToolTipText() +
                             // File.separator +
                             // txtProjectName.getText();
            String path = root + File.separator + FilePropertyName.SOURCE_CODE;
            srcJavaDir = new File(path);
            if (localFilePath != null) {
                text_3.setText(localFilePath);
                boolean src = AccessProject.javaFilesExists(new File(StaticData.sourceFilePath.toString()));
                System.out.println("Test Java Files " + src);

            }
        }
    });
    button_3.setText("Browse");
    button_3.setEnabled(false);
    button_3.setBounds(476, 120, 75, 27);

    Label lblPropertyFile = new Label(grpExetendedSatAnalizer, SWT.NONE);
    lblPropertyFile.setText("Property File");
    lblPropertyFile.setBounds(10, 173, 137, 18);

    text_5 = new Text(grpExetendedSatAnalizer, SWT.BORDER);
    text_5.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {

            if (!text_5.getText().equals("")) {
                if (!txtUmlPath.getText().equals("") && !txtProjectPath.getText().equals("")
                        && !txtRequirementPath.getText().equals("") && !text_1.getText().equals("")
                        && !text_2.getText().equals("") && !text_3.getText().equals("")
                        && !text_6.getText().equals("")) {
                    btnFinish.setEnabled(true);
                }
            } else {
                btnFinish.setEnabled(false);
            }
        }
    });
    text_5.setEnabled(false);
    text_5.setEditable(false);
    text_5.setBounds(153, 167, 317, 27);
    button_5 = new Button(grpExetendedSatAnalizer, SWT.NONE);

    button_5.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {

            org.eclipse.swt.widgets.FileDialog fileDialog = new org.eclipse.swt.widgets.FileDialog(shell,
                    SWT.SINGLE);
            fileDialog.setText("Open");
            fileDialog.setFilterExtensions(config_formats); // Windows
            fileDialog.setFilterPath(PropertyFile.docsFilePath);
            localFilePath = fileDialog.open();
            if (localFilePath != null) {
                // PropertyFile.docsFilePath = localFilePath;
                text_5.setText(localFilePath);
            }
        }
    });
    button_5.setText("Browse");
    button_5.setEnabled(false);
    button_5.setBounds(476, 169, 75, 27);

    Label lblConfigurationFile = new Label(grpExetendedSatAnalizer, SWT.NONE);
    lblConfigurationFile.setText("Configuration Text File");
    lblConfigurationFile.setBounds(10, 208, 137, 18);

    text_6 = new Text(grpExetendedSatAnalizer, SWT.BORDER);
    text_6.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {

            if (!text_6.getText().equals("")) {
                if (!txtUmlPath.getText().equals("") && !txtProjectPath.getText().equals("")
                        && !txtRequirementPath.getText().equals("") && !text_1.getText().equals("")
                        && !text_2.getText().equals("") && !text_3.getText().equals("")
                        && !text_5.getText().equals("")) {
                    btnFinish.setEnabled(true);
                }
            } else {
                btnFinish.setEnabled(false);
            }
        }
    });
    text_6.setEnabled(false);
    text_6.setEditable(false);
    text_6.setBounds(153, 202, 317, 27);

    button_6 = new Button(grpExetendedSatAnalizer, SWT.NONE);
    button_6.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {

            org.eclipse.swt.widgets.FileDialog fileDialog = new org.eclipse.swt.widgets.FileDialog(shell,
                    SWT.SINGLE);
            fileDialog.setText("Open");
            fileDialog.setFilterExtensions(req_formats); // Windows
            fileDialog.setFilterPath(PropertyFile.docsFilePath);
            localFilePath = fileDialog.open();
            if (localFilePath != null) {
                // PropertyFile.docsFilePath = localFilePath;
                text_6.setText(localFilePath);
            }
        }
    });
    button_6.setText("Browse");
    button_6.setEnabled(false);
    button_6.setBounds(476, 204, 75, 27);

}

From source file:brainflow.app.toplevel.BrainFlow.java

private void initControlPanel() {

    //JideTabbedPane tabbedPane = new JideTabbedPane();
    JTabbedPane tabbedPane = new JTabbedPane();

    DockableFrame dframe = DockWindowManager.getInstance().createDockableFrame("Tool Box", "icons/types.gif",
            DockContext.STATE_FRAMEDOCKED, DockContext.DOCK_SIDE_EAST);

    ColorAdjustmentControl colorAdjustmentControl = new ColorAdjustmentControl();

    LayerInfoControl layerInfoControl = new LayerInfoControl();

    MaskControl maskControl = new MaskControl();

    tabbedPane.addTab("Adjust", new JScrollPane(colorAdjustmentControl.getComponent()));
    tabbedPane.addTab("Mask", maskControl.getComponent());
    tabbedPane.addTab("Info", new JScrollPane(layerInfoControl.getComponent()));
    tabbedPane.addTab("Clustering", new ClusterPresenter().getComponent());

    dframe.getContentPane().add(tabbedPane);

    dframe.setPreferredSize(new Dimension(300, 500));
    brainFrame.getDockingManager().addFrame(dframe);

}

From source file:de.tbuchloh.kiskis.gui.dialogs.OptionsDialog.java

/**
 * creates a new OptionsDialog/*ww  w. j av a 2s. c  o m*/
 * 
 * @param owner
 *            is the parent window
 */
public OptionsDialog(final Frame owner) {
    super(owner, M.getString("OptionsDialog.title"), true); //$NON-NLS-1$
    _tabPanel = new JTabbedPane();
    initActions();
}

From source file:davmail.ui.SettingsFrame.java

/**
 * DavMail settings frame.// w  w  w . j  av  a2 s .  c  om
 */
public SettingsFrame() {
    setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    setTitle(BundleMessage.format("UI_DAVMAIL_SETTINGS"));
    try {
        setIconImage(DavGatewayTray.getFrameIcon());
    } catch (NoSuchMethodError error) {
        DavGatewayTray.debug(new BundleMessage("LOG_UNABLE_TO_SET_ICON_IMAGE"));
    }

    JTabbedPane tabbedPane = new JTabbedPane();
    // add help (F1 handler)
    tabbedPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke("F1"),
            "help");
    tabbedPane.getActionMap().put("help", new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
            DesktopBrowser.browse("http://davmail.sourceforge.net");
        }
    });
    tabbedPane.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            boolean isSslEnabled = isSslEnabled();
            popNoSSLCheckBox.setEnabled(Settings.getProperty("davmail.popPort") != null && isSslEnabled);
            imapNoSSLCheckBox.setEnabled(imapPortCheckBox.isSelected() && isSslEnabled);
            smtpNoSSLCheckBox.setEnabled(smtpPortCheckBox.isSelected() && isSslEnabled);
            caldavNoSSLCheckBox.setEnabled(caldavPortCheckBox.isSelected() && isSslEnabled);
            ldapNoSSLCheckBox.setEnabled(ldapPortCheckBox.isSelected() && isSslEnabled);
        }
    });

    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
    mainPanel.add(getSettingsPanel());
    mainPanel.add(getDelaysPanel());
    mainPanel.add(Box.createVerticalGlue());

    tabbedPane.add(BundleMessage.format("UI_TAB_MAIN"), mainPanel);

    JPanel proxyPanel = new JPanel();
    proxyPanel.setLayout(new BoxLayout(proxyPanel, BoxLayout.Y_AXIS));
    proxyPanel.add(getProxyPanel());
    proxyPanel.add(getNetworkSettingsPanel());
    tabbedPane.add(BundleMessage.format("UI_TAB_NETWORK"), proxyPanel);

    JPanel encryptionPanel = new JPanel();
    encryptionPanel.setLayout(new BoxLayout(encryptionPanel, BoxLayout.Y_AXIS));
    encryptionPanel.add(getKeystorePanel());
    encryptionPanel.add(getSmartCardPanel());
    // empty panel
    encryptionPanel.add(new JPanel());
    tabbedPane.add(BundleMessage.format("UI_TAB_ENCRYPTION"), encryptionPanel);

    JPanel loggingPanel = new JPanel();
    loggingPanel.setLayout(new BoxLayout(loggingPanel, BoxLayout.Y_AXIS));
    loggingPanel.add(getLoggingSettingsPanel());
    // empty panel
    loggingPanel.add(new JPanel());

    tabbedPane.add(BundleMessage.format("UI_TAB_LOGGING"), loggingPanel);

    JPanel advancedPanel = new JPanel();
    advancedPanel.setLayout(new BoxLayout(advancedPanel, BoxLayout.Y_AXIS));

    advancedPanel.add(getOtherSettingsPanel());
    // empty panel
    advancedPanel.add(new JPanel());

    tabbedPane.add(BundleMessage.format("UI_TAB_ADVANCED"), advancedPanel);

    if (OSXInfoPlist.isOSX()) {
        JPanel osxPanel = new JPanel();
        osxPanel.setLayout(new BoxLayout(osxPanel, BoxLayout.Y_AXIS));
        osxPanel.add(getOSXPanel());
        // empty panel
        osxPanel.add(new JPanel());

        tabbedPane.add(BundleMessage.format("UI_TAB_OSX"), osxPanel);
    }

    add(BorderLayout.CENTER, tabbedPane);

    JPanel buttonPanel = new JPanel();
    JButton cancel = new JButton(BundleMessage.format("UI_BUTTON_CANCEL"));
    JButton ok = new JButton(BundleMessage.format("UI_BUTTON_SAVE"));
    JButton help = new JButton(BundleMessage.format("UI_BUTTON_HELP"));
    ActionListener save = new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            // save options
            Settings.setProperty("davmail.url", urlField.getText());
            Settings.setProperty("davmail.popPort", popPortCheckBox.isSelected() ? popPortField.getText() : "");
            Settings.setProperty("davmail.ssl.nosecurepop", String.valueOf(popNoSSLCheckBox.isSelected()));
            Settings.setProperty("davmail.imapPort",
                    imapPortCheckBox.isSelected() ? imapPortField.getText() : "");
            Settings.setProperty("davmail.ssl.nosecureimap", String.valueOf(imapNoSSLCheckBox.isSelected()));
            Settings.setProperty("davmail.smtpPort",
                    smtpPortCheckBox.isSelected() ? smtpPortField.getText() : "");
            Settings.setProperty("davmail.ssl.nosecuresmtp", String.valueOf(smtpNoSSLCheckBox.isSelected()));
            Settings.setProperty("davmail.caldavPort",
                    caldavPortCheckBox.isSelected() ? caldavPortField.getText() : "");
            Settings.setProperty("davmail.ssl.nosecurecaldav",
                    String.valueOf(caldavNoSSLCheckBox.isSelected()));
            Settings.setProperty("davmail.ldapPort",
                    ldapPortCheckBox.isSelected() ? ldapPortField.getText() : "");
            Settings.setProperty("davmail.ssl.nosecureldap", String.valueOf(ldapNoSSLCheckBox.isSelected()));
            Settings.setProperty("davmail.keepDelay", keepDelayField.getText());
            Settings.setProperty("davmail.sentKeepDelay", sentKeepDelayField.getText());
            Settings.setProperty("davmail.caldavPastDelay", caldavPastDelayField.getText());
            Settings.setProperty("davmail.imapIdleDelay", imapIdleDelayField.getText());
            Settings.setProperty("davmail.useSystemProxies",
                    String.valueOf(useSystemProxiesField.isSelected()));
            Settings.setProperty("davmail.enableProxy", String.valueOf(enableProxyField.isSelected()));
            Settings.setProperty("davmail.proxyHost", httpProxyField.getText());
            Settings.setProperty("davmail.proxyPort", httpProxyPortField.getText());
            Settings.setProperty("davmail.proxyUser", httpProxyUserField.getText());
            Settings.setProperty("davmail.proxyPassword", httpProxyPasswordField.getText());
            Settings.setProperty("davmail.noProxyFor", noProxyForField.getText());

            Settings.setProperty("davmail.bindAddress", bindAddressField.getText());
            Settings.setProperty("davmail.clientSoTimeout", String.valueOf(clientSoTimeoutField.getText()));
            Settings.setProperty("davmail.allowRemote", String.valueOf(allowRemoteField.isSelected()));
            Settings.setProperty("davmail.server.certificate.hash", certHashField.getText());
            Settings.setProperty("davmail.disableUpdateCheck", String.valueOf(disableUpdateCheck.isSelected()));

            Settings.setProperty("davmail.caldavEditNotifications",
                    String.valueOf(caldavEditNotificationsField.isSelected()));
            Settings.setProperty("davmail.caldavAlarmSound", String.valueOf(caldavAlarmSoundField.getText()));
            Settings.setProperty("davmail.forceActiveSyncUpdate",
                    String.valueOf(forceActiveSyncUpdateCheckBox.isSelected()));
            Settings.setProperty("davmail.defaultDomain", String.valueOf(defaultDomainField.getText()));
            Settings.setProperty("davmail.showStartupBanner",
                    String.valueOf(showStartupBannerCheckBox.isSelected()));
            Settings.setProperty("davmail.disableGuiNotifications",
                    String.valueOf(disableGuiNotificationsCheckBox.isSelected()));
            Settings.setProperty("davmail.imapAutoExpunge",
                    String.valueOf(imapAutoExpungeCheckBox.isSelected()));
            Settings.setProperty("davmail.popMarkReadOnRetr",
                    String.valueOf(popMarkReadOnRetrCheckBox.isSelected()));
            String selectedEwsMode = (String) enableEwsComboBox.getSelectedItem();
            String enableEws;
            if (EWS.equals(selectedEwsMode)) {
                enableEws = "true";
            } else if (WEBDAV.equals(selectedEwsMode)) {
                enableEws = "false";
            } else {
                enableEws = "auto";
            }
            Settings.setProperty("davmail.enableEws", enableEws);
            Settings.setProperty("davmail.smtpSaveInSent", String.valueOf(smtpSaveInSentCheckBox.isSelected()));

            Settings.setProperty("davmail.ssl.keystoreType", (String) keystoreTypeCombo.getSelectedItem());
            Settings.setProperty("davmail.ssl.keystoreFile", keystoreFileField.getText());
            Settings.setProperty("davmail.ssl.keystorePass", String.valueOf(keystorePassField.getPassword()));
            Settings.setProperty("davmail.ssl.keyPass", String.valueOf(keyPassField.getPassword()));

            Settings.setProperty("davmail.ssl.clientKeystoreType",
                    (String) clientKeystoreTypeCombo.getSelectedItem());
            Settings.setProperty("davmail.ssl.clientKeystoreFile", clientKeystoreFileField.getText());
            Settings.setProperty("davmail.ssl.clientKeystorePass",
                    String.valueOf(clientKeystorePassField.getPassword()));
            Settings.setProperty("davmail.ssl.pkcs11Library", pkcs11LibraryField.getText());
            Settings.setProperty("davmail.ssl.pkcs11Config", pkcs11ConfigField.getText());

            Settings.setLoggingLevel("rootLogger", (Level) rootLoggingLevelField.getSelectedItem());
            Settings.setLoggingLevel("davmail", (Level) davmailLoggingLevelField.getSelectedItem());
            Settings.setLoggingLevel("org.apache.commons.httpclient",
                    (Level) httpclientLoggingLevelField.getSelectedItem());
            Settings.setLoggingLevel("httpclient.wire", (Level) wireLoggingLevelField.getSelectedItem());
            Settings.setProperty("davmail.logFilePath", logFilePathField.getText());
            Settings.setProperty("davmail.logFileSize", logFileSizeField.getText());

            setVisible(false);
            Settings.save();

            if (osxHideFromDockCheckBox != null) {
                OSXInfoPlist.setOSXHideFromDock(osxHideFromDockCheckBox.isSelected());
            }

            // restart listeners with new config
            DavGateway.restart();
        }
    };
    ok.addActionListener(save);

    cancel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            reload();
            setVisible(false);
        }
    });

    help.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            DesktopBrowser.browse("http://davmail.sourceforge.net");
        }
    });

    buttonPanel.add(ok);
    buttonPanel.add(cancel);
    buttonPanel.add(help);

    add(BorderLayout.SOUTH, buttonPanel);

    pack();
    //setResizable(false);
    // center frame
    setLocation(getToolkit().getScreenSize().width / 2 - getSize().width / 2,
            getToolkit().getScreenSize().height / 2 - getSize().height / 2);
    urlField.requestFocus();
}

From source file:edu.ku.brc.specify.tasks.subpane.security.SecurityAdminPane.java

/**
 * /*from   w ww. j ava2 s  .c o m*/
 */
private void createUserPanel() {
    final EditorPanel infoPanel = new EditorPanel(this);
    final CellConstraints cc = new CellConstraints();

    PermissionEditor prefsEdt = new PermissionEditor("SEC_PREFS", new PrefsPermissionEnumerator(), infoPanel,
            false, "SEC_NAME_TITLE", "SEC_ENABLE_PREF", null, null, null);

    JButton selectAllBtn = createI18NButton("SELECTALL");
    JButton deselectAllBtn = createI18NButton("DESELECTALL");

    final PermissionPanelEditor generalEditor = new PermissionPanelEditor(selectAllBtn, deselectAllBtn);
    generalEditor.addPanel(
            new IndvPanelPermEditor("SEC_TOOLS", "SEC_TOOLS_DSC", new TaskPermissionEnumerator(), infoPanel));
    generalEditor.addPanel(new PermissionEditor("SEC_TABLES", new TablePermissionEnumerator(), infoPanel));
    generalEditor.addPanel(prefsEdt);

    final PermissionPanelEditor objEditor = new PermissionPanelEditor(selectAllBtn, deselectAllBtn);
    objEditor.addPanel(
            new IndvPanelPermEditor("SEC_DOS", "SEC_DOS_DSC", new ObjectPermissionEnumerator(), infoPanel));

    // create user form
    ViewBasedDisplayPanel panel = createViewBasedDisplayPanelForUser(infoPanel);

    // create tabbed panel for different kinds of permission editing tables
    final JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.addTab(getResourceString("SEC_GENERAL"), generalEditor);
    //tabbedPane.addTab("Objects", objEditor);     // I18N

    //final PanelBuilder mainPB = new PanelBuilder(new FormLayout("f:p:g", "t:p,4px,p,5px,f:p:g,2dlu,p"), infoPanel);
    //setting min size for generalEditor (only px settings work.)
    final PanelBuilder mainPB = new PanelBuilder(new FormLayout("f:p:g", "t:p,4px,p,5px,f:[400px,p]:g,2dlu,p"),
            infoPanel);

    // lay out controls on panel
    int y = 1;
    mainPB.add(panel, cc.xy(1, y));
    y += 2;
    mainPB.addSeparator(getResourceString("SEC_PERMS"), cc.xy(1, y));
    y += 2;
    mainPB.add(tabbedPane, cc.xy(1, y));
    y += 2;

    PanelBuilder saveBtnPB = new PanelBuilder(new FormLayout("f:p:g,p,2px,p,2px,p,2px,p", "p"));

    Viewable viewable = panel.getMultiView().getCurrentView();
    JButton valBtn = FormViewObj.createValidationIndicator(viewable.getUIComponent(), viewable.getValidator());
    panel.getMultiView().getCurrentValidator().setValidationBtn(valBtn);

    saveBtnPB.add(selectAllBtn, cc.xy(2, 1));
    saveBtnPB.add(deselectAllBtn, cc.xy(4, 1));
    saveBtnPB.add(valBtn, cc.xy(6, 1));
    saveBtnPB.add(infoPanel.getSaveBtn(), cc.xy(8, 1));

    mainPB.add(saveBtnPB.getPanel(), cc.xy(1, y));
    y += 2;

    String className = SpecifyUser.class.getCanonicalName();
    infoCards.add(infoPanel, className);

    AdminInfoSubPanelWrapper subPanel = new AdminInfoSubPanelWrapper(panel);

    subPanel.addPermissionEditor(generalEditor);
    subPanel.addPermissionEditor(objEditor);
    infoSubPanels.put(className, subPanel);
    editorPanels.put(className, infoPanel);

    selectAllBtn.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            ((PermissionPanelEditor) tabbedPane.getComponentAt(tabbedPane.getSelectedIndex())).selectAll();
        }
    });

    deselectAllBtn.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            ((PermissionPanelEditor) tabbedPane.getComponentAt(tabbedPane.getSelectedIndex())).deselectAll();
        }
    });
}

From source file:ffx.ui.MainPanel.java

/**
 * <p>/*from www.  ja  va 2 s  . com*/
 * initialize</p>
 */
public void initialize() {
    if (init) {
        return;
    }
    init = true;
    String dir = System.getProperty("user.dir",
            FileSystemView.getFileSystemView().getDefaultDirectory().getAbsolutePath());
    setCWD(new File(dir));
    locale = new FFXLocale("en", "US");
    JDialog splashScreen = null;
    ClassLoader loader = getClass().getClassLoader();
    if (!GraphicsEnvironment.isHeadless()) {
        // Splash Screen
        JFrame.setDefaultLookAndFeelDecorated(true);
        splashScreen = new JDialog(frame, false);
        ImageIcon logo = new ImageIcon(loader.getResource("ffx/ui/icons/splash.png"));
        JLabel ffxLabel = new JLabel(logo);
        ffxLabel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
        Container contentpane = splashScreen.getContentPane();
        contentpane.setLayout(new BorderLayout());
        contentpane.add(ffxLabel, BorderLayout.CENTER);
        splashScreen.setUndecorated(true);
        splashScreen.pack();
        Dimension screenDimension = getToolkit().getScreenSize();
        Dimension splashDimension = splashScreen.getSize();
        splashScreen.setLocation((screenDimension.width - splashDimension.width) / 2,
                (screenDimension.height - splashDimension.height) / 2);
        splashScreen.setResizable(false);
        splashScreen.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        splashScreen.setVisible(true);
        // Make all pop-up Menus Heavyweight so they play nicely with Java3D
        JPopupMenu.setDefaultLightWeightPopupEnabled(false);
    }
    // Create the Root Node
    dataRoot = new MSRoot();
    Border bb = BorderFactory.createEtchedBorder(EtchedBorder.RAISED);
    statusLabel = new JLabel("  ");
    JLabel stepLabel = new JLabel("  ");
    stepLabel.setHorizontalAlignment(JLabel.RIGHT);
    JLabel energyLabel = new JLabel("  ");
    energyLabel.setHorizontalAlignment(JLabel.RIGHT);
    JPanel statusPanel = new JPanel(new GridLayout(1, 3));
    statusPanel.setBorder(bb);
    statusPanel.add(statusLabel);
    statusPanel.add(stepLabel);
    statusPanel.add(energyLabel);
    if (!GraphicsEnvironment.isHeadless()) {
        GraphicsConfigTemplate3D template3D = new GraphicsConfigTemplate3D();
        template3D.setDoubleBuffer(GraphicsConfigTemplate.PREFERRED);
        GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice()
                .getBestConfiguration(template3D);
        graphicsCanvas = new GraphicsCanvas(gc, this);
        graphicsPanel = new GraphicsPanel(graphicsCanvas, statusPanel);
    }
    // Initialize various Panels
    hierarchy = new Hierarchy(this);
    hierarchy.setStatus(statusLabel, stepLabel, energyLabel);
    keywordPanel = new KeywordPanel(this);
    modelingPanel = new ModelingPanel(this);
    JPanel treePane = new JPanel(new BorderLayout());
    JScrollPane scrollPane = new JScrollPane(hierarchy, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    treePane.add(scrollPane, BorderLayout.CENTER);
    tabbedPane = new JTabbedPane();

    ImageIcon graphicsIcon = new ImageIcon(loader.getResource("ffx/ui/icons/monitor.png"));
    ImageIcon keywordIcon = new ImageIcon(loader.getResource("ffx/ui/icons/key.png"));
    ImageIcon modelingIcon = new ImageIcon(loader.getResource("ffx/ui/icons/cog.png"));
    tabbedPane.addTab(locale.getValue("Graphics"), graphicsIcon, graphicsPanel);
    tabbedPane.addTab(locale.getValue("KeywordEditor"), keywordIcon, keywordPanel);
    tabbedPane.addTab(locale.getValue("ModelingCommands"), modelingIcon, modelingPanel);
    tabbedPane.addChangeListener(this);
    splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, false, treePane, tabbedPane);

    /* splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, false,
     treePane, graphicsPanel); */
    splitPane.setResizeWeight(0.25);
    splitPane.setOneTouchExpandable(true);
    setLayout(new BorderLayout());
    add(splitPane, BorderLayout.CENTER);
    if (!GraphicsEnvironment.isHeadless()) {
        mainMenu = new MainMenu(this);
        add(mainMenu.getToolBar(), BorderLayout.NORTH);
        getModelingShell();
        loadPrefs();
        SwingUtilities.updateComponentTreeUI(SwingUtilities.getRoot(this));
        splashScreen.dispose();
    }
}

From source file:AppearanceExplorer.java

JPanel guiPanel() {
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.addTab("Setup", setupPanel());
    tabbedPane.addTab("ColoringAttributes", coloringAttrEditor);
    tabbedPane.addTab("PointAttributes", pointAttrEditor);
    tabbedPane.addTab("LineAttributes", lineAttrEditor);
    tabbedPane.addTab("PolygonAttributes", polygonAttrEditor);
    tabbedPane.addTab("RenderingAttributes", renderAttrEditor);
    tabbedPane.addTab("TransparencyAttributes", transpAttrEditor);
    tabbedPane.addTab("Material", materialEditor);
    tabbedPane.addTab("Texture2D", texture2DEditor);
    tabbedPane.addTab("TextureAttributes", textureAttrEditor);
    tabbedPane.addTab("TexCoordGeneration", texGenEditor);
    panel.add("Center", tabbedPane);

    return panel;
}

From source file:com.peterbochs.sourceleveldebugger.SourceLevelDebugger3.java

private JTabbedPane getJInfoTabbedPane() {
    if (jInfoTabbedPane == null) {
        jInfoTabbedPane = new JTabbedPane();
        jInfoTabbedPane.addTab(MyLanguage.getString("Register"), null, getRegisterPanelScrollPane(), null);
    }/*from   w  ww.j  a  v  a2s.  c  om*/
    return jInfoTabbedPane;
}

From source file:com.mirth.connect.client.ui.DashboardPanel.java

private void initComponents() {
    splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    splitPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    splitPane.setOneTouchExpandable(true);

    topPanel = new JPanel();
    topPanel.setBackground(UIConstants.BACKGROUND_COLOR);

    dashboardTable = null;//from   ww w .jav  a 2  s .  c  o  m
    dashboardTableScrollPane = new JScrollPane();
    dashboardTableScrollPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    dashboardTableScrollPane.setViewportView(dashboardTable);
    dashboardTableScrollPane.setDoubleBuffered(true);

    controlPanel = new JPanel();
    controlPanel.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, new Color(164, 164, 164)));
    controlPanel.setPreferredSize(new Dimension(100, 20));

    tagFilterButton = new IconButton();
    tagFilterButton
            .setIcon(new ImageIcon(getClass().getResource("/com/mirth/connect/client/ui/images/wrench.png"))); // NOI18N
    tagFilterButton.setToolTipText("Show Channel Filter");
    tagFilterButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            tagFilterButtonActionPerformed();
        }
    });

    tagsLabel = new JLabel();

    ButtonGroup showStatsButtonGroup = new ButtonGroup();

    showCurrentStatsButton = new JRadioButton("Current Statistics");
    showCurrentStatsButton.setSelected(true);
    showCurrentStatsButton
            .setToolTipText("Show the statistics accumulated since the last time the statistics were reset");
    showCurrentStatsButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            showCurrentStatsButtonActionPerformed();
        }
    });
    showStatsButtonGroup.add(showCurrentStatsButton);

    showLifetimeStatsButton = new JRadioButton("Lifetime Statistics");
    showLifetimeStatsButton
            .setToolTipText("Show the statistics accumulated over the entire lifetime of the channel");
    showLifetimeStatsButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            showLifetimeStatsButtonActionPerformed();
        }
    });
    showStatsButtonGroup.add(showLifetimeStatsButton);

    pluginContainerPanel = new JPanel();

    controlSeparator = new JSeparator(SwingConstants.VERTICAL);

    ButtonGroup tableModeButtonGroup = new ButtonGroup();

    tableModeGroupsButton = new IconToggleButton(UIConstants.ICON_GROUP);
    tableModeGroupsButton.setToolTipText("Groups");
    tableModeGroupsButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            switchTableMode(true);
        }
    });
    tableModeButtonGroup.add(tableModeGroupsButton);

    tableModeChannelsButton = new IconToggleButton(UIConstants.ICON_CHANNEL);
    tableModeChannelsButton.setToolTipText("Channels");
    tableModeChannelsButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            switchTableMode(false);
        }
    });
    tableModeButtonGroup.add(tableModeChannelsButton);

    tabPane = new JTabbedPane();

    splitPane.setTopComponent(topPanel);
    splitPane.setBottomComponent(tabPane);
}