List of usage examples for javax.swing JPanel setLayout
public void setLayout(LayoutManager mgr)
From source file:net.launchpad.jabref.plugins.ZentralSearch.java
public JPanel getOptionsPanel() { JPanel pan = new JPanel(); pan.setLayout(new java.awt.GridLayout(10, 1)); pan.add(new JLabel("The above query field has to be filled.")); pan.add(new JSeparator(SwingConstants.HORIZONTAL)); pan.add(new JLabel("Below are additional query options.")); pan.add(new JLabel("Search by author")); pan.add(author);/*from w w w . j a v a 2s. co m*/ pan.add(new JLabel("Search by title")); pan.add(title); pan.add(new JLabel("Search the abstract")); pan.add(theAbstract); reset.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { author.setText(""); title.setText(""); theAbstract.setText(""); } }); pan.add(reset); return pan; }
From source file:com.idealista.solrmeter.view.statistic.OperationTimeLineChartPanel.java
private Component createCheckBoxPanel() { JPanel panelCheckBox = new JPanel(); panelCheckBox.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); panelCheckBox.setLayout(new BoxLayout(panelCheckBox, BoxLayout.X_AXIS)); checkBoxShowCommit = new JCheckBox(I18n.get("statistic.operationTimeLineChartPanel.checkbox.commit")); checkBoxShowCommit.addActionListener(this); checkBoxShowOptimize = new JCheckBox(I18n.get("statistic.operationTimeLineChartPanel.checkbox.optimize")); checkBoxShowOptimize.addActionListener(this); checkBoxShowAdd = new JCheckBox(I18n.get("statistic.operationTimeLineChartPanel.checkbox.add")); checkBoxShowAdd.addActionListener(this); checkBoxShowQueries = new JCheckBox(I18n.get("statistic.operationTimeLineChartPanel.checkbox.query")); checkBoxShowQueries.addActionListener(this); panelCheckBox.add(Box.createHorizontalGlue()); panelCheckBox.add(checkBoxShowCommit); panelCheckBox.add(Box.createHorizontalGlue()); panelCheckBox.add(checkBoxShowOptimize); panelCheckBox.add(Box.createHorizontalGlue()); panelCheckBox.add(checkBoxShowQueries); panelCheckBox.add(Box.createHorizontalGlue()); panelCheckBox.add(checkBoxShowAdd);//from w w w . j a va 2s . c om panelCheckBox.add(Box.createHorizontalGlue()); panelCheckBox.setMaximumSize(new Dimension(800, 25)); checkAll(); return panelCheckBox; }
From source file:com.apatar.ui.JFeatureRequestHelpDialog.java
private void createDialog() { setLayout(new BorderLayout(5, 5)); setSize(400, 400);//from w w w .j av a2 s . co m JPanel textPanel = new JPanel(new BorderLayout(5, 5)); textPanel.setBorder(new EmptyBorder(10, 5, 5, 5)); text.setLineWrap(true); text.setWrapStyleWord(true); text.setFont(UiUtils.NORMAL_SIZE_12_FONT); textPanel.add(new JLabel("What new Apatar features would you like to request? Please describe them:"), BorderLayout.NORTH); textPanel.add(new JScrollPane(text), BorderLayout.CENTER); JPanel contactPanel = new JPanel(); contactPanel.setLayout(new BoxLayout(contactPanel, BoxLayout.Y_AXIS)); JPanel firstNamePanel = new JPanel(); firstNamePanel.setLayout(new BoxLayout(firstNamePanel, BoxLayout.X_AXIS)); firstNamePanel.add(new JLabel("Your First Name:")); firstNamePanel.add(Box.createHorizontalStrut(5)); firstNamePanel.add(firstNameField); JPanel lastNamePanel = new JPanel(); lastNamePanel.setLayout(new BoxLayout(lastNamePanel, BoxLayout.X_AXIS)); lastNamePanel.add(new JLabel("Your Last Name:")); lastNamePanel.add(Box.createHorizontalStrut(5)); lastNamePanel.add(lastNameField); JPanel emailPanel = new JPanel(); emailPanel.setLayout(new BoxLayout(emailPanel, BoxLayout.X_AXIS)); emailPanel.add(new JLabel("Your E-mail:")); emailPanel.add(Box.createHorizontalStrut(28)); emailPanel.add(emailField); contactPanel.add(firstNamePanel); contactPanel.add(Box.createVerticalStrut(5)); contactPanel.add(lastNamePanel); contactPanel.add(Box.createVerticalStrut(5)); contactPanel.add(emailPanel); textPanel.add(contactPanel, BorderLayout.SOUTH); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); buttonPanel.add(Box.createHorizontalGlue()); buttonPanel.add(sendButton); buttonPanel.add(Box.createHorizontalStrut(5)); buttonPanel.add(cancel); buttonPanel.add(Box.createHorizontalStrut(5)); buttonPanel.setBorder(new EmptyBorder(0, 0, 5, 0)); getContentPane().add(textPanel, BorderLayout.CENTER); getContentPane().add(buttonPanel, BorderLayout.SOUTH); }
From source file:AliasBean.java
public AliasBean() { aliVector = new Vector(); aliJList = new JList(); // XXX MUST FIX THIS // aliJList.setSelectionMode(JList.SINGLE_SELECTION); aliJList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { int i = aliJList.getSelectedIndex(); if (i < 0) return; Alias al = (Alias) aliVector.get(i); nameTF.setText(al.getName()); addrTF.setText(al.getAddress()); }/*from w w w. j av a2s. c om*/ }); setLayout(new BorderLayout()); add(BorderLayout.WEST, new JScrollPane(aliJList)); JPanel rightPanel = new JPanel(); add(BorderLayout.EAST, rightPanel); rightPanel.setLayout(new GridLayout(0, 1)); JPanel buttons = new JPanel(); rightPanel.add(buttons); buttons.setLayout(new GridLayout(0, 1, 15, 15)); JButton b; buttons.add(b = new JButton("Set")); b.setToolTipText("Add or Change an alias"); b.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { int i = aliJList.getSelectedIndex(); if (i < 0) { // XXX error dialog?? return; } setAlias(i, nameTF.getText(), addrTF.getText()); } }); buttons.add(b = new JButton("Delete")); b.setToolTipText("Delete the selected alias"); b.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { int i = aliJList.getSelectedIndex(); if (i < 0) { return; } deleteAlias(i); } }); buttons.add(b = new JButton("Apply")); b.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { System.err.println("NOT WRITTEN YET"); } }); JPanel fields = new JPanel(); rightPanel.add(fields); fields.setLayout(new GridLayout(2, 2)); fields.add(new JLabel("Name")); fields.add(nameTF = new JTextField(10)); fields.add(new JLabel("Address")); fields.add(addrTF = new JTextField(20)); }
From source file:com.emental.mindraider.ui.dialogs.AddTripletJDialog.java
/** * Constructor.// ww w . j a v a 2 s .c o m */ public AddTripletJDialog() { super("Add Triplet"); JPanel framePanel = new JPanel(); framePanel.setLayout(new GridLayout(4, 1)); JPanel p = new JPanel(); p.setLayout(new FlowLayout(FlowLayout.RIGHT)); p.add(new JLabel(" Predicate: ")); predicateNs = new JTextField(30); predicateNs.setText(MindRaiderConstants.MR_RDF_PREDICATE_NS); predicateNs.selectAll(); p.add(predicateNs); p.add(new JLabel("#")); predicateLocalName = new JTextField(15); p.add(predicateLocalName); framePanel.add(p); p = new JPanel(); p.setLayout(new FlowLayout(FlowLayout.RIGHT)); p.add(new JLabel(" Object: ")); objectNs = new JTextField(30); objectNs.setText(MindRaiderConstants.MR_RDF_PREDICATE_NS); objectNs.selectAll(); p.add(objectNs); p.add(new JLabel("#")); objectLocalName = new JTextField(15); objectLocalName.grabFocus(); objectLocalName.selectAll(); objectLocalName.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyCode() == KeyEvent.VK_ENTER) { createTriplet(); } } public void keyReleased(KeyEvent keyEvent) { } public void keyTyped(KeyEvent keyEvent) { } }); p.add(objectLocalName); framePanel.add(p); p = new JPanel(); p.setLayout(new FlowLayout(FlowLayout.RIGHT)); literalCheckBox = new JCheckBox("literal", false); p.add(literalCheckBox); framePanel.add(p); p = new JPanel(); p.setLayout(new FlowLayout(FlowLayout.CENTER)); JButton addButton = new JButton("Add"); p.add(addButton); addButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { createTriplet(); } }); JButton cancelButton = new JButton("Cancel"); p.add(cancelButton); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AddTripletJDialog.this.dispose(); } }); framePanel.add(p); getContentPane().add(framePanel, BorderLayout.CENTER); // show pack(); Gfx.centerAndShowWindow(this); addWindowListener(new WindowAdapter() { public void windowActivated(WindowEvent e) { getObjectLocalName().requestFocusInWindow(); } }); }
From source file:com.fedroot.dacs.swing.DacsNoticePresentationDialog.java
/** * Called by constructors to initialize the dialog. *///from w w w . ja v a 2 s. c o m @Override protected void dialogInit() { if (labels == null) { setLocale(Locale.getDefault()); } ActionListener actionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if (source == acceptButton) { pressed_ACCEPT = true; DacsNoticePresentationDialog.this.setVisible(false); } else if (source == declineButton) { pressed_ACCEPT = false; DacsNoticePresentationDialog.this.setVisible(false); } else { pressed_ACCEPT = false; DacsNoticePresentationDialog.this.setVisible(false); } } }; acceptButton = new JButton(labels.getString("dialog.accept")); declineButton = new JButton(labels.getString("dialog.decline")); super.dialogInit(); JPanel inputpane = new JPanel(new FlowLayout()); inputpane.add(acceptButton); inputpane.add(declineButton); acceptButton.addActionListener(actionListener); inputpane.add(acceptButton); declineButton.addActionListener(actionListener); inputpane.add(declineButton); htmlpane = new JEditorPane(); // htmlpane.setContentType("image/png"); htmlpane.setEditable(false); // initialize htmlpane with something setDocumentContent("text/html", "<html><body><img src=\"http://fedroot.com/images/rick-and-frog.jpg\" width=400 height=300></body></html>"); // not set when called from super() setDocumentContent(this.content); JScrollPane presentation = new JScrollPane(htmlpane); JPanel pane = new JPanel(); pane.setLayout(new BorderLayout()); pane.add(presentation, BorderLayout.CENTER); pane.add(inputpane, BorderLayout.SOUTH); Container container = getContentPane(); container.add(pane); container.setSize(600, 400); pack(); }
From source file:au.org.ala.delta.intkey.ui.WebSearchDialog.java
/** * Create the dialog.//from www . jav a 2s . c o m */ public WebSearchDialog(Dialog owner) { super(owner); setName("WebSearchDialog"); ResourceMap resourceMap = Application.getInstance().getContext().getResourceMap(WebSearchDialog.class); resourceMap.injectFields(this); ActionMap actionMap = Application.getInstance().getContext().getActionMap(WebSearchDialog.class, this); setTitle(websearchTitle); setBounds(100, 100, 450, 250); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); { lblSearchFor = new JLabel(searchForLabel); } txtSearch = new JTextField(); txtSearch.setColumns(10); final JLabel lblUsing = new JLabel(usingLabel); cmbSearchEngine = new JComboBox(); GroupLayout gl_contentPanel = new GroupLayout(contentPanel); gl_contentPanel.setHorizontalGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING) .addGroup(gl_contentPanel.createSequentialGroup().addContainerGap() .addGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING) .addComponent(lblSearchFor, GroupLayout.DEFAULT_SIZE, 404, Short.MAX_VALUE) .addComponent(cmbSearchEngine, 0, 404, Short.MAX_VALUE) .addComponent(txtSearch, GroupLayout.DEFAULT_SIZE, 404, Short.MAX_VALUE) .addComponent(lblUsing, GroupLayout.DEFAULT_SIZE, 404, Short.MAX_VALUE)) .addContainerGap())); gl_contentPanel .setVerticalGroup( gl_contentPanel.createParallelGroup(Alignment.LEADING) .addGroup(gl_contentPanel.createSequentialGroup().addContainerGap() .addComponent(lblSearchFor).addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(txtSearch, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(27).addComponent(lblUsing) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(cmbSearchEngine, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap(41, Short.MAX_VALUE))); contentPanel.setLayout(gl_contentPanel); { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.CENTER)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { JButton okButton = new JButton("[OK]"); okButton.setAction(actionMap.get("WebSearchDialog_search")); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); } { JButton cancelButton = new JButton("[Cancel]"); cancelButton.setAction(actionMap.get("WebSearchDialog_cancel")); buttonPane.add(cancelButton); } } LocalConfigFiles files = new LocalConfigFiles("intkey"); File f = files.getWebsearchIndexFile(); if (f.exists()) { loadSearchEngines(f, cmbSearchEngine); } cmbSearchEngine.requestFocus(); }
From source file:edu.harvard.mcz.imagecapture.SpecimenPartAttribEditDialog.java
private void init() { setTitle("Edit Part Attribute"); setBounds(100, 100, 420, 200);//from ww w. j av a 2s . c om getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { okButton = new JButton("OK"); okButton.setActionCommand("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { okButton.grabFocus(); if (comboBoxType.getSelectedIndex() > -1) { targetAttribute.setAttributeType(comboBoxType.getSelectedItem().toString()); } targetAttribute.setAttributeValue(comboBoxValue.getSelectedItem().toString()); targetAttribute.setAttributeUnits(textFieldUnits.getText()); targetAttribute.setAttributeRemark(textFieldRemarks.getText()); thisDialog.setVisible(false); } }); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); } { JButton cancelButton = new JButton("Cancel"); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { thisDialog.setVisible(false); } }); buttonPane.add(cancelButton); } } { JPanel panel = new JPanel(); getContentPane().add(panel, BorderLayout.CENTER); panel.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, })); { JLabel lblAttributeType = new JLabel("Attribute Type"); panel.add(lblAttributeType, "2, 2, right, default"); } { comboBoxType = new JComboBox(); comboBoxType.setModel( new DefaultComboBoxModel(new String[] { "caste", "scientific name", "sex", "life stage" })); comboBoxType.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String item = comboBoxType.getSelectedItem().toString(); if (item != null) { configureComboBoxValue(item); } } }); panel.add(comboBoxType, "4, 2, fill, default"); } { JLabel lblValue = new JLabel("Value"); panel.add(lblValue, "2, 4, right, default"); } { comboBoxValue = new JComboBox(); comboBoxValue.setModel(new DefaultComboBoxModel(Caste.getCasteValues())); panel.add(comboBoxValue, "4, 4, fill, default"); } { JLabel lblUnits = new JLabel("Units"); panel.add(lblUnits, "2, 6, right, default"); } { textFieldUnits = new JTextField(); panel.add(textFieldUnits, "4, 6, fill, default"); textFieldUnits.setColumns(10); } { JLabel lblRemarks = new JLabel("Remarks"); panel.add(lblRemarks, "2, 8, right, default"); } { textFieldRemarks = new JTextField(); panel.add(textFieldRemarks, "4, 8, fill, default"); textFieldRemarks.setColumns(10); } } }
From source file:BorderDemo.java
public BorderDemo() { super(new GridLayout(1, 0)); // Keep references to the next few borders, // for use in titles and compound borders. Border blackline, raisedetched, loweredetched, raisedbevel, loweredbevel, empty; // A border that puts 10 extra pixels at the sides and // bottom of each pane. Border paneEdge = BorderFactory.createEmptyBorder(0, 10, 10, 10); blackline = BorderFactory.createLineBorder(Color.black); raisedetched = BorderFactory.createEtchedBorder(EtchedBorder.RAISED); loweredetched = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); raisedbevel = BorderFactory.createRaisedBevelBorder(); loweredbevel = BorderFactory.createLoweredBevelBorder(); empty = BorderFactory.createEmptyBorder(); // First pane: simple borders JPanel simpleBorders = new JPanel(); simpleBorders.setBorder(paneEdge);/*w w w .ja v a2 s . co m*/ simpleBorders.setLayout(new BoxLayout(simpleBorders, BoxLayout.Y_AXIS)); addCompForBorder(blackline, "line border", simpleBorders); addCompForBorder(raisedetched, "raised etched border", simpleBorders); addCompForBorder(loweredetched, "lowered etched border", simpleBorders); addCompForBorder(raisedbevel, "raised bevel border", simpleBorders); addCompForBorder(loweredbevel, "lowered bevel border", simpleBorders); addCompForBorder(empty, "empty border", simpleBorders); // Second pane: matte borders JPanel matteBorders = new JPanel(); matteBorders.setBorder(paneEdge); matteBorders.setLayout(new BoxLayout(matteBorders, BoxLayout.Y_AXIS)); ImageIcon icon = createImageIcon("images/wavy.gif", "wavy-line border icon"); // 20x22 Border border = BorderFactory.createMatteBorder(-1, -1, -1, -1, icon); if (icon != null) { addCompForBorder(border, "matte border (-1,-1,-1,-1,icon)", matteBorders); } else { addCompForBorder(border, "matte border (-1,-1,-1,-1,<null-icon>)", matteBorders); } border = BorderFactory.createMatteBorder(1, 5, 1, 1, Color.red); addCompForBorder(border, "matte border (1,5,1,1,Color.red)", matteBorders); border = BorderFactory.createMatteBorder(0, 20, 0, 0, icon); if (icon != null) { addCompForBorder(border, "matte border (0,20,0,0,icon)", matteBorders); } else { addCompForBorder(border, "matte border (0,20,0,0,<null-icon>)", matteBorders); } // Third pane: titled borders JPanel titledBorders = new JPanel(); titledBorders.setBorder(paneEdge); titledBorders.setLayout(new BoxLayout(titledBorders, BoxLayout.Y_AXIS)); TitledBorder titled; titled = BorderFactory.createTitledBorder("title"); addCompForBorder(titled, "default titled border" + " (default just., default pos.)", titledBorders); titled = BorderFactory.createTitledBorder(blackline, "title"); addCompForTitledBorder(titled, "titled line border" + " (centered, default pos.)", TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION, titledBorders); titled = BorderFactory.createTitledBorder(loweredetched, "title"); addCompForTitledBorder(titled, "titled lowered etched border" + " (right just., default pos.)", TitledBorder.RIGHT, TitledBorder.DEFAULT_POSITION, titledBorders); titled = BorderFactory.createTitledBorder(loweredbevel, "title"); addCompForTitledBorder(titled, "titled lowered bevel border" + " (default just., above top)", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.ABOVE_TOP, titledBorders); titled = BorderFactory.createTitledBorder(empty, "title"); addCompForTitledBorder(titled, "titled empty border" + " (default just., bottom)", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.BOTTOM, titledBorders); // Fourth pane: compound borders JPanel compoundBorders = new JPanel(); compoundBorders.setBorder(paneEdge); compoundBorders.setLayout(new BoxLayout(compoundBorders, BoxLayout.Y_AXIS)); Border redline = BorderFactory.createLineBorder(Color.red); Border compound; compound = BorderFactory.createCompoundBorder(raisedbevel, loweredbevel); addCompForBorder(compound, "compound border (two bevels)", compoundBorders); compound = BorderFactory.createCompoundBorder(redline, compound); addCompForBorder(compound, "compound border (add a red outline)", compoundBorders); titled = BorderFactory.createTitledBorder(compound, "title", TitledBorder.CENTER, TitledBorder.BELOW_BOTTOM); addCompForBorder(titled, "titled compound border" + " (centered, below bottom)", compoundBorders); JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.addTab("Simple", null, simpleBorders, null); tabbedPane.addTab("Matte", null, matteBorders, null); tabbedPane.addTab("Titled", null, titledBorders, null); tabbedPane.addTab("Compound", null, compoundBorders, null); tabbedPane.setSelectedIndex(0); String toolTip = new String( "<html>Blue Wavy Line border art crew:<br> Bill Pauley<br> Cris St. Aubyn<br> Ben Wronsky<br> Nathan Walrath<br> Tommy Adams, special consultant</html>"); tabbedPane.setToolTipTextAt(1, toolTip); add(tabbedPane); }
From source file:components.BorderDemo.java
public BorderDemo() { super(new GridLayout(1, 0)); //Keep references to the next few borders, //for use in titles and compound borders. Border blackline, raisedetched, loweredetched, raisedbevel, loweredbevel, empty; //A border that puts 10 extra pixels at the sides and //bottom of each pane. Border paneEdge = BorderFactory.createEmptyBorder(0, 10, 10, 10); blackline = BorderFactory.createLineBorder(Color.black); raisedetched = BorderFactory.createEtchedBorder(EtchedBorder.RAISED); loweredetched = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); raisedbevel = BorderFactory.createRaisedBevelBorder(); loweredbevel = BorderFactory.createLoweredBevelBorder(); empty = BorderFactory.createEmptyBorder(); //First pane: simple borders JPanel simpleBorders = new JPanel(); simpleBorders.setBorder(paneEdge);//www.ja v a 2 s . c o m simpleBorders.setLayout(new BoxLayout(simpleBorders, BoxLayout.Y_AXIS)); addCompForBorder(blackline, "line border", simpleBorders); addCompForBorder(raisedetched, "raised etched border", simpleBorders); addCompForBorder(loweredetched, "lowered etched border", simpleBorders); addCompForBorder(raisedbevel, "raised bevel border", simpleBorders); addCompForBorder(loweredbevel, "lowered bevel border", simpleBorders); addCompForBorder(empty, "empty border", simpleBorders); //Second pane: matte borders JPanel matteBorders = new JPanel(); matteBorders.setBorder(paneEdge); matteBorders.setLayout(new BoxLayout(matteBorders, BoxLayout.Y_AXIS)); ImageIcon icon = createImageIcon("images/wavy.gif", "wavy-line border icon"); //20x22 Border border = BorderFactory.createMatteBorder(-1, -1, -1, -1, icon); if (icon != null) { addCompForBorder(border, "matte border (-1,-1,-1,-1,icon)", matteBorders); } else { addCompForBorder(border, "matte border (-1,-1,-1,-1,<null-icon>)", matteBorders); } border = BorderFactory.createMatteBorder(1, 5, 1, 1, Color.red); addCompForBorder(border, "matte border (1,5,1,1,Color.red)", matteBorders); border = BorderFactory.createMatteBorder(0, 20, 0, 0, icon); if (icon != null) { addCompForBorder(border, "matte border (0,20,0,0,icon)", matteBorders); } else { addCompForBorder(border, "matte border (0,20,0,0,<null-icon>)", matteBorders); } //Third pane: titled borders JPanel titledBorders = new JPanel(); titledBorders.setBorder(paneEdge); titledBorders.setLayout(new BoxLayout(titledBorders, BoxLayout.Y_AXIS)); TitledBorder titled; titled = BorderFactory.createTitledBorder("title"); addCompForBorder(titled, "default titled border" + " (default just., default pos.)", titledBorders); titled = BorderFactory.createTitledBorder(blackline, "title"); addCompForTitledBorder(titled, "titled line border" + " (centered, default pos.)", TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION, titledBorders); titled = BorderFactory.createTitledBorder(loweredetched, "title"); addCompForTitledBorder(titled, "titled lowered etched border" + " (right just., default pos.)", TitledBorder.RIGHT, TitledBorder.DEFAULT_POSITION, titledBorders); titled = BorderFactory.createTitledBorder(loweredbevel, "title"); addCompForTitledBorder(titled, "titled lowered bevel border" + " (default just., above top)", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.ABOVE_TOP, titledBorders); titled = BorderFactory.createTitledBorder(empty, "title"); addCompForTitledBorder(titled, "titled empty border" + " (default just., bottom)", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.BOTTOM, titledBorders); //Fourth pane: compound borders JPanel compoundBorders = new JPanel(); compoundBorders.setBorder(paneEdge); compoundBorders.setLayout(new BoxLayout(compoundBorders, BoxLayout.Y_AXIS)); Border redline = BorderFactory.createLineBorder(Color.red); Border compound; compound = BorderFactory.createCompoundBorder(raisedbevel, loweredbevel); addCompForBorder(compound, "compound border (two bevels)", compoundBorders); compound = BorderFactory.createCompoundBorder(redline, compound); addCompForBorder(compound, "compound border (add a red outline)", compoundBorders); titled = BorderFactory.createTitledBorder(compound, "title", TitledBorder.CENTER, TitledBorder.BELOW_BOTTOM); addCompForBorder(titled, "titled compound border" + " (centered, below bottom)", compoundBorders); JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.addTab("Simple", null, simpleBorders, null); tabbedPane.addTab("Matte", null, matteBorders, null); tabbedPane.addTab("Titled", null, titledBorders, null); tabbedPane.addTab("Compound", null, compoundBorders, null); tabbedPane.setSelectedIndex(0); String toolTip = new String( "<html>Blue Wavy Line border art crew:<br> Bill Pauley<br> Cris St. Aubyn<br> Ben Wronsky<br> Nathan Walrath<br> Tommy Adams, special consultant</html>"); tabbedPane.setToolTipTextAt(1, toolTip); add(tabbedPane); }