List of usage examples for javax.swing JTabbedPane JTabbedPane
public JTabbedPane()
TabbedPane
with a default tab placement of JTabbedPane.TOP
. From source file:TabPanelwithImageIconCustom.java
public TabPanelwithImageIconCustom() { setSize(450, 350);//from www . j a v a 2 s . c o m this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); getContentPane().add(textfield, BorderLayout.SOUTH); JMenuBar mbar = new JMenuBar(); JMenu menu = new JMenu("File"); menu.add(new JCheckBoxMenuItem("Check Me")); menu.addSeparator(); JMenuItem item = new JMenuItem("Exit"); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); menu.add(item); mbar.add(menu); setJMenuBar(mbar); JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.addTab("Button", new TabIcon(), new JButton(""), "Click here for Button demo"); }
From source file:com.sigma.applet.GraphsApplet.java
public void init() { final JTabbedPane tabs = new JTabbedPane(); XYDataset data1 = createTimeSeriesCollection1(1.1); JFreeChart chart1 = ChartFactory.createTimeSeriesChart("Time Series", "Date", "Rate", data1, true, true, false);/*from w w w. j a v a 2 s. c om*/ ChartPanel panel1 = new ChartPanel(chart1, 400, 300, 200, 100, 400, 200, true, false, false, false, true, true); tabs.add("Chart 1", panel1); XYDataset data2 = createTimeSeriesCollection1(0.8); JFreeChart chart2 = ChartFactory.createTimeSeriesChart("Time Series", "Date", "Rate", data2, true, true, false); ChartPanel panel2 = new ChartPanel(chart2, 400, 300, 200, 100, 400, 200, true, false, false, false, true, true); tabs.add("Chart 2", panel2); this.getContentPane().add(tabs); }
From source file:compecon.dashboard.panel.AgentsPanel.java
public AgentsPanel() { this.setLayout(new BorderLayout()); JTabbedPane jTabbedPane = new JTabbedPane(); for (Currency currency : Currency.values()) { JPanel panelForCurrency = new JPanel(); panelForCurrency.setLayout(new GridLayout(0, 2)); jTabbedPane.addTab(currency.getIso4217Code(), panelForCurrency); panelForCurrency.setBackground(Color.lightGray); for (Class<? extends Agent> agentType : ApplicationContext.getInstance().getAgentFactory() .getAgentTypes()) {/*from w w w . j a va2s .c o m*/ panelForCurrency.add(createAgentNumberPanel(currency, agentType)); } } add(jTabbedPane, BorderLayout.CENTER); }
From source file:com.k42b3.zubat.TrafficDetail.java
public TrafficDetail() { this.setTitle("zubat (version: " + Zubat.version + ")"); this.setLocation(100, 100); this.setSize(600, 400); this.setMinimumSize(this.getSize()); this.setLayout(new BorderLayout()); tabPane = new JTabbedPane(); txtRequest = new JTextArea(); txtResponse = new JTextArea(); tabPane.addTab("Request", new JScrollPane(txtRequest)); tabPane.addTab("Response", new JScrollPane(txtResponse)); this.add(tabPane, BorderLayout.CENTER); this.setVisible(true); }
From source file:org.altusmetrum.telegps.TeleGPSGraphUI.java
TeleGPSGraphUI(AltosStateIterable states, File file) throws InterruptedException, IOException { super(file.getName()); state = null;//from w w w . jav a2s. c o m pane = new JTabbedPane(); enable = new AltosUIEnable(); stats = new AltosFlightStats(states); graphDataSet = new AltosGraphDataSet(states); graph = new AltosGraph(enable, stats, graphDataSet); statsTable = new AltosFlightStatsTable(stats); map = new AltosUIMap(); pane.add("Graph", graph.panel); pane.add("Configure Graph", enable); pane.add("Statistics", statsTable); fill_map(states); pane.add("Map", map); setContentPane(pane); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { close(); } }); pack(); setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); TeleGPS.add_window(); setVisible(true); if (state != null) map.centre(state); }
From source file:layout.TabDemo.java
public void addComponentToPane(Container pane) { JTabbedPane tabbedPane = new JTabbedPane(); //Create the "cards". JPanel card1 = new JPanel() { //Make the panel wider than it really needs, so //the window's wide enough for the tabs to stay //in one row. public Dimension getPreferredSize() { Dimension size = super.getPreferredSize(); size.width += extraWindowWidth; return size; }// w ww . j a va2 s .c o m }; card1.add(new JButton("Button 1")); card1.add(new JButton("Button 2")); card1.add(new JButton("Button 3")); JPanel card2 = new JPanel(); card2.add(new JTextField("TextField", 20)); tabbedPane.addTab(BUTTONPANEL, card1); tabbedPane.addTab(TEXTPANEL, card2); pane.add(tabbedPane, BorderLayout.CENTER); }
From source file:com.codecrate.shard.ui.view.CharacterManagerView.java
private static JTabbedPane getTabbedPane() { if (null == tabbedPane) { tabbedPane = new JTabbedPane(); }/*from w ww .j a v a 2s . c o m*/ return tabbedPane; }
From source file:SwingDnDTest.java
public SwingDnDFrame() { setTitle("SwingDnDTest"); JTabbedPane tabbedPane = new JTabbedPane(); JList list = SampleComponents.list(); tabbedPane.addTab("List", list); JTable table = SampleComponents.table(); tabbedPane.addTab("Table", table); JTree tree = SampleComponents.tree(); tabbedPane.addTab("Tree", tree); JFileChooser fileChooser = new JFileChooser(); tabbedPane.addTab("File Chooser", fileChooser); JColorChooser colorChooser = new JColorChooser(); tabbedPane.addTab("Color Chooser", colorChooser); final JTextArea textArea = new JTextArea(4, 40); JScrollPane scrollPane = new JScrollPane(textArea); scrollPane.setBorder(new TitledBorder(new EtchedBorder(), "Drag text here")); JTextField textField = new JTextField("Drag color here"); textField.setTransferHandler(new TransferHandler("background")); tabbedPane.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { textArea.setText(""); }/* w w w . j ava 2 s . c om*/ }); tree.setDragEnabled(true); table.setDragEnabled(true); list.setDragEnabled(true); fileChooser.setDragEnabled(true); colorChooser.setDragEnabled(true); textField.setDragEnabled(true); add(tabbedPane, BorderLayout.NORTH); add(scrollPane, BorderLayout.CENTER); add(textField, BorderLayout.SOUTH); pack(); }
From source file:gtu._work.ui.ObnfJetDeleteUI.java
private void initGUI() { try {/* ww w .ja v a 2 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); { jLabel1 = new JLabel(); jPanel1.add(jLabel1); jLabel1.setText("\u8acb\u586b\u5165\u76ee\u9304"); } { srcDirText = new JTextField(); JCommonUtil.jTextFieldSetFilePathMouseEvent(srcDirText, true); jPanel1.add(srcDirText); srcDirText.setPreferredSize(new java.awt.Dimension(288, 22)); } { executeBtn = new JButton(); jPanel1.add(executeBtn); executeBtn.setText("\u57f7\u884c"); executeBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { executeBtnPerformed(); } }); } { excludeArea = new JTextArea(); jPanel1.add(excludeArea); excludeArea.setPreferredSize(new java.awt.Dimension(418, 238)); } } } pack(); this.setSize(511, 339); } catch (Exception e) { //add your error handling code here e.printStackTrace(); } }
From source file:TabbedPaneTest.java
public TabbedPaneFrame() { setTitle("TabbedPaneTest"); setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); tabbedPane = new JTabbedPane(); // we set the components to null and delay their loading until the tab is shown // for the first time ImageIcon icon = new ImageIcon("yellow-ball.gif"); tabbedPane.addTab("Mercury", icon, null); tabbedPane.addTab("Venus", icon, null); tabbedPane.addTab("Earth", icon, null); tabbedPane.addTab("Mars", icon, null); tabbedPane.addTab("Jupiter", icon, null); tabbedPane.addTab("Saturn", icon, null); tabbedPane.addTab("Uranus", icon, null); tabbedPane.addTab("Neptune", icon, null); tabbedPane.addTab("Pluto", null, null); final int plutoIndex = tabbedPane.indexOfTab("Pluto"); JPanel plutoPanel = new JPanel(); plutoPanel.add(new JLabel("Pluto", icon, SwingConstants.LEADING)); JToggleButton plutoCheckBox = new JCheckBox(); plutoCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { tabbedPane.remove(plutoIndex); }/*from w w w . j a va 2 s .c om*/ }); plutoPanel.add(plutoCheckBox); tabbedPane.setTabComponentAt(plutoIndex, plutoPanel); add(tabbedPane, "Center"); tabbedPane.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent event) { // check if this tab still has a null component if (tabbedPane.getSelectedComponent() == null) { // set the component to the image icon int n = tabbedPane.getSelectedIndex(); loadTab(n); } } }); loadTab(0); JPanel buttonPanel = new JPanel(); ButtonGroup buttonGroup = new ButtonGroup(); JRadioButton wrapButton = new JRadioButton("Wrap tabs"); wrapButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { tabbedPane.setTabLayoutPolicy(JTabbedPane.WRAP_TAB_LAYOUT); } }); buttonPanel.add(wrapButton); buttonGroup.add(wrapButton); wrapButton.setSelected(true); JRadioButton scrollButton = new JRadioButton("Scroll tabs"); scrollButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); } }); buttonPanel.add(scrollButton); buttonGroup.add(scrollButton); add(buttonPanel, BorderLayout.SOUTH); }