List of usage examples for javax.swing.border TitledBorder DEFAULT_JUSTIFICATION
int DEFAULT_JUSTIFICATION
To view the source code for javax.swing.border TitledBorder DEFAULT_JUSTIFICATION.
Click Source Link
From source file:org.cytoscape.dyn.internal.graphMetrics.GraphMetricsPanel.java
public GraphMetricsPanel(org.cytoscape.dyn.internal.CyActivator<T, C> cyActivator, DynNetwork<T> dynamicNetwork) { this.cyactivator = cyActivator; this.dynamicNetwork = dynamicNetwork; attributesTable = new JTable(new MyTableModel(dynamicNetwork.getNodeAttributes())); attributesTable.setPreferredScrollableViewportSize(new Dimension(300, 400)); attributesTable.setFillsViewportHeight(true); attributesTable.setShowGrid(false);/*from w ww .j a va2 s . co m*/ JScrollPane tablePanel = new JScrollPane(attributesTable); tablePanel.setSize(new Dimension(250, 400)); edgeAttributesTable = new JTable(new MyTableModel(dynamicNetwork.getEdgeAttributes())); edgeAttributesTable.setPreferredScrollableViewportSize(new Dimension(300, 400)); edgeAttributesTable.setFillsViewportHeight(true); edgeAttributesTable.setShowGrid(false); JScrollPane edgeTablePanel = new JScrollPane(edgeAttributesTable); edgeTablePanel.setSize(new Dimension(250, 400)); plotChartButton = new JButton("Plot Selected Attributes"); closeTab = new JButton("Close Tab"); plotChartButton.addActionListener(this); closeTab.addActionListener(this); buttonPanel = new JPanel(); buttonPanel.setLayout(new FlowLayout()); buttonPanel.add(plotChartButton); buttonPanel.add(closeTab); buttonPanel.setBorder(BorderFactory.createTitledBorder(null, "Options", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("SansSerif", 0, 12), Color.darkGray)); tablePanel.setBorder( BorderFactory.createTitledBorder(null, "Node Attributes", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("SansSerif", 0, 12), Color.darkGray)); edgeTablePanel.setBorder( BorderFactory.createTitledBorder(null, "Edge Attributes", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("SansSerif", 0, 12), Color.darkGray)); GroupLayout cytoLayout = new GroupLayout(this); this.setLayout(cytoLayout); this.add(tablePanel); this.add(buttonPanel); cytoLayout.setHorizontalGroup(cytoLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(tablePanel, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE) .addComponent(edgeTablePanel, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE) .addComponent(buttonPanel, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)); cytoLayout.setVerticalGroup( cytoLayout.createSequentialGroup().addComponent(tablePanel, 200, GroupLayout.DEFAULT_SIZE, 300) .addComponent(edgeTablePanel, 200, GroupLayout.DEFAULT_SIZE, 300) .addComponent(buttonPanel, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)); this.setVisible(true); }
From source file:com.sec.ose.osi.ui.dialog.setting.JPanProxySetting.java
private JPanel getJPanelValue() { if (jPanelValue == null) { GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.gridx = 1;/* ww w. j av a2 s . c o m*/ gridBagConstraints3.weighty = 1.0; gridBagConstraints3.weightx = 0.0; gridBagConstraints3.gridy = 4; jLabelEmpty = new JLabel(); jLabelEmpty.setText(""); GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.gridx = 0; gridBagConstraints2.gridy = 3; jPanelValue = new JPanel(); jPanelValue.setLayout(new GridBagLayout()); jPanelValue.setBorder(BorderFactory.createTitledBorder(null, "", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51))); jPanelValue.setPreferredSize(new Dimension(400, 200)); jPanelValue.add(jLabelEmpty, gridBagConstraints3); JLabel jLabelProxyHost = new JLabel("Proxy Host : ", JLabel.RIGHT); GridBagConstraints gridBagConstraintsjLabelProxyHost = new GridBagConstraints(); gridBagConstraintsjLabelProxyHost.gridx = 0; gridBagConstraintsjLabelProxyHost.insets = new Insets(10, 20, 5, 0); gridBagConstraintsjLabelProxyHost.fill = GridBagConstraints.HORIZONTAL; gridBagConstraintsjLabelProxyHost.weightx = 0.0; gridBagConstraintsjLabelProxyHost.weighty = 0.0; gridBagConstraintsjLabelProxyHost.gridy = 1; jPanelValue.add(jLabelProxyHost, gridBagConstraintsjLabelProxyHost); GridBagConstraints gridBagConstraintsgetJTextFieldProxyHost = new GridBagConstraints(); gridBagConstraintsgetJTextFieldProxyHost.gridx = 1; gridBagConstraintsgetJTextFieldProxyHost.weightx = 1.0; gridBagConstraintsgetJTextFieldProxyHost.fill = GridBagConstraints.BOTH; gridBagConstraintsgetJTextFieldProxyHost.insets = new Insets(10, 5, 5, 100); gridBagConstraintsgetJTextFieldProxyHost.gridwidth = 2; gridBagConstraintsgetJTextFieldProxyHost.gridy = 1; jPanelValue.add(getJTextFieldProxyHost(), gridBagConstraintsgetJTextFieldProxyHost); JLabel jLabelProxyPort = new JLabel("Proxy Port : ", JLabel.RIGHT); GridBagConstraints gridBagConstraintsjLabelProxyPort = new GridBagConstraints(); gridBagConstraintsjLabelProxyPort.gridx = 0; gridBagConstraintsjLabelProxyPort.insets = new Insets(0, 20, 0, 0); gridBagConstraintsjLabelProxyPort.fill = GridBagConstraints.HORIZONTAL; gridBagConstraintsjLabelProxyPort.weighty = 0.0; gridBagConstraintsjLabelProxyPort.gridy = 2; jPanelValue.add(jLabelProxyPort, gridBagConstraintsjLabelProxyPort); GridBagConstraints gridBagConstraintsgetJTextFieldProxyPort = new GridBagConstraints(); gridBagConstraintsgetJTextFieldProxyPort.gridx = 1; gridBagConstraintsgetJTextFieldProxyPort.weightx = 1.0; gridBagConstraintsgetJTextFieldProxyPort.fill = GridBagConstraints.BOTH; gridBagConstraintsgetJTextFieldProxyPort.insets = new Insets(5, 5, 5, 220); gridBagConstraintsgetJTextFieldProxyPort.weighty = 0.0; gridBagConstraintsgetJTextFieldProxyPort.anchor = GridBagConstraints.CENTER; gridBagConstraintsgetJTextFieldProxyPort.gridy = 2; jPanelValue.add(getJTextFieldProxyPort(), gridBagConstraintsgetJTextFieldProxyPort); JLabel jLabelProxyBypass = new JLabel("Proxy Bypass : ", JLabel.RIGHT); GridBagConstraints gridBagConstraintsjLabelProxyBypass = new GridBagConstraints(); gridBagConstraintsjLabelProxyBypass.gridx = 0; gridBagConstraintsjLabelProxyBypass.insets = new Insets(0, 20, 0, 0); gridBagConstraintsjLabelProxyBypass.fill = GridBagConstraints.HORIZONTAL; gridBagConstraintsjLabelProxyBypass.weighty = 0.0; gridBagConstraintsjLabelProxyBypass.gridy = 3; jPanelValue.add(jLabelProxyBypass, gridBagConstraintsjLabelProxyBypass); GridBagConstraints gridBagConstraintsgetJTextFieldProxyBypass = new GridBagConstraints(); gridBagConstraintsgetJTextFieldProxyBypass.gridx = 1; gridBagConstraintsgetJTextFieldProxyBypass.weightx = 1.0; gridBagConstraintsgetJTextFieldProxyBypass.fill = GridBagConstraints.BOTH; gridBagConstraintsgetJTextFieldProxyBypass.insets = new Insets(5, 5, 5, 100); gridBagConstraintsgetJTextFieldProxyBypass.weighty = 0.0; gridBagConstraintsgetJTextFieldProxyBypass.anchor = GridBagConstraints.CENTER; gridBagConstraintsgetJTextFieldProxyBypass.gridy = 3; jPanelValue.add(getJTextFieldProxyBypass(), gridBagConstraintsgetJTextFieldProxyBypass); //jPanelValue.add(getJPanel(), gridBagConstraints2); } return jPanelValue; }
From source file:com.sec.ose.osi.ui.frm.main.identification.patternmatch.JPanPatternMatchMain.java
/** * This method initializes this/*from w w w . jav a 2s .co m*/ * * @return void */ private void initialize() { GridBagConstraints gridBagConstraints41 = new GridBagConstraints(); gridBagConstraints41.gridx = 0; gridBagConstraints41.gridwidth = 2; gridBagConstraints41.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints41.weighty = 0.01; gridBagConstraints41.weightx = 1.0; gridBagConstraints41.gridy = 1; GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.gridx = 0; gridBagConstraints3.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints3.gridwidth = 2; gridBagConstraints3.weighty = 1.0; gridBagConstraints3.insets = new Insets(0, 20, 0, 0); gridBagConstraints3.gridy = 3; jLabelLicense = new JLabel(); jLabelLicense.setText("License :"); jLabelLicense.setFont(new Font("Dialog", Font.PLAIN, 12)); jLabelComponent = new JLabel(); jLabelComponent.setText("Component :"); jLabelComponent.setFont(new Font("Dialog", Font.PLAIN, 12)); jLabelBinding = new JLabel(); jLabelBinding.setText("Binding Type :"); jLabelBinding.setFont(new Font("Dialog", Font.PLAIN, 12)); this.setLayout(new GridBagLayout()); this.setSize(570, 480); this.setBorder(BorderFactory.createTitledBorder(null, "Identification Information", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51))); this.setLocation(new Point(0, 0)); this.add(getJScrollPaneFolder(), gridBagConstraints3); this.add(getJScrollPanePanel(), gridBagConstraints41); getJRadioButtonNotContain().setSelected(false); getJRadioButtonThird().setSelected(false); getJRadioButtonIKnow().setSelected(true); getJScrollPaneFolder().setVisible(true); }
From source file:com.mirth.connect.plugins.directoryresource.DirectoryResourcePropertiesPanel.java
private void initComponents() { setBackground(UIConstants.BACKGROUND_COLOR); setBorder(BorderFactory.createTitledBorder( BorderFactory.createMatteBorder(1, 0, 0, 0, new Color(204, 204, 204)), "Directory Settings", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Tahoma", 1, 11))); directoryLabel = new JLabel("Directory:"); directoryField = new MirthTextField(); directoryField.setToolTipText("The directory to load libraries from."); includeSubdirectoriesCheckBox = new MirthCheckBox("Include All Subdirectories"); includeSubdirectoriesCheckBox.setBackground(getBackground()); includeSubdirectoriesCheckBox.setToolTipText( "<html>Select Yes to traverse directories recursively and search for files in each one.</html>"); descriptionLabel = new JLabel("Description:"); descriptionTextPane = new MirthTextPane(); descriptionScrollPane = new JScrollPane(descriptionTextPane); libraryLabel = new JLabel("Loaded Libraries:"); libraryTable = new MirthTable(); libraryTable.setModel(new RefreshTableModel(new Object[] { "Library" }, 0)); libraryTable.setDragEnabled(false);/*w w w . j a v a 2 s . c om*/ libraryTable.setRowSelectionAllowed(false); libraryTable.setRowHeight(UIConstants.ROW_HEIGHT); libraryTable.setFocusable(false); libraryTable.setOpaque(true); libraryTable.getTableHeader().setReorderingAllowed(false); libraryTable.setEditable(false); libraryTable.setSortable(false); if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) { libraryTable.setHighlighters(HighlighterFactory.createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR, UIConstants.BACKGROUND_COLOR)); } libraryScrollPane = new JScrollPane(libraryTable); }
From source file:com.sec.ose.osi.ui.dialog.setting.JPanReportProperty.java
/** * This method initializes jPanelValue * //from w ww . j a v a 2 s . c o m * @return javax.swing.JPanel */ private JPanel getJPanelValue() { if (jPanelValue == null) { jPanelValue = new JPanel(); jPanelValue.setLayout(new GridBagLayout()); jPanelValue.setBorder(BorderFactory.createTitledBorder(null, "", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51))); jPanelValue.setPreferredSize(new Dimension(400, 200)); // Default Report Location jLabelDefaultReportLocation = new JLabel(); jLabelDefaultReportLocation.setText("Default Report Location:"); jLabelDefaultReportLocation.setHorizontalAlignment(SwingConstants.RIGHT); GridBagConstraints gridBagConstraintsjLabelDefaultReportLocation = new GridBagConstraints(); gridBagConstraintsjLabelDefaultReportLocation.gridx = 0; gridBagConstraintsjLabelDefaultReportLocation.fill = GridBagConstraints.HORIZONTAL; gridBagConstraintsjLabelDefaultReportLocation.insets = new Insets(5, 0, 0, 0); gridBagConstraintsjLabelDefaultReportLocation.gridy = 1; GridBagConstraints gridBagConstraintsjpanelDefaultReportLocation = new GridBagConstraints(); gridBagConstraintsjpanelDefaultReportLocation.fill = GridBagConstraints.BOTH; gridBagConstraintsjpanelDefaultReportLocation.gridy = 1; gridBagConstraintsjpanelDefaultReportLocation.weightx = 1.0; gridBagConstraintsjpanelDefaultReportLocation.insets = new Insets(10, 5, 5, 15); gridBagConstraintsjpanelDefaultReportLocation.gridx = 1; // reciprocal license jLabelReciprocalLicense = new JLabel(); jLabelReciprocalLicense.setText("Reciprocal License (RED):"); jLabelReciprocalLicense.setHorizontalAlignment(SwingConstants.RIGHT); GridBagConstraints gridBagConstraintsjLabelReciprocalLicense = new GridBagConstraints(); gridBagConstraintsjLabelReciprocalLicense.gridx = 0; gridBagConstraintsjLabelReciprocalLicense.insets = new Insets(0, 15, 0, 0); gridBagConstraintsjLabelReciprocalLicense.fill = GridBagConstraints.HORIZONTAL; gridBagConstraintsjLabelReciprocalLicense.gridy = 2; jPanelValue.add(jLabelDefaultReportLocation, gridBagConstraintsjLabelDefaultReportLocation); jPanelValue.add(getJPanelDefaultReportLocation(), gridBagConstraintsjpanelDefaultReportLocation); jPanelValue.add(jLabelReciprocalLicense, gridBagConstraintsjLabelReciprocalLicense); GridBagConstraints gridBagConstraintsgetJTextFieldReciprocalLicense = new GridBagConstraints(); gridBagConstraintsgetJTextFieldReciprocalLicense.gridx = 1; gridBagConstraintsgetJTextFieldReciprocalLicense.weightx = 1.0; gridBagConstraintsgetJTextFieldReciprocalLicense.fill = GridBagConstraints.BOTH; gridBagConstraintsgetJTextFieldReciprocalLicense.insets = new Insets(5, 5, 5, 15); gridBagConstraintsgetJTextFieldReciprocalLicense.gridy = 2; jPanelValue.add(getJTextFieldReciprocalLicense(), gridBagConstraintsgetJTextFieldReciprocalLicense); // major license jLabelMajorLicense = new JLabel(); jLabelMajorLicense.setText("Major License (ORANGE):"); jLabelMajorLicense.setHorizontalAlignment(SwingConstants.RIGHT); GridBagConstraints gridBagConstraintsjLabelMajorLicense = new GridBagConstraints(); gridBagConstraintsjLabelMajorLicense.gridx = 0; gridBagConstraintsjLabelMajorLicense.insets = new Insets(0, 15, 0, 0); gridBagConstraintsjLabelMajorLicense.fill = GridBagConstraints.HORIZONTAL; gridBagConstraintsjLabelMajorLicense.gridy = 3; jPanelValue.add(jLabelMajorLicense, gridBagConstraintsjLabelMajorLicense); GridBagConstraints gridBagConstraintsgetJTextFieldMajorLicense = new GridBagConstraints(); gridBagConstraintsgetJTextFieldMajorLicense.gridx = 1; gridBagConstraintsgetJTextFieldMajorLicense.weightx = 1.0; gridBagConstraintsgetJTextFieldMajorLicense.fill = GridBagConstraints.BOTH; gridBagConstraintsgetJTextFieldMajorLicense.insets = new Insets(5, 5, 5, 15); gridBagConstraintsgetJTextFieldMajorLicense.gridy = 3; jPanelValue.add(getJTextFieldMajorLicense(), gridBagConstraintsgetJTextFieldMajorLicense); GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.gridx = 1; gridBagConstraints3.weighty = 1.0; gridBagConstraints3.weightx = 0.0; gridBagConstraints3.gridy = 4; JLabel jLabelEmpty = new JLabel(); jLabelEmpty.setText(""); jPanelValue.add(jLabelEmpty, gridBagConstraints3); } return jPanelValue; }
From source file:BorderDemo.java
public BorderDemo() { super("BorderDemo"); Border blackline, etched, 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); etched = BorderFactory.createEtchedBorder(); raisedbevel = BorderFactory.createRaisedBevelBorder(); loweredbevel = BorderFactory.createLoweredBevelBorder(); empty = BorderFactory.createEmptyBorder(); //First pane: simple borders JPanel simpleBorders = new JPanel(); simpleBorders.setBorder(paneEdge);/*from w w w . jav a 2 s . c om*/ simpleBorders.setLayout(new BoxLayout(simpleBorders, BoxLayout.Y_AXIS)); addCompForBorder(blackline, "line border", simpleBorders); addCompForBorder(etched, "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)); //XXX: We *should* size the component so that the //XXX: icons tile OK. Without that, the icons are //XXX: likely to be cut off and look bad. ImageIcon icon = new ImageIcon("images/left.gif"); //20x22 Border border = BorderFactory.createMatteBorder(-1, -1, -1, -1, icon); addCompForBorder(border, "matte border (-1,-1,-1,-1,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); addCompForBorder(border, "matte border (0,20,0,0,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(etched, "title"); addCompForTitledBorder(titled, "titled 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); getContentPane().add(tabbedPane, BorderLayout.CENTER); }
From source file:com.mirth.connect.manager.HeapSizeDialog.java
private void initLayout() { setLayout(new MigLayout("insets 8, novisualpadding, hidemode 3, fill")); JPanel panel = new JPanel(new MigLayout("insets 4, novisualpadding, hidemode 3, fill")); panel.setBackground(Color.white); panel.setBorder(BorderFactory.createTitledBorder( BorderFactory.createMatteBorder(1, 1, 1, 1, new Color(204, 204, 204)), "Web Start Settings", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Tahoma", 1, 11))); panel.add(new JLabel("Max Heap Size:"), "split"); panel.add(heapSizeComboBox, "w 75!, left, wrap"); panel.add(warningLabel, "split"); add(panel);// ww w .j a v a 2 s . c o m add(new JSeparator(), "newline, growx, sx"); add(okButton, "newline, h 22!, w 56!, sx, right, split"); add(cancelButton, "h 22!, w 56!"); }
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);/* w w w . ja va 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); }
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);/*from ww w .j a v a 2 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:com.sec.ose.osi.ui.frm.main.identification.JPanIdentifyResetComment.java
/** * This method initializes jScrollPane1 * /* w w w .jav a2 s . co m*/ * @return javax.swing.JScrollPane */ private JScrollPane getJScrollPaneComment() { if (jScrollPaneComment == null) { jScrollPaneComment = new JScrollPane(); jScrollPaneComment.setBorder(BorderFactory.createTitledBorder(null, "File Comment", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51))); jScrollPaneComment.setViewportView(getJTextAreaComment()); } return jScrollPaneComment; }