List of usage examples for javax.swing JTabbedPane JTabbedPane
public JTabbedPane()
TabbedPane
with a default tab placement of JTabbedPane.TOP
. From source file:fxts.stations.ui.help.HelpPane.java
/** * Inits all components./*from w ww . j a v a 2 s .c o m*/ */ private void initComponents() { //creates history mHistory = new HelpContentHistory(); //Create the text area for contents mTabbedPane = new JTabbedPane(); //creates content tree mContentTree = new ContentTree("fxts/stations/trader/resources/help/contents.xml"); mContentTree.addListener(this); //Create the scroll pane and add the tree to it. JScrollPane treeView = new JScrollPane(mContentTree.getTree()); mTabbedPane.addTab(mResMan.getString("IDS_HELP_CONTENTS", "Contents"), treeView); //xxx workaround for bug #6424509, memory leak JEditorPane.registerEditorKitForContentType("text/html", WeakHTMLEditorKit.class.getName()); //creates the text area for the showing of the help. mHtmlPage = new JEditorPane(); mHtmlPage.setEditable(false); mHtmlPage.putClientProperty("charset", "UTF-16"); mHtmlPage.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent aEvent) { if (aEvent.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { try { onSelectContentByHyperlink(aEvent.getURL()); mHtmlPage.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } catch (Exception e) { mLogger.error("Hiperlink not processed!"); e.printStackTrace(); } } } }); JScrollPane scrollPane = new JScrollPane(mHtmlPage); //creates a split pane for the change log and the text area. mSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, mTabbedPane, scrollPane); mSplitPane.setOneTouchExpandable(true); //Creates the toolbar area. JToolBar toolbar = UIManager.getInst().createToolBar(); toolbar.setFloatable(false); //creates label with left arrow UIManager uiMan = UIManager.getInst(); mBackButton = uiMan.createButton(null, "ID_HELP_LEFT_ARROW", "ID_HELP_LEFT_ARROW_DESC", "ID_HELP_LEFT_ARROW_DESC"); mBackButton.setEnabled(false); mBackButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent aEvent) { if (mHistory.hasBackStep()) { mIsHistorycalStep = true; onSelectContent(mHistory.back()); mBackButton.setEnabled(mHistory.hasBackStep()); mForwardButton.setEnabled(mHistory.hasForwardStep()); } } }); toolbar.add(mBackButton); //creates label with right arrow mForwardButton = uiMan.createButton(null, "ID_HELP_RIGHT_ARROW", "ID_HELP_RIGHT_ARROW_DESC", "ID_HELP_RIGHT_ARROW_DESC"); mForwardButton.setEnabled(false); mForwardButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent aEvent) { if (mHistory.hasForwardStep()) { mIsHistorycalStep = true; onSelectContent(mHistory.forward()); mBackButton.setEnabled(mHistory.hasBackStep()); mForwardButton.setEnabled(mHistory.hasForwardStep()); } } }); toolbar.add(mForwardButton); //creates label with up arrow mUpButton = uiMan.createButton(null, "ID_HELP_UP_ARROW", "ID_HELP_UP_ARROW_DESC", "ID_HELP_UP_ARROW_DESC"); mUpButton.setEnabled(mContentTree.getIterator().hasPrevious()); mUpButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent aEvent) { mContentsBrowsing = true; onSelectContent(mContentTree.getIterator().previous()); mUpButton.setEnabled(mContentTree.getIterator().hasPrevious()); mDownButton.setEnabled(mContentTree.getIterator().hasNext()); } }); toolbar.add(mUpButton); //creates label with down arrow mDownButton = uiMan.createButton(null, "ID_HELP_DOWN_ARROW", "ID_HELP_DOWN_ARROW_DESC", "ID_HELP_DOWN_ARROW_DESC"); mDownButton.setEnabled(mContentTree.getIterator().hasNext()); mDownButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent aEvent) { mContentsBrowsing = true; onSelectContent(mContentTree.getIterator().next()); mUpButton.setEnabled(mContentTree.getIterator().hasPrevious()); mDownButton.setEnabled(mContentTree.getIterator().hasNext()); } }); toolbar.add(mDownButton); //sets layout setLayout(new BorderLayout()); //add the components to the frame. add(mSplitPane, BorderLayout.CENTER); add(toolbar, BorderLayout.NORTH); //sets first page onSelectContent(mContentTree.getIterator().toBegin()); }
From source file:com.github.lindenb.jvarkit.tools.bamviewgui.BamFileRef.java
BamInternalFrame(BamFileRef ref) { super(ref.bamFile.getName(), true, false, true, true); this.ref = ref; JPanel mainPane = new JPanel(new BorderLayout(5, 5)); setContentPane(mainPane);//from w ww . ja va 2s. co m JTabbedPane tabbedPane = new JTabbedPane(); mainPane.add(tabbedPane, BorderLayout.CENTER); JPanel pane = new JPanel(new BorderLayout(5, 5)); tabbedPane.addTab("BAM", pane); this.tableModel = new BamTableModel(); this.jTable = createTable(tableModel); this.jTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); this.jTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane scroll1 = new JScrollPane(this.jTable); this.infoTableModel = new FlagTableModel(); JTable tInfo = createTable(this.infoTableModel); this.genotypeTableModel = new SAMTagAndValueModel(); JTable tGen = createTable(this.genotypeTableModel); this.groupTableModel = new ReadGroupTableModel(); JTable tGrp = createTable(this.groupTableModel); JPanel splitH = new JPanel(new GridLayout(1, 0, 5, 5)); splitH.add(new JScrollPane(tInfo)); splitH.add(new JScrollPane(tGen)); splitH.add(new JScrollPane(tGrp)); JSplitPane splitVert = new JSplitPane(JSplitPane.VERTICAL_SPLIT, scroll1, splitH); this.jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) return; int row = jTable.getSelectedRow(); SAMRecord ctx; if (row == -1 || (ctx = tableModel.getElementAt(row)) == null) { infoTableModel.setContext(null); genotypeTableModel.setContext(null); groupTableModel.setContext(null); } else { infoTableModel.setContext(ctx); genotypeTableModel.setContext(ctx); groupTableModel.setContext(ctx); } } }); pane.add(splitVert); //header as text pane = new JPanel(new BorderLayout(5, 5)); tabbedPane.addTab("Header", pane); JTextArea area = new JTextArea(String.valueOf(ref.header.getTextHeader())); area.setCaretPosition(0); area.setEditable(false); pane.add(new JScrollPane(area), BorderLayout.CENTER); //dict pane = new JPanel(new BorderLayout(5, 5)); tabbedPane.addTab("Reference", pane); JTable dictTable = createTable(new SAMSequenceDictionaryTableModel(ref.header.getSequenceDictionary())); dictTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); pane.add(new JScrollPane(dictTable), BorderLayout.CENTER); this.selList = new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) return; listSelectionChanged(); } }; this.addInternalFrameListener(new InternalFrameAdapter() { @Override public void internalFrameActivated(InternalFrameEvent e) { jTable.getSelectionModel().addListSelectionListener(selList); } @Override public void internalFrameDeactivated(InternalFrameEvent e) { jTable.getSelectionModel().removeListSelectionListener(selList); } }); }
From source file:PVGraph.java
public PVGraph(Calendar date, int initialViewIndex) { super(WINDOW_TITLE_PREFIX); this.date = date; synchronized (graphs) { graphs.add(this); }// w w w. j a v a2 s .com views = new PVGraphView[4]; views[DAY_VIEW_INDEX] = new DayView(); views[MONTH_VIEW_INDEX] = new MonthView(); views[YEAR_VIEW_INDEX] = new YearView(); views[YEARS_VIEW_INDEX] = new YearsView(); tabPane = new JTabbedPane(); for (PVGraphView v : views) tabPane.addTab(v.getTabLabel(), v.makePanel()); tabPane.setSelectedIndex(initialViewIndex); setContentPane(tabPane); pack(); try { java.net.URL url = getClass().getResource("sun.png"); if (url != null) setIconImage(ImageIO.read(url)); } catch (IOException ioe) { System.err.println(ioe.getMessage()); } ; setVisible(true); KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new KeyEventDispatcher() { public boolean dispatchKeyEvent(KeyEvent ke) { Object src = ke.getSource(); if (src instanceof JComponent && ((JComponent) src).getRootPane().getContentPane() == tabPane) { if (ke.getID() == KeyEvent.KEY_TYPED) { switch (ke.getKeyChar()) { case 'd': tabPane.setSelectedIndex(DAY_VIEW_INDEX); return true; case 'm': tabPane.setSelectedIndex(MONTH_VIEW_INDEX); return true; case 'N' - 0x40: new PVGraph((Calendar) PVGraph.this.date.clone(), tabPane.getSelectedIndex()); return true; case 'Q' - 0x40: dispatchEvent(new WindowEvent(PVGraph.this, WindowEvent.WINDOW_CLOSING)); return true; case 'R' - 0x40: loadProperties(); updateView(); return true; case 'S': try { runSmatool(); updateView(); } catch (IOException ioe) { System.err.println(ioe.getMessage()); } return true; case 'y': tabPane.setSelectedIndex(YEAR_VIEW_INDEX); return true; case 'Y': tabPane.setSelectedIndex(YEARS_VIEW_INDEX); return true; default: return views[tabPane.getSelectedIndex()].handleKey(ke.getKeyChar()); } } } return false; } }); }
From source file:org.jfree.demo.DrawStringDemo.java
/** * Creates the content pane for the demo frame. * * @return The content pane./*from w w w. java2 s .co m*/ */ private JPanel createContentPane() { final JPanel content = new JPanel(new BorderLayout()); final JTabbedPane tabs = new JTabbedPane(); tabs.add("Alignment", createTab1Content()); tabs.add("Rotation", createTab2Content()); content.add(tabs); return content; }
From source file:org.jfree.demo.DrawStringDemo.java
/** * Creates the content pane for the demo frame. * * @return The content pane./*from w w w .ja v a 2 s.com*/ */ private JPanel createContentPane() { final JPanel content = new JPanel(new BorderLayout()); final JTabbedPane tabs = new JTabbedPane(); tabs.add("Alignment", createTab1Content()); tabs.add("Rotation", createTab2Content()); content.add(tabs); return content; }
From source file:gtu._work.ui.ExportSVNModificationFilesUI.java
private void initGUI() { try {//from www . j av a 2 s. co m final SwingActionUtil swingUtil = SwingActionUtil.newInstance(this); BorderLayout thisLayout = new BorderLayout(); getContentPane().setLayout(thisLayout); this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.setTitle("SVN BACKUP"); this.setPreferredSize(new java.awt.Dimension(734, 442)); { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); jTabbedPane1.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent evt) { swingUtil.invokeAction("jTabbedPane1_changeEvent", evt); } }); { jPanel1 = new JPanel(); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); jTabbedPane1.addTab("src text", null, jPanel1, null); { jScrollPane1 = new JScrollPane(); jPanel1.add(jScrollPane1, BorderLayout.CENTER); { srcArea = new JTextArea(); jScrollPane1.setViewportView(srcArea); } } { loadSrcTextarea = new JButton(); jPanel1.add(loadSrcTextarea, BorderLayout.SOUTH); loadSrcTextarea.setText("load src textarea"); loadSrcTextarea.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("loadSrcTextarea.actionPerformed", evt); } }); } { srcBaseDir = new JButton(); jPanel1.add(srcBaseDir, BorderLayout.NORTH); srcBaseDir.setText("set src base dir"); srcBaseDir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("srcBaseDir.actionPerformed", evt); } }); } } { jPanel2 = new JPanel(); BorderLayout jPanel2Layout = new BorderLayout(); jPanel2.setLayout(jPanel2Layout); jTabbedPane1.addTab("src list", null, jPanel2, null); { jScrollPane2 = new JScrollPane(); jPanel2.add(jScrollPane2, BorderLayout.CENTER); jScrollPane2.setPreferredSize(new java.awt.Dimension(531, 317)); { ListModel srcListModel = new DefaultListModel(); srcList = new JList(); jScrollPane2.setViewportView(srcList); srcList.setModel(srcListModel); srcList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { swingUtil.invokeAction("srcList.mouseClicked", evt); } }); srcList.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { swingUtil.invokeAction("srcList.keyPressed", evt); } }); } } { srcListQuery = new JTextField(); srcListQuery.getDocument() .addDocumentListener(JCommonUtil.getDocumentListener(new HandleDocumentEvent() { public void process(DocumentEvent event) { String scan = JCommonUtil.getDocumentText(event); DefaultListModel model = new DefaultListModel(); Pattern pat = Pattern.compile(scan); for (LineParser line : copySrcListForQuerySet) { if (!line.file.exists()) { continue; } if (line.file.getAbsolutePath().contains(scan)) { model.addElement(line); continue; } try { if (pat.matcher(line.file.getAbsolutePath()).find()) { model.addElement(line); continue; } } catch (Exception ex) { } } srcList.setModel(model); } })); jPanel2.add(srcListQuery, BorderLayout.NORTH); } } { jPanel3 = new JPanel(); BorderLayout jPanel3Layout = new BorderLayout(); jPanel3.setLayout(jPanel3Layout); jTabbedPane1.addTab("out list", null, jPanel3, null); { jScrollPane3 = new JScrollPane(); jPanel3.add(jScrollPane3, BorderLayout.CENTER); { ListModel outPutListModel = new DefaultListModel(); outPutList = new JList(); jScrollPane3.setViewportView(outPutList); outPutList.setModel(outPutListModel); outPutList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { swingUtil.invokeAction("outPutList.mouseClicked", evt); } }); outPutList.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { swingUtil.invokeAction("outPutList.keyPressed", evt); } }); } } { outPutDir = new JButton(); jPanel3.add(outPutDir, BorderLayout.NORTH); outPutDir.setText("set output dir"); outPutDir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("outPutDir.actionPerformed", evt); } }); } { execute = new JButton(); jPanel3.add(execute, BorderLayout.SOUTH); execute.setText("execute backup"); execute.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("execute.actionPerformed", evt); } }); } } { jPanel4 = new JPanel(); BorderLayout jPanel4Layout = new BorderLayout(); jPanel4.setLayout(jPanel4Layout); jTabbedPane1.addTab("compre", null, jPanel4, null); { jScrollPane4 = new JScrollPane(); jPanel4.add(jScrollPane4, BorderLayout.CENTER); jScrollPane4.setPreferredSize(new java.awt.Dimension(713, 339)); { TableModel compareTableModel = new DefaultTableModel(); compareTable = new JTable(); jScrollPane4.setViewportView(compareTable); compareTable.setModel(compareTableModel); JTableUtil.defaultSetting(compareTable); compareTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { swingUtil.invokeAction("compareTable.mouseClicked", evt); } }); } } { jPanel5 = new JPanel(); jPanel4.add(jPanel5, BorderLayout.NORTH); jPanel5.setPreferredSize(new java.awt.Dimension(713, 42)); { openExternalSrcFolder = new JButton(); jPanel5.add(openExternalSrcFolder); openExternalSrcFolder.setText("open external src folder"); openExternalSrcFolder.setPreferredSize(new java.awt.Dimension(280, 29)); openExternalSrcFolder.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("openExternalSrcFolder.actionPerformed", evt); } }); } { startCompareMatch = new JButton(); jPanel5.add(startCompareMatch); startCompareMatch.setText("start compare source"); startCompareMatch.setPreferredSize(new java.awt.Dimension(280, 29)); startCompareMatch.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("startCompareMatch.actionPerformed", evt); } }); } } } { jPanel6 = new JPanel(); GroupLayout jPanel6Layout = new GroupLayout((JComponent) jPanel6); jPanel6.setLayout(jPanel6Layout); jTabbedPane1.addTab("configuration", null, jPanel6, null); { DefaultComboBoxModel exportModeComboModel = new DefaultComboBoxModel(); for (ParseMode mode : ParseMode.values()) { exportModeComboModel.addElement(mode); } exportModeCombo = new JComboBox(); exportModeCombo.setModel(exportModeComboModel); } jPanel6Layout.setHorizontalGroup(jPanel6Layout .createSequentialGroup().addContainerGap(41, 41).addComponent(exportModeCombo, GroupLayout.PREFERRED_SIZE, 167, GroupLayout.PREFERRED_SIZE) .addContainerGap(505, Short.MAX_VALUE)); jPanel6Layout .setVerticalGroup(jPanel6Layout.createSequentialGroup().addContainerGap(30, 30) .addComponent(exportModeCombo, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap(321, Short.MAX_VALUE)); } { jPanel7 = new JPanel(); BorderLayout jPanel7Layout = new BorderLayout(); jPanel7.setLayout(jPanel7Layout); jTabbedPane1.addTab("error log", null, jPanel7, null); { jScrollPane5 = new JScrollPane(); jPanel7.add(jScrollPane5, BorderLayout.CENTER); { DefaultListModel errorLogListModel = new DefaultListModel(); errorLogList = new JList(); jScrollPane5.setViewportView(errorLogList); errorLogList.setModel(errorLogListModel); } } } } this.setSize(734, 442); swingUtil.addAction("openExternalSrcFolder.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { File dir = JFileChooserUtil.newInstance().selectDirectoryOnly().showOpenDialog() .getApproveSelectedFile(); if (dir == null) { JOptionPaneUtil.newInstance().iconErrorMessage().showMessageDialog("file is not correct!", "ERROR"); return; } externalDir = dir; } }); swingUtil.addAction("startCompareMatch.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { Validate.notNull(manualBaseDir, "source folder not set!!"); Validate.notNull(externalDir, "external folder not set!!"); Validate.isTrue(!manualBaseDir.equals(externalDir), "source dir : " + manualBaseDir + "\nexternal dir : " + externalDir + "\n cant be the same!!"); List<File> externalSrcFolderList = new ArrayList<File>(); FileUtil.searchFileMatchs(externalDir, ".*", externalSrcFolderList); System.out.println("externalSrcFolderList = " + externalSrcFolderList.size()); List<File> manualBaseSourceList = new ArrayList<File>(); FileUtil.searchFileMatchs(manualBaseDir, ".*", manualBaseSourceList); System.out.println("manualBaseSourceList = " + manualBaseSourceList.size()); String cutExternalPath = FileUtil.exportReceiveBaseDir(externalSrcFolderList).getAbsolutePath(); System.out.println("cutExternalPath = " + cutExternalPath); int cutExternalLength = cutExternalPath.length(); List<CompareFile> _compareList = new ArrayList<CompareFile>(); CompareFile compare = null; File mostCloseFile = null; List<File> searchMatchSrcList = new ArrayList<File>(); for (File external : externalSrcFolderList) { compare = new CompareFile(); compare.external = external; searchMatchSrcList.clear(); mostCloseFile = new File(manualBaseDir, external.getAbsolutePath().substring(cutExternalLength)); System.out.println(mostCloseFile.exists() + " == close file : " + mostCloseFile); if (mostCloseFile.exists()) { searchMatchSrcList.add(mostCloseFile); } else { for (File src : manualBaseSourceList) { if (src.getName().equalsIgnoreCase(external.getName())) { searchMatchSrcList.add(src); } } } System.out.println(external.getName() + " => match source : " + searchMatchSrcList.size()); compare.srcSet = new HashSet<File>(searchMatchSrcList); _compareList.add(compare); } compareList = _compareList; reloadCompareTable(); } }); swingUtil.addAction("compareTable.mouseClicked", new Action() { String tortoiseMergeFormat = "cmd /c call TortoiseMerge /base:\"%s\" /theirs:\"%s\""; String openFileFormat = "cmd /c call \"%s\""; void openFile(File file) { String command = String.format(openFileFormat, file); System.out.println(command); try { ProcessWatcher.newInstance(Runtime.getRuntime().exec(command)).getStreamSync(); System.out.println("do reload..."); reloadCompareTable(); } catch (IOException e1) { JCommonUtil.handleException(e1); } } public void action(EventObject evt) throws Exception { MouseEvent event = (MouseEvent) evt; int rowPos = JTableUtil.newInstance(compareTable).getSelectedRow(); final File external = (File) JTableUtil.newInstance(compareTable).getModel().getValueAt(rowPos, CompareTableIndex.EXTERNAL_FILE.pos); final File srcFile = (File) JTableUtil.newInstance(compareTable).getModel().getValueAt(rowPos, CompareTableIndex.SOURCE_FILE.pos); System.out.println("external : " + external); System.out.println("srcFile : " + srcFile); if (JMouseEventUtil.buttonLeftClick(2, event)) { String command = String.format(tortoiseMergeFormat, external, srcFile); System.out.println(command); Runtime.getRuntime().exec(command); } if (JMouseEventUtil.buttonRightClick(1, event)) { JMenuItem showInfoMenu = new JMenuItem(); showInfoMenu.setText("information"); showInfoMenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPaneUtil.newInstance().iconInformationMessage().showMessageDialog(// "source file : \n" + srcFile + "\n" + DateFormatUtils.format(srcFile.lastModified(), "yyyy/MM/dd HH:mm:ss") + "\n" + "size : " + srcFile.length() / 1024 + "\n\n" + "external file : \n" + external + "\n" + DateFormatUtils.format(external.lastModified(), "yyyy/MM/dd HH:mm:ss") + "\n" + "size : " + external.length() / 1024, "INFORMATION"); } }); JMenuItem openFileMenu = new JMenuItem(); openFileMenu.setText("OPEN : source"); openFileMenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { openFile(srcFile); } }); JMenuItem openExternalMenu = new JMenuItem(); openExternalMenu.setText("OPEN : external"); openExternalMenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { openFile(external); } }); JMenuItem openPairlMenu = new JMenuItem(); openPairlMenu.setText("OPEN : all"); openPairlMenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { openFile(srcFile); openFile(external); } }); JPopupMenuUtil.newInstance(compareTable).applyEvent(event) .addJMenuItem(showInfoMenu, openFileMenu, openExternalMenu, openPairlMenu).show(); } } }); swingUtil.addAction("loadSrcTextarea.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { loadSrcTextarea(); } }); swingUtil.addAction("srcList.mouseClicked", new Action() { public void action(EventObject evt) throws Exception { if (JMouseEventUtil.buttonRightClick(1, evt)) { JPopupMenuUtil.newInstance(srcList).applyEvent(evt) .addJMenuItem("mark svn delete", new ActionListener() { public void actionPerformed(ActionEvent e) { if (JOptionPaneUtil.ComfirmDialogResult.YES_OK_OPTION != JOptionPaneUtil .newInstance().confirmButtonYesNo().showConfirmDialog( "are you sure, mark delete file : " + srcList.getSelectedValues().length, "SVN DELETE")) { return; } StringBuilder sb = new StringBuilder(); Process process = null; InputStream in = null; for (Object obj : srcList.getSelectedValues()) { LineParser l = (LineParser) obj; String command = String.format("svn delete \"%s\"", l.file); System.out.println(command); try { process = Runtime.getRuntime().exec(command); in = process.getInputStream(); for (; in.read() != -1;) ; if (l.file.exists()) { sb.append(l.file.getName() + "\n"); } } catch (IOException e1) { e1.printStackTrace(); sb.append(l.file.getName() + "\n"); } } if (sb.length() > 0) { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog("error : \n" + sb, "ERROR"); } else { JOptionPaneUtil.newInstance().iconInformationMessage() .showMessageDialog("mark delete completed!!", "SUCCESS"); } DefaultListModel model = (DefaultListModel) srcList.getModel(); for (int ii = 0; ii < model.getSize(); ii++) { LineParser l = (LineParser) model.getElementAt(ii); if (!l.file.exists()) { model.remove(ii); ii--; } } } }).show(); } if (!JListUtil.newInstance(srcList).isCorrectMouseClick(evt)) { return; } LineParser lineParser = (LineParser) JListUtil.getLeadSelectionObject(srcList); if (lineParser == null) { return; } Runtime.getRuntime().exec("cmd /c call \"" + lineParser.file + "\""); } }); swingUtil.addAction("srcList.keyPressed", new Action() { public void action(EventObject evt) throws Exception { JListUtil.newInstance(srcList).defaultJListKeyPressed(evt); } }); swingUtil.addAction("outPutList.mouseClicked", new Action() { public void action(EventObject evt) throws Exception { if (!JListUtil.newInstance(outPutList).isCorrectMouseClick(evt)) { return; } } }); swingUtil.addAction("outPutList.keyPressed", new Action() { public void action(EventObject evt) throws Exception { JListUtil.newInstance(outPutList).defaultJListKeyPressed(evt); } }); swingUtil.addAction("outPutDir.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { File dir = JFileChooserUtil.newInstance().selectDirectoryOnly().showOpenDialog() .getApproveSelectedFile(); if (dir == null) { outputDir = DEFAULT_OUTPUT_DIR; } else { outputDir = dir; } reflushOutputList(); } }); swingUtil.addAction("srcBaseDir.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { File dir = JFileChooserUtil.newInstance().selectDirectoryOnly().showOpenDialog() .getApproveSelectedFile(); Validate.notNull(dir, "src base directory is not correct!"); manualBaseDir = dir; } }); swingUtil.addAction("execute.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { DefaultListModel model = (DefaultListModel) outPutList.getModel(); for (int ii = 0; ii < model.size(); ii++) { OutputFile file = (OutputFile) model.getElementAt(ii); if (!file.destFile.getParentFile().exists()) { file.destFile.getParentFile().mkdirs(); } FileUtil.copyFile(file.srcFile, file.destFile); } JOptionPaneUtil.newInstance().iconInformationMessage() .showMessageDialog("copy success!!\nsize = " + model.getSize(), getTitle()); } }); } catch (Exception e) { e.printStackTrace(); } }
From source file:org.jfree.chart.demo.SuperDemo.java
private JComponent createContent() { JPanel jpanel = new JPanel(new BorderLayout()); JTabbedPane jtabbedpane = new JTabbedPane(); JPanel jpanel1 = new JPanel(new BorderLayout()); jpanel1.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); JSplitPane jsplitpane = new JSplitPane(1); JTree jtree = new JTree(createTreeModel()); jtree.addTreeSelectionListener(this); JScrollPane jscrollpane = new JScrollPane(jtree); jscrollpane.setPreferredSize(new Dimension(300, 100)); jsplitpane.setLeftComponent(jscrollpane); jsplitpane.setRightComponent(createChartDisplayPanel()); jpanel1.add(jsplitpane);// w ww. j a v a2 s.co m jtabbedpane.add("Demos", jpanel1); MemoryUsageDemo memoryusagedemo = new MemoryUsageDemo(0x493e0); (memoryusagedemo.new DataGenerator(1000)).start();//memoryusagedemo, jtabbedpane.add("Memory Usage", memoryusagedemo); jtabbedpane.add("Source Code", createSourceCodePanel()); jtabbedpane.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); jpanel.add(jtabbedpane); return jpanel; }
From source file:gui.QTLResultsPanel.java
/** QTLResultsPanel(). * /*from w ww . j a v a2 s. co m*/ * @param qtlResult = the QTL results to show. * @param order = the ordered result data this QTL was created from. */ public QTLResultsPanel(QTLResult qtlResult, OrderedResult order) { this.qtlResult = qtlResult; this.order = order; // Trait listbox traitModel = new DefaultListModel<Trait>(); for (Trait trait : qtlResult.getTraits()) { traitModel.addElement(trait); } traitList = new JList<Trait>(traitModel); traitList.addListSelectionListener(this); traitList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane sp1 = new JScrollPane(traitList); sp1.setPreferredSize(new Dimension(125, 50)); // Details text box details = new JTextArea(); details.setFont(new Font("Monospaced", Font.PLAIN, 11)); details.setMargin(new Insets(2, 5, 2, 5)); details.setEditable(false); details.setTabSize(6); JScrollPane sp4; if (AppFrame.tpmmode == AppFrame.TPMMODE_QTL) { simpleDetails = new JScrollPane(); simpleDetails.setFont(new Font("Monospaced", Font.PLAIN, 11)); simplesplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); simpleright = new JTextArea(); simpleright.setFont(new Font("Monospaced", Font.PLAIN, 11)); simpleright.setMargin(new Insets(2, 5, 2, 5)); simpleright.setEditable(false); simpleright.setTabSize(6); simplesplit.setRightComponent(new JScrollPane(simpleright)); simplesplit.setLeftComponent(simpleDetails); sp4 = new JScrollPane(simplesplit); } else { // TPM MODE NONSNP simpleright = new JTextArea(); simpleright.setFont(new Font("Monospaced", Font.PLAIN, 11)); simpleright.setMargin(new Insets(2, 5, 2, 5)); simpleright.setEditable(false); sp4 = new JScrollPane(simpleright); } lodDetails = new JTextArea(); lodDetails.setFont(new Font("Monospaced", Font.PLAIN, 11)); lodDetails.setMargin(new Insets(2, 5, 2, 5)); lodDetails.setEditable(false); lodDetails.setTabSize(6); JScrollPane sp3 = new JScrollPane(lodDetails); JTabbedPane tabs = new JTabbedPane(); JScrollPane sp2 = new JScrollPane(details); tabs.add(sp2, "Full Model"); tabs.add(sp4, "Simple Model"); tabs.add(sp3, "LOD Details"); // The splitpane splits = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splits.setTopComponent(new JPanel()); splits.setBottomComponent(tabs); splits.setResizeWeight(0.5); // pane2 JSplitPane splits2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); splits2.setLeftComponent(sp1); splits2.setRightComponent(splits); setLayout(new BorderLayout()); add(new GradientPanel("QTL Analysis Results"), BorderLayout.NORTH); // add(sp1, BorderLayout.WEST); // add(splits); add(splits2); add(toolbar = new QTLResultsToolBar(this), BorderLayout.EAST); }
From source file:com.net2plan.gui.utils.onlineSimulationPane.OnlineSimulationPane.java
public OnlineSimulationPane(IVisualizationCallback mainWindow) { super();//from w w w. j a v a 2 s . c o m this.mainWindow = mainWindow; simKernel = new SimKernel(); simKernel.setGUIListener(this); File ALGORITHMS_DIRECTORY = new File( IGUIModule.CURRENT_DIR + SystemUtils.getDirectorySeparator() + "workspace"); ALGORITHMS_DIRECTORY = ALGORITHMS_DIRECTORY.isDirectory() ? ALGORITHMS_DIRECTORY : IGUIModule.CURRENT_DIR; eventGeneratorPanel = new RunnableSelector(SimKernel.getEventGeneratorLabel(), "File", simKernel.getEventGeneratorClass(), ALGORITHMS_DIRECTORY, new ParameterValueDescriptionPanel()); eventProcessorPanel = new RunnableSelector(SimKernel.getEventProcessorLabel(), "File", simKernel.getEventProcessorClass(), ALGORITHMS_DIRECTORY, new ParameterValueDescriptionPanel()); simulationConfigurationPanel = new ParameterValueDescriptionPanel(); simulationConfigurationPanel.setParameters(simKernel.getSimulationParameters()); JTabbedPane configPane = new JTabbedPane(); configPane.addTab(SimKernel.getEventGeneratorLabel(), eventGeneratorPanel); configPane.addTab(SimKernel.getEventProcessorLabel(), eventProcessorPanel); JPanel topPane = new JPanel(new MigLayout("insets 0 0 0 0", "[][grow][]", "[][grow]")); topPane.add(new JLabel("Simulation parameters"), "spanx 3, wrap"); topPane.add(simulationConfigurationPanel, "spanx 3, grow, wrap"); splitPaneConfiguration = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitPaneConfiguration.setTopComponent(topPane); splitPaneConfiguration.setBottomComponent(configPane); splitPaneConfiguration.setResizeWeight(0.5); splitPaneConfiguration.addPropertyChangeListener(new ProportionalResizeJSplitPaneListener()); splitPaneConfiguration .setBorder(BorderFactory.createTitledBorder(new LineBorder(Color.BLACK), "Simulation execution")); JPanel pan_execution = new JPanel(new MigLayout("fill, insets 0 0 0 0")); pan_execution.add(splitPaneConfiguration, "grow"); btn_updateReport = new JButton("Update"); btn_updateReport.setToolTipText("Update the simulation report"); btn_updateReport.addActionListener(this); simReport = new JPanel(); simReport.setLayout(new BorderLayout()); simReport.add(btn_updateReport, BorderLayout.NORTH); addTab("Simulation input parameters", pan_execution); simulationControlPanel = configureSimulationControlPanel(); addTab("Simulation control", simulationControlPanel); addTab("Simulation report", simReport); simReportTab = 2; simKernel.reset(); if (mainWindow.getDesign() != null) simKernel.setNetPlan(mainWindow.getDesign()); }
From source file:analysis.postRun.PostRunWindow.java
/** * Constructor - creates window and tabs. *//* ww w.j av a 2s.co m*/ private PostRunWindow() { dcLegend = false; stats = false; readStats = false; save = false; // Create frame MainFrame = new JFrame("Cloudsim Post-Run Analysis"); MainFrame.setSize(1150, 768); MainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); //MainFrame.addComponentListener(this); // Create panel MainPanel = new JPanel(); MainPanel.setLayout(new BorderLayout()); MainFrame.add(MainPanel, BorderLayout.CENTER); // Create button panel ButtonPanel = new JPanel(); ButtonPanel.setLayout(new BorderLayout()); MainFrame.add(ButtonPanel, BorderLayout.NORTH); // Create "change log" button JButton fileButton = new JButton("Change log"); fileButton.addActionListener(this); ButtonPanel.add(fileButton, BorderLayout.WEST); // Create "Compare multiple logs" button JButton compButton = new JButton("Compare multiple logs"); compButton.addActionListener(this); ButtonPanel.add(compButton, BorderLayout.CENTER); // Create "Save Charts" button JButton saveButton = new JButton("Save Charts"); saveButton.addActionListener(this); ButtonPanel.add(saveButton, BorderLayout.EAST); // Find out which log file to look at & load the data failureSet = new DefaultXYDataset(); cpuSet = new DefaultXYDataset(); servSet = new DefaultXYDataset(); costSet = new DefaultXYDataset(); chooseFile1(); //getFileName(); getData(currFile); // Create tabs tabbedPane = new JTabbedPane(); failureTab(true); cpuTab(true); servTab(true); costTab(true); consistencyTab(true); tabbedPane.setSelectedIndex(0); // Add + show window MainPanel.add(tabbedPane, BorderLayout.CENTER); MainFrame.add(MainPanel, BorderLayout.CENTER); MainFrame.add(ButtonPanel, BorderLayout.NORTH); MainFrame.setLocationByPlatform(true); MainFrame.setVisible(true); }