List of usage examples for javax.swing JTabbedPane addTab
public void addTab(String title, Component component)
component
represented by a title
and no icon. From source file:hspc.submissionsprogram.AppDisplay.java
AppDisplay() { this.setTitle("Dominion High School Programming Contest"); this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); this.setResizable(false); WindowListener exitListener = new WindowAdapter() { @Override/*from w w w.j av a2s .c om*/ public void windowClosing(WindowEvent e) { System.exit(0); } }; this.addWindowListener(exitListener); JTabbedPane pane = new JTabbedPane(); this.add(pane); JPanel submitPanel = new JPanel(null); submitPanel.setPreferredSize(new Dimension(500, 500)); UIManager.put("FileChooser.readOnly", true); JFileChooser fileChooser = new JFileChooser(); fileChooser.setBounds(0, 0, 500, 350); fileChooser.setVisible(true); FileNameExtensionFilter javaFilter = new FileNameExtensionFilter("Java files (*.java)", "java"); fileChooser.setFileFilter(javaFilter); fileChooser.setAcceptAllFileFilterUsed(false); fileChooser.setControlButtonsAreShown(false); submitPanel.add(fileChooser); JSeparator separator1 = new JSeparator(); separator1.setBounds(12, 350, 476, 2); separator1.setForeground(new Color(122, 138, 152)); submitPanel.add(separator1); JLabel problemChooserLabel = new JLabel("Problem:"); problemChooserLabel.setBounds(12, 360, 74, 25); submitPanel.add(problemChooserLabel); String[] listOfProblems = Main.Configuration.get("problem_names") .split(Main.Configuration.get("name_delimiter")); JComboBox problems = new JComboBox<>(listOfProblems); problems.setBounds(96, 360, 393, 25); submitPanel.add(problems); JButton submit = new JButton("Submit"); submit.setBounds(170, 458, 160, 30); submit.addActionListener(e -> { try { File file = fileChooser.getSelectedFile(); try { CloseableHttpClient httpClient = HttpClients.createDefault(); HttpPost uploadFile = new HttpPost(Main.Configuration.get("submit_url")); MultipartEntityBuilder builder = MultipartEntityBuilder.create(); builder.addTextBody("accountID", Main.accountID, ContentType.TEXT_PLAIN); builder.addTextBody("problem", String.valueOf(problems.getSelectedItem()), ContentType.TEXT_PLAIN); builder.addBinaryBody("submission", file, ContentType.APPLICATION_OCTET_STREAM, file.getName()); HttpEntity multipart = builder.build(); uploadFile.setEntity(multipart); CloseableHttpResponse response = httpClient.execute(uploadFile); HttpEntity responseEntity = response.getEntity(); String inputLine; BufferedReader br = new BufferedReader(new InputStreamReader(responseEntity.getContent())); try { if ((inputLine = br.readLine()) != null) { int rowIndex = Integer.parseInt(inputLine); new ResultWatcher(rowIndex); } br.close(); } catch (IOException ex) { ex.printStackTrace(); } } catch (Exception ex) { ex.printStackTrace(); } } catch (NullPointerException ex) { JOptionPane.showMessageDialog(this, "No file selected.\nPlease select a java file.", "Error", JOptionPane.WARNING_MESSAGE); } }); submitPanel.add(submit); JPanel clarificationsPanel = new JPanel(null); clarificationsPanel.setPreferredSize(new Dimension(500, 500)); cList = new JList<>(); cList.setBounds(12, 12, 476, 200); cList.setBorder(new CompoundBorder(BorderFactory.createLineBorder(new Color(122, 138, 152)), BorderFactory.createEmptyBorder(8, 8, 8, 8))); cList.setBackground(new Color(254, 254, 255)); clarificationsPanel.add(cList); JButton viewC = new JButton("View"); viewC.setBounds(12, 224, 232, 25); viewC.addActionListener(e -> { if (cList.getSelectedIndex() != -1) { int id = Integer.parseInt(cList.getSelectedValue().split("\\.")[0]); clarificationDatas.stream().filter(data -> data.getId() == id).forEach( data -> new ClarificationDisplay(data.getProblem(), data.getText(), data.getResponse())); } }); clarificationsPanel.add(viewC); JButton refreshC = new JButton("Refresh"); refreshC.setBounds(256, 224, 232, 25); refreshC.addActionListener(e -> updateCList(true)); clarificationsPanel.add(refreshC); JSeparator separator2 = new JSeparator(); separator2.setBounds(12, 261, 476, 2); separator2.setForeground(new Color(122, 138, 152)); clarificationsPanel.add(separator2); JLabel problemChooserLabelC = new JLabel("Problem:"); problemChooserLabelC.setBounds(12, 273, 74, 25); clarificationsPanel.add(problemChooserLabelC); JComboBox problemsC = new JComboBox<>(listOfProblems); problemsC.setBounds(96, 273, 393, 25); clarificationsPanel.add(problemsC); JTextArea textAreaC = new JTextArea(); textAreaC.setLineWrap(true); textAreaC.setWrapStyleWord(true); textAreaC.setBorder(new CompoundBorder(BorderFactory.createLineBorder(new Color(122, 138, 152)), BorderFactory.createEmptyBorder(8, 8, 8, 8))); textAreaC.setBackground(new Color(254, 254, 255)); JScrollPane areaScrollPane = new JScrollPane(textAreaC); areaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); areaScrollPane.setBounds(12, 312, 477, 134); clarificationsPanel.add(areaScrollPane); JButton submitC = new JButton("Submit Clarification"); submitC.setBounds(170, 458, 160, 30); submitC.addActionListener(e -> { if (textAreaC.getText().length() > 2048) { JOptionPane.showMessageDialog(this, "Clarification body is too long.\nMaximum of 2048 characters allowed.", "Error", JOptionPane.WARNING_MESSAGE); } else if (textAreaC.getText().length() < 20) { JOptionPane.showMessageDialog(this, "Clarification body is too short.\nClarifications must be at least 20 characters, but no more than 2048.", "Error", JOptionPane.WARNING_MESSAGE); } else { Connection conn = null; PreparedStatement stmt = null; try { Class.forName(JDBC_DRIVER); conn = DriverManager.getConnection(Main.Configuration.get("jdbc_mysql_address"), Main.Configuration.get("mysql_user"), Main.Configuration.get("mysql_pass")); String sql = "INSERT INTO clarifications (team, problem, text) VALUES (?, ?, ?)"; stmt = conn.prepareStatement(sql); stmt.setInt(1, Integer.parseInt(String.valueOf(Main.accountID))); stmt.setString(2, String.valueOf(problemsC.getSelectedItem())); stmt.setString(3, String.valueOf(textAreaC.getText())); textAreaC.setText(""); stmt.executeUpdate(); stmt.close(); conn.close(); updateCList(false); } catch (Exception ex) { ex.printStackTrace(); } finally { try { if (stmt != null) { stmt.close(); } } catch (Exception ex2) { ex2.printStackTrace(); } try { if (conn != null) { conn.close(); } } catch (Exception ex2) { ex2.printStackTrace(); } } } }); clarificationsPanel.add(submitC); pane.addTab("Submit", submitPanel); pane.addTab("Clarifications", clarificationsPanel); Timer timer = new Timer(); TimerTask updateTask = new TimerTask() { @Override public void run() { updateCList(false); } }; timer.schedule(updateTask, 10000, 10000); updateCList(false); this.pack(); this.setLocationRelativeTo(null); this.setVisible(true); }
From source file:src.gui.ItSIMPLE.java
/** * This method initializes planInfoFramePanel * * @return javax.swing.JPanel//from www .ja v a2s. c o m */ private ItFramePanel getPlanInfoFramePanel() { if (planInfoFramePanel == null) { JPanel planInfoPanel = new JPanel(new BorderLayout()); planInfoPanel.setMinimumSize(new Dimension(100, 40)); planInfoFramePanel = new ItFramePanel(":: Console", ItFramePanel.MINIMIZE_MAXIMIZE); //informationPanel.setMinimumSize(new Dimension(100,25)); //planInfoEditorPane = new JEditorPane(); //planInfoEditorPane.setContentType("text/html"); //planInfoEditorPane.setEditable(false); //planInfoEditorPane.setCursor(new Cursor(Cursor.TEXT_CURSOR)); //planInfoEditorPane.setBackground(Color.WHITE); outputEditorPane = new JTextArea(); //outputEditorPane.setContentType("text/html"); outputEditorPane.setEditable(false); outputEditorPane.setLineWrap(true); outputEditorPane.setWrapStyleWord(true); outputEditorPane.setCursor(new Cursor(Cursor.TEXT_CURSOR)); // tabbed panes with jtrees JTabbedPane outputPane = new JTabbedPane(); outputPane.addTab("Output", new JScrollPane(outputEditorPane)); //outputPane.addTab("Results", new JScrollPane(planInfoEditorPane)); //planInfoFramePanel.setContent(planInfoEditorPane, true); planInfoFramePanel.setContent(outputPane, false); planInfoFramePanel.setParentSplitPane(planInfoSplitPane); planInfoPanel.add(planInfoFramePanel, BorderLayout.CENTER); } return planInfoFramePanel; }
From source file:src.gui.ItSIMPLE.java
/** * This method creates the panel for all analysis functionalities * @return /*from w w w.j a v a 2 s .c om*/ */ private JPanel getAnalysisPane() { if (analysisPane == null) { analysisPane = new JPanel(new BorderLayout()); //tabbed panel for distinct analysis context //TODO: in the future this is going to be just one panel. // a tabbed panel won't be necessary any more JTabbedPane analysisTabbedPane = new JTabbedPane(); analysisTabbedPane.setTabPlacement(JTabbedPane.TOP); analysisTabbedPane.addTab("General", getAnalysisSplitPane()); analysisTabbedPane.addTab("Petri Net", getPetriSplitPane()); //status bar for the analysis processes analysisStatusBar = new JLabel("Status:"); analysisStatusBar.setHorizontalAlignment(SwingConstants.RIGHT); JPanel bottomPlanSimPane = new JPanel(new BorderLayout()); bottomPlanSimPane.add(analysisStatusBar, BorderLayout.CENTER); //analysisPane.add(getAnalysisSplitPane(), BorderLayout.CENTER); analysisPane.add(analysisTabbedPane, BorderLayout.CENTER); analysisPane.add(bottomPlanSimPane, BorderLayout.SOUTH); } return analysisPane; }
From source file:src.gui.ItSIMPLE.java
/** * @return Returns the planAnalysisFramePanel. *//*from ww w . ja va 2 s . co m*/ private ItFramePanel getPlanAnalysisFramePanel() { if (planAnalysisFramePanel == null) { planAnalysisFramePanel = new ItFramePanel(":: Plan Analysis", ItFramePanel.NO_MINIMIZE_MAXIMIZE); // tool bar JToolBar chartsToolBar = new JToolBar(); chartsToolBar.add(new JButton(drawChartAction)); // charts panel chartsPanel = new JPanel(); chartsPanel.setLayout(new BoxLayout(chartsPanel, BoxLayout.Y_AXIS)); ItFramePanel variableSelectionPanel = new ItFramePanel(".: Select variables to be tracked", ItFramePanel.NO_MINIMIZE_MAXIMIZE); //variableSelectionPanel.setBackground(new Color(151,151,157)); JSplitPane split = new JSplitPane(); split.setContinuousLayout(true); split.setOrientation(JSplitPane.HORIZONTAL_SPLIT); split.setDividerLocation(2 * screenSize.height / 3); split.setDividerSize(8); //split.setPreferredSize(new Dimension(screenSize.width/4-20, screenSize.height/2 - 50)); //split.setPreferredSize(new Dimension(screenSize.width/4-20, 120)); split.setLeftComponent(new JScrollPane(variablesPlanTree)); split.setRightComponent(new JScrollPane(selectedVariablesPlanTree)); variableSelectionPanel.setContent(split, false); //variableSelectionPanel.setParentSplitPane() //JPanel variableSelectionPanel = new JPanel(new BorderLayout()); //variableSelectionPanel.add(new JScrollPane(variablesPlanTree), BorderLayout.CENTER); //variableSelectionPanel.add(new JScrollPane(selectedVariablesPlanTree), BorderLayout.EAST); ItFramePanel variableGraphPanel = new ItFramePanel(".: Chart", ItFramePanel.NO_MINIMIZE_MAXIMIZE); variableGraphPanel.setContent(chartsPanel, true); JSplitPane mainvariablesplit = new JSplitPane(); mainvariablesplit.setContinuousLayout(true); mainvariablesplit.setOrientation(JSplitPane.VERTICAL_SPLIT); mainvariablesplit.setDividerLocation(150); mainvariablesplit.setDividerSize(8); //mainvariablesplit.setPreferredSize(new Dimension(screenSize.width/4-20, screenSize.height/2 - 50)); mainvariablesplit.setTopComponent(variableSelectionPanel); mainvariablesplit.setBottomComponent(variableGraphPanel); // main charts panel - used to locate the tool bar above the charts panel JPanel mainChartsPanel = new JPanel(new BorderLayout()); mainChartsPanel.add(chartsToolBar, BorderLayout.NORTH); //mainChartsPanel.add(new JScrollPane(chartsPanel), BorderLayout.CENTER); mainChartsPanel.add(mainvariablesplit, BorderLayout.CENTER); //Results planInfoEditorPane = new JEditorPane(); planInfoEditorPane.setContentType("text/html"); planInfoEditorPane.setEditable(false); planInfoEditorPane.setCursor(new Cursor(Cursor.TEXT_CURSOR)); planInfoEditorPane.setBackground(Color.WHITE); JPanel resultsPanel = new JPanel(new BorderLayout()); JToolBar resultsToolBar = new JToolBar(); resultsToolBar.setRollover(true); JButton planReportButton = new JButton("View Full Report", new ImageIcon("resources/images/viewreport.png")); planReportButton.setToolTipText("<html>View full plan report.<br> For multiple plans you will need " + "access to the Internet.<br> The components used in the report require such access (no data is " + "sent through the Internet).</html>"); planReportButton.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(ActionEvent e) { //Opens html with defaut browser String path = "resources/report/Report.html"; File report = new File(path); path = report.getAbsolutePath(); try { BrowserLauncher launcher = new BrowserLauncher(); launcher.openURLinBrowser("file://" + path); } catch (BrowserLaunchingInitializingException ex) { Logger.getLogger(ItSIMPLE.class.getName()).log(Level.SEVERE, null, ex); appendOutputPanelText("ERROR. Problem while trying to open the default browser. \n"); } catch (UnsupportedOperatingSystemException ex) { Logger.getLogger(ItSIMPLE.class.getName()).log(Level.SEVERE, null, ex); appendOutputPanelText("ERROR. Problem while trying to open the default browser. \n"); } } }); resultsToolBar.add(planReportButton); resultsToolBar.addSeparator(); JButton planReportDataButton = new JButton("Save Report Data", new ImageIcon("resources/images/savePDDL.png")); planReportDataButton.setToolTipText("<html>Save report data to file</html>"); planReportDataButton.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(ActionEvent e) { //Save report data if (solveResult != null) { Element lastOpenFolderElement = itSettings.getChild("generalSettings") .getChild("lastOpenFolder"); JFileChooser fc = new JFileChooser(lastOpenFolderElement.getText()); fc.setDialogTitle("Save Report Data"); fc.setFileSelectionMode(JFileChooser.FILES_ONLY); fc.setFileFilter(new XMLFileFilter()); int returnVal = fc.showSaveDialog(ItSIMPLE.this); if (returnVal == JFileChooser.APPROVE_OPTION) { File selectedFile = fc.getSelectedFile(); String path = selectedFile.getPath(); if (!path.toLowerCase().endsWith(".xml")) { path += ".xml"; } //save file (xml) try { FileWriter file = new FileWriter(path); file.write(XMLUtilities.toString(solveResult)); file.close(); } catch (IOException e1) { e1.printStackTrace(); } //Save as a last open folder String folder = selectedFile.getParent(); //Element lastOpenFolderElement = itSettings.getChild("generalSettings").getChild("lastOpenFolder"); lastOpenFolderElement.setText(folder); XMLUtilities.writeToFile("resources/settings/itSettings.xml", itSettings.getDocument()); //Ask if the user wants to save plans individually too. boolean needToSavePlans = false; int option = JOptionPane.showOptionDialog(instance, "<html><center>Do you also want to save the plans" + "<br>in individual files?</center></html>", "Save plans", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null); switch (option) { case JOptionPane.YES_OPTION: { needToSavePlans = true; } break; case JOptionPane.NO_OPTION: { needToSavePlans = false; } break; } if (needToSavePlans) { //Close Open tabs List<?> problems = null; try { XPath ppath = new JDOMXPath("project/domains/domain/problems/problem"); problems = ppath.selectNodes(solveResult); } catch (JaxenException e2) { e2.printStackTrace(); } for (int i = 0; i < problems.size(); i++) { Element problem = (Element) problems.get(i); //create a folder for each problem and put all plans inside as xml files String folderName = problem.getChildText("name"); String folderPath = selectedFile.getAbsolutePath() .replace(selectedFile.getName(), folderName); //System.out.println(folderPath); File planfolder = new File(folderPath); boolean canSavePlan = false; try { if (planfolder.mkdir()) { System.out.println("Directory '" + folderPath + "' created."); canSavePlan = true; } else { System.out.println("Directory '" + folderPath + "' was not created."); } } catch (Exception ep) { ep.printStackTrace(); } if (canSavePlan) { Element plans = problem.getChild("plans"); for (Iterator<Element> it = plans.getChildren("xmlPlan").iterator(); it .hasNext();) { Element eaplan = it.next(); Element theplanner = eaplan.getChild("planner"); //save file (xml) String planFileName = "solution" + theplanner.getChildText("name") + "-" + theplanner.getChildText("version") + "-" + Integer.toString(plans.getChildren().indexOf(eaplan)) + ".xml"; String planPath = folderPath + File.separator + planFileName; /* try { FileWriter planfile = new FileWriter(planPath); planfile.write(XMLUtilities.toString(eaplan)); planfile.close(); System.out.println("File '" + planPath + "' created."); } catch (IOException e1) { e1.printStackTrace(); } * */ if (eaplan.getChild("plan").getChildren().size() > 0) { //TODO: save the plan in PDDL too. It should be done through the XPDDL/PDDL classes String pddlplan = ToXPDDL.XMLtoXPDDLPlan(eaplan); String planFileNamePDDL = "solution" + theplanner.getChildText("name") + "-" + theplanner.getChildText("version") + "-" + Integer.toString(plans.getChildren().indexOf(eaplan)) + ".pddl"; String planPathPDDL = folderPath + File.separator + planFileNamePDDL; //String cfolderPath = selectedFile.getAbsolutePath().replace(selectedFile.getName(), ""); //String planFileNamePDDL = theplanner.getChildText("name")+"-"+theplanner.getChildText("version") + "-" + folderName+"-solution.pddl"; //String planPathPDDL = cfolderPath + File.separator + planFileNamePDDL; //if (!theplanner.getChildText("name").contains("MIPS")){ try { FileWriter planfile = new FileWriter(planPathPDDL); planfile.write(pddlplan); planfile.close(); System.out.println("File '" + planPathPDDL + "' created."); } catch (IOException e1) { e1.printStackTrace(); } } //} } } } } } } else { appendOutputPanelText(">> No report data available to save! \n"); } } }); resultsToolBar.add(planReportDataButton); JButton openPlanReportDataButton = new JButton("Open Report Data", new ImageIcon("resources/images/openreport.png")); openPlanReportDataButton.setToolTipText("<html>Open report data to file</html>"); openPlanReportDataButton.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(ActionEvent e) { planSimStatusBar.setText("Status: Opening File..."); appendOutputPanelText(">> Opening File... \n"); //Open report data Element lastOpenFolderElement = itSettings.getChild("generalSettings") .getChild("lastOpenFolder"); JFileChooser fc = new JFileChooser(lastOpenFolderElement.getText()); fc.setDialogTitle("Open Report Data"); fc.setFileSelectionMode(JFileChooser.FILES_ONLY); fc.setFileFilter(new XMLFileFilter()); int returnVal = fc.showOpenDialog(ItSIMPLE.this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); // Get itSIMPLE itSettings from itSettings.xml org.jdom.Document resultsDoc = null; try { resultsDoc = XMLUtilities.readFromFile(file.getPath()); solveResult = resultsDoc.getRootElement(); //XMLUtilities.printXML(solveResult); if (solveResult.getName().equals("projects")) { String report = PlanAnalyzer.generatePlannersComparisonReport(solveResult); String comparisonReport = PlanAnalyzer .generateFullPlannersComparisonReport(solveResult); //Save Comparison Report file saveFile("resources/report/Report.html", comparisonReport); setPlanInfoPanelText(report); setPlanEvaluationInfoPanelText(""); appendOutputPanelText(">> Report data read! \n"); //My experiments PlanAnalyzer.myAnalysis(itPlanners.getChild("planners"), solveResult); } } catch (Exception e1) { e1.printStackTrace(); } //Save as a last open folder String folder = fc.getSelectedFile().getParent(); lastOpenFolderElement.setText(folder); XMLUtilities.writeToFile("resources/settings/itSettings.xml", itSettings.getDocument()); } else { planSimStatusBar.setText("Status:"); appendOutputPanelText(">> Canceled \n"); } } }); resultsToolBar.add(openPlanReportDataButton); JButton compareProjectReportDataButton = new JButton("Compare Project Data", new ImageIcon("resources/images/compare.png")); compareProjectReportDataButton.setToolTipText( "<html>Compare different project report data <br> This is commonly use to compare diferent domain models with different adjustments.<br>" + "One project data must be chosen as a reference; others will be compared to this referencial one.</html>"); compareProjectReportDataButton.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(ActionEvent e) { final ProjectComparisonDialog dialog = new ProjectComparisonDialog(); dialog.setVisible(true); final List<String> files = dialog.getFiles(); if (files.size() > 1) { new Thread() { public void run() { appendOutputPanelText(">> Project comparison report requested. Processing... \n"); planSimStatusBar.setText("Status: Reading files ..."); appendOutputPanelText(">> Reading files ... \n"); //base project file String baseFileName = files.get(0); appendOutputPanelText(">> Reading file '" + baseFileName + "' \n"); org.jdom.Document baseProjectDoc = null; try { baseProjectDoc = XMLUtilities.readFromFile(baseFileName); } catch (Exception ec) { ec.printStackTrace(); } Element baseProject = null; if (baseProjectDoc != null) { baseProject = baseProjectDoc.getRootElement().getChild("project"); } //The comparible projects List<Element> comparableProjects = new ArrayList<Element>(); for (int i = 1; i < files.size(); i++) { String eafile = files.get(i); appendOutputPanelText(">> Reading file '" + eafile + "' \n"); org.jdom.Document eaProjectDoc = null; try { eaProjectDoc = XMLUtilities.readFromFile(eafile); } catch (Exception ec) { ec.printStackTrace(); } if (eaProjectDoc != null) { comparableProjects.add(eaProjectDoc.getRootElement().getChild("project")); } } appendOutputPanelText(">> Files read. Building report... \n"); String comparisonReport = PlanAnalyzer.generateProjectComparisonReport(baseProject, comparableProjects); saveFile("resources/report/Report.html", comparisonReport); appendOutputPanelText( ">> Project comparison report generated. Press 'View Full Report'\n"); appendOutputPanelText(" \n"); } }.start(); } } }); resultsToolBar.add(compareProjectReportDataButton); resultsPanel.add(resultsToolBar, BorderLayout.NORTH); resultsPanel.add(new JScrollPane(planInfoEditorPane), BorderLayout.CENTER); JTabbedPane planAnalysisTabbedPane = new JTabbedPane(); planAnalysisTabbedPane.addTab("Results", resultsPanel); planAnalysisTabbedPane.addTab("Variable Tracking", mainChartsPanel); planAnalysisTabbedPane.addTab("Movie Maker", getMovieMakerPanel()); planAnalysisTabbedPane.addTab("Plan Evaluation", getPlanEvaluationPanel()); planAnalysisTabbedPane.addTab("Plan Database", getPlanDatabasePanel()); planAnalysisTabbedPane.addTab("Rationale Database", getRationaleDatabasePanel()); JPanel planAnalysisPanel = new JPanel(new BorderLayout()); //planAnalysisPanel.add(chartsToolBar, BorderLayout.NORTH); planAnalysisPanel.add(planAnalysisTabbedPane, BorderLayout.CENTER); planAnalysisFramePanel.setContent(planAnalysisPanel, false); } return planAnalysisFramePanel; }
From source file:net.sourceforge.pmd.util.designer.Designer.java
public Designer(String[] args) { if (args.length > 0) { exitOnClose = !args[0].equals("-noexitonclose"); }// w w w. ja v a 2 s .c o m Initializer.initialize(); xpathQueryArea.setFont(new Font("Verdana", Font.PLAIN, 16)); JSplitPane controlSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, createCodeEditorPanel(), createXPathQueryPanel()); JSplitPane astAndSymbolTablePane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, createASTPanel(), createSymbolTableResultPanel()); JSplitPane resultsSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, astAndSymbolTablePane, createXPathResultPanel()); JTabbedPane tabbed = new JTabbedPane(); tabbed.addTab("Abstract Syntax Tree / XPath / Symbol Table", resultsSplitPane); tabbed.addTab("Data Flow Analysis", dfaPanel); tabbed.setMnemonicAt(0, KeyEvent.VK_A); tabbed.setMnemonicAt(1, KeyEvent.VK_D); JSplitPane containerSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, controlSplitPane, tabbed); containerSplitPane.setContinuousLayout(true); JMenuBar menuBar = createMenuBar(); frame.setJMenuBar(menuBar); frame.getContentPane().add(containerSplitPane); frame.setDefaultCloseOperation(exitOnClose ? JFrame.EXIT_ON_CLOSE : WindowConstants.DISPOSE_ON_CLOSE); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int screenHeight = screenSize.height; int screenWidth = screenSize.width; frame.pack(); frame.setSize(screenWidth * 3 / 4, screenHeight * 3 / 4); frame.setLocation((screenWidth - frame.getWidth()) / 2, (screenHeight - frame.getHeight()) / 2); frame.setVisible(true); int horozontalMiddleLocation = controlSplitPane.getMaximumDividerLocation() * 3 / 5; controlSplitPane.setDividerLocation(horozontalMiddleLocation); containerSplitPane.setDividerLocation(containerSplitPane.getMaximumDividerLocation() / 2); astAndSymbolTablePane.setDividerLocation(astAndSymbolTablePane.getMaximumDividerLocation() / 3); resultsSplitPane.setDividerLocation(horozontalMiddleLocation); loadSettings(); }
From source file:nz.co.fortytwo.freeboard.installer.InstalManager.java
private void addWidgets() { JTabbedPane tabPane = new JTabbedPane(); this.add(tabPane, BorderLayout.CENTER); // upload to arduinos JPanel uploadPanel = new JPanel(); uploadPanel.setLayout(new BorderLayout()); uploadPanel.add(uploadingPanel, BorderLayout.CENTER); final JPanel westUploadPanel = new JPanel(new MigLayout()); String info = "\nUse this panel to upload compiled code to the arduino devices.\n\n" + "NOTE: directories with spaces will probably not work!\n\n" + "First select the base directory of your Arduino IDE installation, eg C:/devtools/arduino-1.5.2\n\n" + "Then select target files to upload, these are ended in '.hex'\n" + "\nand can be downloaded from github (https://github.com/rob42),\n" + " see the 'Release*' sub-directories\n\n" + "Output of the process will display in the right-side window\n\n"; JTextArea jTextInfo = new JTextArea(info); jTextInfo.setEditable(false);// w ww. j ava 2 s . c om westUploadPanel.add(jTextInfo, "span,wrap"); westUploadPanel.add(new JLabel("Select Arduino IDE directory:"), "wrap"); arduinoDirTextField.setEditable(false); westUploadPanel.add(arduinoDirTextField, "span 2"); arduinoIdeChooser.setApproveButtonText("Select"); arduinoIdeChooser.setAcceptAllFileFilterUsed(false); arduinoIdeChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); arduinoIdeChooser.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (JFileChooser.APPROVE_SELECTION.equals(evt.getActionCommand())) { toolsDir = new File(arduinoIdeChooser.getSelectedFile(), File.separator + "hardware" + File.separator + "tools" + File.separator); if (!toolsDir.exists()) { toolsDir = null; JOptionPane.showMessageDialog(westUploadPanel, "Not a valid Arduino IDE directory"); return; } arduinoDirTextField.setText(arduinoIdeChooser.getSelectedFile().getAbsolutePath()); } } }); JButton arduinoDirButton = new JButton("Select"); arduinoDirButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { arduinoIdeChooser.showDialog(westUploadPanel, "Select"); } }); westUploadPanel.add(arduinoDirButton, "wrap"); westUploadPanel.add(new JLabel("Select comm port:")); westUploadPanel.add(portComboBox, "wrap"); westUploadPanel.add(new JLabel("Select device:"), "gap unrelated"); westUploadPanel.add(deviceComboBox, "wrap"); hexFileChooser.setApproveButtonText("Upload"); hexFileChooser.setAcceptAllFileFilterUsed(false); hexFileChooser.addChoosableFileFilter(new FileFilter() { @Override public String getDescription() { return "*.hex - Hex file"; } @Override public boolean accept(File f) { if (f.isDirectory()) { return true; } if (f.getName().toUpperCase().endsWith(".HEX")) { return true; } return false; } }); westUploadPanel.add(hexFileChooser, "span, wrap"); uploadPanel.add(westUploadPanel, BorderLayout.WEST); tabPane.addTab("Upload", uploadPanel); // charts JPanel chartPanel = new JPanel(); chartPanel.setLayout(new BorderLayout()); FileNameExtensionFilter filter = new FileNameExtensionFilter("Charts", "tiff", "kap", "KAP", "TIFF", "tif", "TIF"); chartFileChooser.setFileFilter(filter); chartFileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); chartFileChooser.setMultiSelectionEnabled(true); final JPanel chartWestPanel = new JPanel(new MigLayout()); String info2 = "\nUse this panel to convert charts into the correct format for FreeBoard.\n" + "\nYou need to select the charts or directories containing charts, then click 'Process'.\n " + "\nThe results will be in a directory with the same name as the chart, and the chart " + "\ndirectory will also be compressed into a zip file ready to transfer to your FreeBoard " + "\nserver\n" + "\nOutput of the process will display in the right-side window\n\n"; JTextArea jTextInfo2 = new JTextArea(info2); jTextInfo2.setEditable(false); chartWestPanel.add(jTextInfo2, "wrap"); chartFileChooser.setApproveButtonText("Process"); chartWestPanel.add(chartFileChooser, "span,wrap"); final JPanel loggingPanel = new JPanel(new MigLayout()); loggingGroup.add(infoButton); loggingGroup.add(debugButton); debugButton.setSelected(logger.isDebugEnabled()); infoButton.setSelected(!logger.isDebugEnabled()); infoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (infoButton.isSelected()) { LogManager.getRootLogger().setLevel(Level.INFO); } } }); debugButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (debugButton.isSelected()) { LogManager.getRootLogger().setLevel(Level.DEBUG); } } }); loggingPanel.add(new JLabel("Logging Level")); loggingPanel.add(infoButton); loggingPanel.add(debugButton); chartWestPanel.add(loggingPanel, "span,wrap"); final JPanel transparentPanel = new JPanel(new MigLayout()); charsetGroup.add(utf8Button); charsetGroup.add(iso8859Button); iso8859Button.setSelected(logger.isDebugEnabled()); utf8Button.setSelected(!logger.isDebugEnabled()); utf8Button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (utf8Button.isSelected()) { charset = "UTF-8"; } } }); iso8859Button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (iso8859Button.isSelected()) { charset = "ISO-8859-1"; } } }); transparentPanel.add(new JLabel("KAP Character set:")); transparentPanel.add(utf8Button); transparentPanel.add(iso8859Button); chartWestPanel.add(transparentPanel); chartPanel.add(chartWestPanel, BorderLayout.WEST); chartPanel.add(processingPanel, BorderLayout.CENTER); tabPane.addTab("Charts", chartPanel); // IMU calibration JPanel calPanel = new JPanel(); calPanel.setLayout(new BorderLayout()); JPanel westCalPanel = new JPanel(new MigLayout()); String info3 = "\nUse this panel to calibrate your ArduIMU.\n" + "\nYou should do this as near to the final location as possible,\n" + "and like all compasses, as far from wires and magnetic materials \n" + "as possible.\n" + "\nSelect your comm port, then click 'Start'.\n " + "\nSmoothly and steadily rotate the ArduIMU around all 3 axes (x,y,z)\n" + "several times. Then press stop and the calibration will be performed and\n" + "uploaded to the ArduIMU\n\n" + "Output of the process will display in the right-side window\n\n"; JTextArea jTextInfo3 = new JTextArea(info3); jTextInfo3.setEditable(false); westCalPanel.add(jTextInfo3, "span, wrap"); westCalPanel.add(new JLabel("Select comm port:")); westCalPanel.add(portComboBox1, "wrap"); JButton startCal = new JButton("Start"); startCal.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { calibrationPanel.process((String) portComboBox.getSelectedItem()); } }); westCalPanel.add(startCal); JButton stopCal = new JButton("Stop"); stopCal.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { calibrationPanel.stopProcess(); } }); westCalPanel.add(stopCal); calPanel.add(westCalPanel, BorderLayout.WEST); calPanel.add(calibrationPanel, BorderLayout.CENTER); tabPane.addTab("Calibration", calPanel); }
From source file:org.ayound.js.debug.ui.DebugMainFrame.java
private Component createDebugPane() { JTabbedPane debugPane = new JTabbedPane(); debugPane.addTab(Messages.getString("DebugMainFrame.Varibles"), new DebugContextPanel()); //$NON-NLS-1$ debugPane.addTab(Messages.getString("DebugMainFrame.BreakPoints"), new BreakPointManagerPanel()); //$NON-NLS-1$ debugPane.addTab(Messages.getString("DebugMainFrame.Expressions"), new ExpressionManagerPanel()); //$NON-NLS-1$ return debugPane; }
From source file:org.ayound.js.debug.ui.DebugMainFrame.java
private Component createDebugContextPane() { JPanel debugContextPanel = new JPanel(); debugContextPanel.setLayout(new VerticalBagLayout()); JTabbedPane debugTreePane = new JTabbedPane(); DebugStackPanel treePanel = new DebugStackPanel(); debugTreePane.addTab(Messages.getString("DebugMainFrame.Debug"), treePanel); //$NON-NLS-1$ JsResourcePanel resourcePanel = new JsResourcePanel(); debugTreePane.addTab(Messages.getString("DebugMainFrame.Resources"), resourcePanel); //$NON-NLS-1$ debugContextPanel.add(debugTreePane); return debugContextPanel; }
From source file:org.coronastreet.gpxconverter.AccountManager.java
public AccountManager(MainWindow window) { setTitle("Account Settings"); setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); setBounds(100, 100, 450, 199);//from w w w . j av a2 s . c o m frmAccounts = new JPanel(); frmAccounts.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(frmAccounts); frmAccounts.setLayout(null); JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); tabbedPane.setBounds(5, 5, 424, 118); frmAccounts.add(tabbedPane); JPanel stravaPanel = new JPanel(); stravaPanel.setLayout(null); tabbedPane.addTab("Strava", stravaPanel); strava_username = new JTextField(); strava_username.setBounds(79, 11, 235, 20); stravaPanel.add(strava_username); strava_username.setColumns(10); JLabel lblUsername = new JLabel("Username:"); lblUsername.setBounds(10, 14, 69, 14); stravaPanel.add(lblUsername); JLabel lblPassword = new JLabel("Password:"); lblPassword.setBounds(10, 45, 69, 14); stravaPanel.add(lblPassword); strava_password = new JPasswordField(); strava_password.setColumns(10); strava_password.setBounds(79, 42, 235, 20); stravaPanel.add(strava_password); JPanel rwgpsPanel = new JPanel(); rwgpsPanel.setLayout(null); tabbedPane.addTab("RideWithGPS", rwgpsPanel); JLabel label = new JLabel("Username:"); label.setBounds(10, 14, 69, 14); rwgpsPanel.add(label); rwgps_username = new JTextField(); rwgps_username.setColumns(10); rwgps_username.setBounds(79, 11, 235, 20); rwgpsPanel.add(rwgps_username); rwgps_password = new JPasswordField(); rwgps_password.setColumns(10); rwgps_password.setBounds(79, 42, 235, 20); rwgpsPanel.add(rwgps_password); JLabel label_1 = new JLabel("Password:"); label_1.setBounds(10, 45, 69, 14); rwgpsPanel.add(label_1); JPanel garminPanel = new JPanel(); garminPanel.setLayout(null); tabbedPane.addTab("Garmin Connect", garminPanel); JLabel label_2 = new JLabel("Username:"); label_2.setBounds(10, 14, 69, 14); garminPanel.add(label_2); garmin_username = new JTextField(); garmin_username.setColumns(10); garmin_username.setBounds(79, 11, 235, 20); garminPanel.add(garmin_username); garmin_password = new JPasswordField(); garmin_password.setColumns(10); garmin_password.setBounds(79, 42, 235, 20); garminPanel.add(garmin_password); JLabel label_3 = new JLabel("Password:"); label_3.setBounds(10, 45, 69, 14); garminPanel.add(label_3); loadAccountPrefs(); JButton btnSave = new JButton("SAVE"); btnSave.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { saveAccountInfo(); } }); btnSave.setBounds(106, 127, 89, 23); frmAccounts.add(btnSave); JButton btnCancel = new JButton("CANCEL"); btnCancel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { cancel(); } }); btnCancel.setBounds(242, 127, 89, 23); frmAccounts.add(btnCancel); }
From source file:org.drugis.addis.gui.builder.TreatmentCategorizationView.java
@Override public JComponent buildPanel() { SingleColumnPanelBuilder builder = new SingleColumnPanelBuilder(); // ---------- Overview ---------- builder.addSeparator(CategoryKnowledgeFactory.getCategoryKnowledge(TreatmentCategorization.class) .getSingularCapitalized());//from ww w .ja v a 2 s .c o m builder.add(buildOverviewPanel()); final JTabbedPane tabbedPane = new AddisTabbedPane(); tabbedPane.addTab("Overview", builder.getPanel()); // ---------- Tree visualization ---------- builder = new SingleColumnPanelBuilder(); FormLayout layout = new FormLayout("fill:pref:grow", "p, 3dlu, p, 3dlu, fill:pref:grow"); final PanelBuilder tree = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); tree.addSeparator("Dose Decision Tree", cc.xy(1, 1)); tree.add( new JLabel("Dose range values are in: " + d_model.getModel(TreatmentCategorization.PROPERTY_DOSE_UNIT).getValue().toString()), cc.xy(1, 3)); tree.add(TreatmentCategorizationOverviewWizardStep.buildOverview(d_model.getBean().getDecisionTree()), cc.xy(1, 5)); builder.add(tree.getPanel()); tabbedPane.addTab("Decision tree", builder.getPanel()); return tabbedPane; }