List of usage examples for javax.swing JTabbedPane setTabLayoutPolicy
@BeanProperty(preferred = true, visualUpdate = true, enumerationValues = { "JTabbedPane.WRAP_TAB_LAYOUT", "JTabbedPane.SCROLL_TAB_LAYOUT" }, description = "The tabbedpane's policy for laying out the tabs") public void setTabLayoutPolicy(int tabLayoutPolicy)
From source file:TabSampleTabLayoutPolicy.java
public static void main(String args[]) { JFrame frame = new JFrame("Tabbed Pane Sample"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); String titles[] = { "General", "Security", "Content", "Connection", "Programs", "Advanced" }; for (int i = 0, n = titles.length; i < n; i++) { add(tabbedPane, titles[i]);/*from ww w . j a v a 2 s. c om*/ } frame.add(tabbedPane, BorderLayout.CENTER); frame.setSize(400, 150); frame.setVisible(true); }
From source file:TabSample.java
public static void main(String args[]) { JFrame frame = new JFrame("Tabbed Pane Sample"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); String titles[] = { "A", "B", "C", "D", "E", "F" }; for (int i = 0, n = titles.length; i < n; i++) { add(tabbedPane, titles[i]);//from ww w .ja v a2s . c o m } frame.add(tabbedPane, BorderLayout.CENTER); frame.setSize(400, 150); frame.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JFrame frame = new JFrame("Tabbed Pane Sample"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); String titles[] = { "General", "Security", "Content", "Connection", "Programs", "Advanced" }; int mnemonic[] = { KeyEvent.VK_G, KeyEvent.VK_S, KeyEvent.VK_C, KeyEvent.VK_O, KeyEvent.VK_P, KeyEvent.VK_A };//w ww.j a v a 2 s.co m for (int i = 0, n = titles.length; i < n; i++) { add(tabbedPane, titles[i], mnemonic[i]); } tabbedPane.removeAll(); frame.add(tabbedPane, BorderLayout.CENTER); frame.setSize(400, 150); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false);//from w w w . ja v a 2 s . co m JTabbedPane tabs = new JTabbedPane(); tabs.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); for (int i = 0; i < 5; i++) { tabs.addTab("Tab" + i, new TabPanel()); } frame.add(tabs); frame.pack(); frame.setVisible(true); }
From source file:MainClass.java
public static void main(String args[]) throws Exception { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); String titles[] = { "A", "B", "C", "D", "E", "F" }; int mnemonic[] = { KeyEvent.VK_A, KeyEvent.VK_B, KeyEvent.VK_C, KeyEvent.VK_D, KeyEvent.VK_E, KeyEvent.VK_F };//from ww w . ja v a 2 s .com for (int i = 0, n = titles.length; i < n; i++) { add(tabbedPane, titles[i], mnemonic[i]); } ChangeListener changeListener = new ChangeListener() { public void stateChanged(ChangeEvent changeEvent) { JTabbedPane sourceTabbedPane = (JTabbedPane) changeEvent.getSource(); int index = sourceTabbedPane.getSelectedIndex(); System.out.println("Tab changed to: " + sourceTabbedPane.getTitleAt(index)); } }; tabbedPane.addChangeListener(changeListener); frame.add(tabbedPane, BorderLayout.CENTER); frame.setSize(400, 150); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JTabbedPane pane = new JTabbedPane(); int rows = pane.getTabRunCount(); int policy = pane.getTabLayoutPolicy(); // WRAP_TAB_LAYOUT pane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); }
From source file:TooManyTabs.java
public TooManyTabs() { super("Too Many Tabs Test"); setSize(200, 200);//from ww w. j av a 2 s . c o m setDefaultCloseOperation(EXIT_ON_CLOSE); Container contents = getContentPane(); JTabbedPane wrap = new JTabbedPane(); JTabbedPane scroll = new JTabbedPane(); scroll.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); for (int i = 1; i < 24; i++) { String tab = "Tab #" + i; wrap.addTab(tab, new JLabel(tab)); scroll.addTab(tab, new JLabel(tab)); } JTabbedPane top = new JTabbedPane(JTabbedPane.RIGHT); top.addTab("Wrap Tabs", wrap); top.addTab("Scroll Tabs", scroll); contents.add(top); setVisible(true); }
From source file:com.eviware.soapui.impl.wsdl.panels.teststeps.WsdlTestRequestDesktopPanel.java
private Component buildLogPanel() { JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.RIGHT); tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); logArea = new JTextArea(); logArea.setEditable(false);/*from www . j a va 2 s .c o m*/ logArea.setToolTipText("Request Log"); JPanel panel = new JPanel(new BorderLayout()); panel.add(new JScrollPane(logArea), BorderLayout.CENTER); tabbedPane.addTab("Assertions", buildAssertionsPanel()); tabbedPane.addTab("Request Log", panel); return UISupport.createTabPanel(tabbedPane, true); }
From source file:au.org.ala.delta.editor.ui.ItemEditor.java
/** * Creates the user interface components of this dialog. *///from ww w .jav a 2 s .co m private void createUI() { JPanel content = new JPanel(); JLabel lblTaxonNumber = new JLabel("Taxon Number:"); lblTaxonNumber.setName("taxonNumberLabel"); spinner = new JSpinner(); spinner.setModel(new SpinnerNumberModel(1, 1, 1, 1)); btnSelect = new JToggleButton("Select"); btnSelect.setName("selectTaxonNumberButton"); lblEditTaxonName = new JLabel(editTaxonLabelText); rtfEditor = new RtfEditor(); editorScroller = new JScrollPane(rtfEditor); chckbxTreatAsVariant = new JCheckBox("Treat as Variant"); chckbxTreatAsVariant.setName("treatAsVariantCheckbox"); JPanel panel = new JPanel(); btnDone = new JButton("Done"); btnDone.setName("doneEditingTaxonButton"); taxonSelectionList = new ItemList(); GroupLayout groupLayout = new GroupLayout(content); groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout .createSequentialGroup().addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout .createSequentialGroup() .addGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false) .addComponent(spinner).addComponent(lblTaxonNumber, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(18).addComponent(btnSelect)) .addComponent(chckbxTreatAsVariant)) .addGap(23) .addGroup(groupLayout.createParallelGroup(Alignment.LEADING).addComponent(lblEditTaxonName) .addComponent(editorScroller, GroupLayout.DEFAULT_SIZE, 703, Short.MAX_VALUE))) .addGroup(groupLayout.createSequentialGroup() .addGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addGap(0, 759, Short.MAX_VALUE).addComponent(btnDone).addGap(5)) .addComponent(panel, GroupLayout.DEFAULT_SIZE, 850, Short.MAX_VALUE)) .addGap(1))) .addGap(19))); groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout .createSequentialGroup().addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE).addComponent(lblTaxonNumber) .addComponent(lblEditTaxonName)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) .addComponent(spinner, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(btnSelect)) .addPreferredGap(ComponentPlacement.RELATED, 90, Short.MAX_VALUE) .addComponent(chckbxTreatAsVariant)) .addComponent(editorScroller, GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE)) .addGap(18).addComponent(panel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE).addComponent(btnDone)).addGap(17))); panel.setLayout(new BorderLayout(0, 0)); JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); imageDetails = new ImageDetailsPanel(); imageDetails.setEnabled(false); tabbedPane.addTab("Images", imageDetails); panel.add(tabbedPane); content.setLayout(groupLayout); setPreferredSize(new Dimension(827, 500)); setMinimumSize(new Dimension(748, 444)); RtfToolBar toolbar = new RtfToolBar(this); toolbar.addEditor(rtfEditor); getContentPane().add(toolbar, BorderLayout.NORTH); getContentPane().add(content, BorderLayout.CENTER); }
From source file:fr.pasteque.pos.sales.restaurant.JTicketsBagRestaurantMap.java
/** Creates new form JTicketsBagRestaurant */ public JTicketsBagRestaurantMap(AppView app, TicketsEditor panelticket) { super(app, panelticket); dlReceipts = new DataLogicReceipts(); dlSales = new DataLogicSales(); m_restaurantmap = new JTicketsBagRestaurant(app, this); m_PlaceCurrent = null;/*from ww w . ja v a2 s . com*/ m_PlaceClipboard = null; customer = null; this.floors = new ArrayList<Floor>(); this.places = new HashMap<String, List<Place>>(); try { ServerLoader loader = new ServerLoader(); ServerLoader.Response r = loader.read("PlacesAPI", "getAll"); if (r.getStatus().equals(ServerLoader.Response.STATUS_OK)) { JSONArray a = r.getArrayContent(); for (int i = 0; i < a.length(); i++) { JSONObject oFloor = a.getJSONObject(i); Floor f = new Floor(oFloor); this.floors.add(f); this.places.put(f.getID(), new ArrayList<Place>()); JSONArray aPlaces = oFloor.getJSONArray("places"); for (int j = 0; j < aPlaces.length(); j++) { Place p = new Place(aPlaces.getJSONObject(j)); this.places.get(f.getID()).add(p); } } } } catch (Exception e) { e.printStackTrace(); } initComponents(); // add the Floors containers if (this.floors.size() > 1) { // A tab container for 2 or more floors JTabbedPane jTabFloors = new JTabbedPane(); jTabFloors.applyComponentOrientation(getComponentOrientation()); jTabFloors.setBorder(new javax.swing.border.EmptyBorder(new Insets(5, 5, 5, 5))); jTabFloors.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); jTabFloors.setFocusable(false); jTabFloors.setRequestFocusEnabled(false); m_jPanelMap.add(jTabFloors, BorderLayout.CENTER); for (Floor f : this.floors) { f.getContainer().applyComponentOrientation(getComponentOrientation()); JScrollPane jScrCont = new JScrollPane(); jScrCont.applyComponentOrientation(getComponentOrientation()); JPanel jPanCont = new JPanel(); jPanCont.applyComponentOrientation(getComponentOrientation()); jTabFloors.addTab(f.getName(), f.getIcon(), jScrCont); jScrCont.setViewportView(jPanCont); jPanCont.add(f.getContainer()); } } else if (this.floors.size() == 1) { // Just a frame for 1 floor Floor f = this.floors.get(0); f.getContainer().applyComponentOrientation(getComponentOrientation()); JPanel jPlaces = new JPanel(); jPlaces.applyComponentOrientation(getComponentOrientation()); jPlaces.setLayout(new BorderLayout()); jPlaces.setBorder(new javax.swing.border.CompoundBorder( new javax.swing.border.EmptyBorder(new Insets(5, 5, 5, 5)), new javax.swing.border.TitledBorder(f.getName()))); JScrollPane jScrCont = new JScrollPane(); jScrCont.applyComponentOrientation(getComponentOrientation()); JPanel jPanCont = new JPanel(); jPanCont.applyComponentOrientation(getComponentOrientation()); // jPlaces.setLayout(new FlowLayout()); m_jPanelMap.add(jPlaces, BorderLayout.CENTER); jPlaces.add(jScrCont, BorderLayout.CENTER); jScrCont.setViewportView(jPanCont); jPanCont.add(f.getContainer()); } // Add all the Table buttons. for (Floor f : this.floors) { List<Place> places = this.places.get(f.getID()); for (Place pl : places) { f.getContainer().add(pl.getButton()); pl.setButtonBounds(); pl.getButton().addActionListener(new MyActionListener(pl)); } } // Add the reservations panel m_jreservations = new JTicketsBagRestaurantRes(app, this); add(m_jreservations, "res"); }