List of usage examples for javax.swing JTabbedPane JTabbedPane
public JTabbedPane()
TabbedPane
with a default tab placement of JTabbedPane.TOP
. From source file:org.jfree.graphics2d.demo.SwingUIToSVGDemo.java
private JComponent createContent() { JPanel content = new JPanel(new BorderLayout()); JTabbedPane tabs = new JTabbedPane(); tabs.add("Tab 1", new JButton("First Tab")); tabs.add("Tab 2", new JButton("Second Tab")); JButton button = new JButton("Save to SVG"); button.addActionListener(this); content.add(tabs);/*from w w w.ja v a 2s .c o m*/ content.add(button, BorderLayout.SOUTH); return content; }
From source file:layout.BoxAlignmentDemo.java
public BoxAlignmentDemo() { super(new BorderLayout()); JTabbedPane tabbedPane = new JTabbedPane(); JPanel buttonRow = new JPanel(); //Use default FlowLayout. buttonRow.add(createButtonRow(false)); buttonRow.add(createButtonRow(true)); tabbedPane.addTab("Altering alignments", buttonRow); JPanel labelAndComponent = new JPanel(); //Use default FlowLayout. labelAndComponent.add(createLabelAndComponent(false)); labelAndComponent.add(createLabelAndComponent(true)); tabbedPane.addTab("X alignment mismatch", labelAndComponent); JPanel buttonAndComponent = new JPanel(); //Use default FlowLayout. buttonAndComponent.add(createYAlignmentExample(false)); buttonAndComponent.add(createYAlignmentExample(true)); tabbedPane.addTab("Y alignment mismatch", buttonAndComponent); //Add tabbedPane to this panel. add(tabbedPane, BorderLayout.CENTER); }
From source file:org.jfree.chart.demo.JFreeChartAppletDemo.java
/** * Constructs the demo applet.//from ww w .j a v a 2 s . com */ public JFreeChartAppletDemo() { final JTabbedPane tabs = new JTabbedPane(); final XYDataset data1 = DemoDatasetFactory.createTimeSeriesCollection1(); final JFreeChart chart1 = ChartFactory.createTimeSeriesChart("Time Series", "Date", "Rate", data1, true, true, false); final ChartPanel panel1 = new ChartPanel(chart1, 400, 300, 200, 100, 400, 200, true, false, false, false, true, true); tabs.add("Chart 1", panel1); final CategoryDataset data2 = DemoDatasetFactory.createCategoryDataset(); final JFreeChart chart2 = ChartFactory.createBarChart("Bar Chart", "Categories", "Value", data2, PlotOrientation.HORIZONTAL, true, true, false); final ChartPanel panel2 = new ChartPanel(chart2, 400, 300, 200, 100, 400, 200, true, false, false, false, true, true); tabs.add("Chart 2", panel2); getContentPane().add(tabs); }
From source file:components.TabbedPaneDemo.java
public TabbedPaneDemo() { super(new GridLayout(1, 1)); JTabbedPane tabbedPane = new JTabbedPane(); ImageIcon icon = createImageIcon("images/middle.gif"); JComponent panel1 = makeTextPanel("Panel #1"); tabbedPane.addTab("Tab 1", icon, panel1, "Does nothing"); tabbedPane.setMnemonicAt(0, KeyEvent.VK_1); JComponent panel2 = makeTextPanel("Panel #2"); tabbedPane.addTab("Tab 2", icon, panel2, "Does twice as much nothing"); tabbedPane.setMnemonicAt(1, KeyEvent.VK_2); JComponent panel3 = makeTextPanel("Panel #3"); tabbedPane.addTab("Tab 3", icon, panel3, "Still does nothing"); tabbedPane.setMnemonicAt(2, KeyEvent.VK_3); JComponent panel4 = makeTextPanel("Panel #4 (has a preferred size of 410 x 50)."); panel4.setPreferredSize(new Dimension(410, 50)); tabbedPane.addTab("Tab 4", icon, panel4, "Does nothing at all"); tabbedPane.setMnemonicAt(3, KeyEvent.VK_4); //Add the tabbed pane to this panel. add(tabbedPane);/* w w w .jav a 2 s .c om*/ //The following line enables to use scrolling tabs. tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); }
From source file:altosui.AltosGraphUI.java
AltosGraphUI(AltosStateIterable states, File file) throws InterruptedException, IOException { super(file.getName()); state = null;/* w w w. j a v a 2 s. c om*/ pane = new JTabbedPane(); enable = new AltosUIEnable(); stats = new AltosFlightStats(states); graphDataSet = new AltosGraphDataSet(states); graph = new AltosGraph(enable, stats, graphDataSet); statsTable = new AltosFlightStatsTable(stats); pane.add("Flight Graph", graph.panel); pane.add("Configure Graph", enable); pane.add("Flight Statistics", statsTable); has_gps = false; fill_map(states); if (has_gps) pane.add("Map", map); setContentPane(pane); AltosUIPreferences.register_font_listener(this); AltosPreferences.register_units_listener(this); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { setVisible(false); dispose(); AltosUIPreferences.unregister_font_listener(AltosGraphUI.this); AltosPreferences.unregister_units_listener(AltosGraphUI.this); } }); pack(); setVisible(true); if (state != null && has_gps) map.centre(state); }
From source file:gtu._work.ui._DefaultJFrameUI.java
private void initGUI() { try {//www .ja va2 s . c om BorderLayout thisLayout = new BorderLayout(); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); getContentPane().setLayout(thisLayout); { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); { jPanel1 = new JPanel(); jTabbedPane1.addTab("jPanel1", null, jPanel1, null); { srcPathText = new JTextField(); JCommonUtil.jTextFieldSetFilePathMouseEvent(srcPathText, true); jPanel1.add(srcPathText); srcPathText.setPreferredSize(new java.awt.Dimension(291, 24)); } { executeBtn = new JButton(); jPanel1.add(executeBtn); executeBtn.setText("\u57f7\u884c"); executeBtn.setPreferredSize(new java.awt.Dimension(66, 39)); executeBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { executeBtnActionPerformed(evt); } }); } } { jPanel2 = new JPanel(); BorderLayout jPanel2Layout = new BorderLayout(); jPanel2.setLayout(jPanel2Layout); jTabbedPane1.addTab("jPanel2", null, jPanel2, null); { jScrollPane1 = new JScrollPane(); jPanel2.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.setPreferredSize(new java.awt.Dimension(533, 334)); { logArea = new JTextArea(); jScrollPane1.setViewportView(logArea); logArea.setText(""); } } } } pack(); this.setSize(554, 401); } catch (Exception e) { //add your error handling code here e.printStackTrace(); } }
From source file:BoxAlignmentDemo.java
public BoxAlignmentDemo() { super(new BorderLayout()); JTabbedPane tabbedPane = new JTabbedPane(); JPanel buttonRow = new JPanel(); // Use default FlowLayout. buttonRow.add(createButtonRow(false)); buttonRow.add(createButtonRow(true)); tabbedPane.addTab("Altering alignments", buttonRow); JPanel labelAndComponent = new JPanel(); // Use default FlowLayout. labelAndComponent.add(createLabelAndComponent(false)); labelAndComponent.add(createLabelAndComponent(true)); tabbedPane.addTab("X alignment mismatch", labelAndComponent); JPanel buttonAndComponent = new JPanel(); // Use default FlowLayout. buttonAndComponent.add(createYAlignmentExample(false)); buttonAndComponent.add(createYAlignmentExample(true)); tabbedPane.addTab("Y alignment mismatch", buttonAndComponent); // Add tabbedPane to this panel. add(tabbedPane, BorderLayout.CENTER); }
From source file:gtu._work.ui.QuartzCronTestUI.java
private void initGUI() { try {/*from ww w . java 2s . co m*/ BorderLayout thisLayout = new BorderLayout(); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); getContentPane().setLayout(thisLayout); { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); { jPanel1 = new JPanel(); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); jTabbedPane1.addTab("CronExpression", null, jPanel1, null); { jPanel2 = new JPanel(); jPanel1.add(jPanel2, BorderLayout.NORTH); jPanel2.setPreferredSize(new java.awt.Dimension(439, 34)); { cronText = new JTextField(); jPanel2.add(cronText); cronText.setText(""); cronText.setPreferredSize(new java.awt.Dimension(229, 27)); } { executeBtn = new JButton(); jPanel2.add(executeBtn); executeBtn.setText("execute"); executeBtn.setPreferredSize(new java.awt.Dimension(85, 28)); executeBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { //XXX try { CronExpression cexp = new CronExpression(cronText.getText()); Date current = new Date(); setTitle(DateFormatUtils.format(current, "yyyy/MM/dd HH:mm:ss")); DefaultListModel cronListModel = new DefaultListModel(); for (int ii = 0, total = Integer .parseInt(limitText.getText()); ii < total; ii++) { current = cexp.getNextValidTimeAfter(current); if (current == null) { break; } cronListModel.addElement(ii + " : " + DateFormatUtils.format(current, "yyyy/MM/dd HH:mm:ss")); } cronList.setModel(cronListModel); } catch (Exception e) { e.printStackTrace(); JCommonUtil.handleException(e); return; } } }); } { limitText = new JTextField(); jPanel2.add(limitText); limitText.setText("2000"); limitText.setPreferredSize(new java.awt.Dimension(61, 24)); } } { jScrollPane1 = new JScrollPane(); jPanel1.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.setPreferredSize(new java.awt.Dimension(439, 253)); { DefaultListModel cronListModel = new DefaultListModel(); cronList = new JList(); jScrollPane1.setViewportView(cronList); cronList.setModel(cronListModel); } } } } pack(); this.setSize(460, 354); } catch (Exception e) { //add your error handling code here e.printStackTrace(); } }
From source file:gtu._work.ui.ObnfCheckPDFErrorUI.java
private void initGUI() { try {//www . j a va 2 s .c om JCommonUtil.frameCloseConfirm(this); BorderLayout thisLayout = new BorderLayout(); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); getContentPane().setLayout(thisLayout); { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); { jPanel2 = new JPanel(); BorderLayout jPanel2Layout = new BorderLayout(); jPanel2.setLayout(jPanel2Layout); jTabbedPane1.addTab("log", null, jPanel2, null); { jScrollPane2 = new JScrollPane(); jPanel2.add(jScrollPane2, BorderLayout.CENTER); { logArea = new JTextArea(); jScrollPane2.setViewportView(logArea); } } { checkBtn = new JButton(); jPanel2.add(checkBtn, BorderLayout.SOUTH); checkBtn.setText("\u6aa2\u67e5"); checkBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { checkBtnActionPerformed(); } }); } } } pack(); this.setSize(542, 394); } catch (Exception e) { //add your error handling code here e.printStackTrace(); } }
From source file:lu.lippmann.cdb.datasetview.tabs.TimeSeriesTabView.java
/** * Constructor./*from w ww. j a v a2 s .co m*/ */ public TimeSeriesTabView(final boolean withOneGraphOneAxis, final boolean withMultipleGraphs, final boolean withClustering, final boolean withSimilarity, final boolean withCalendar) { this.jxp = new JXPanel(); this.jxp.setLayout(new BorderLayout()); this.tabPannel = new JTabbedPane(); if (withOneGraphOneAxis) { this.oneGraphOneAxisPanel = new JXPanel(); this.oneGraphOneAxisPanel.setLayout(new BorderLayout()); this.tabPannel.addTab("One graph & one axis", this.oneGraphOneAxisPanel); } else this.oneGraphOneAxisPanel = null; //this.tabPannel.addTab("One graph & multiple axis",this.oneGraphMultipleAxisPanel); if (withMultipleGraphs) { this.multipleGraphsPanel = new JXPanel(); this.multipleGraphsPanel.setLayout(new BorderLayout()); this.tabPannel.addTab("Multiple graphs", this.multipleGraphsPanel); } else this.multipleGraphsPanel = null; if (withClustering) { this.clusteringPanel = new TimeSeriesClusteringPanel(this); this.tabPannel.addTab("Clustering", clusteringPanel.getComponent()); } else this.clusteringPanel = null; if (withSimilarity) { this.similarityPanel = new TimeSeriesSimilarityPanel(TimeSeriesSimilarityPanel.Mode.MDS, false); this.tabPannel.addTab("Similarity", similarityPanel.getComponent()); } else this.similarityPanel = null; if (withCalendar) { this.calendarPanel = new TimeSeriesCalendarPanel(); this.tabPannel.addTab("Calendar", calendarPanel.getComponent()); } else this.calendarPanel = null; this.jxp.add(this.tabPannel, BorderLayout.CENTER); }