Java Code Examples for javax.swing.border.CompoundBorder

The following examples show how to use javax.swing.border.CompoundBorder. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: darklaf   Source File: DarkSpinnerUI.java    License: MIT License 6 votes vote down vote up
private JButton createArrow(final int direction) {
    int buttonPad = UIManager.getInt("Spinner.buttonPad");
    Insets insets = new Insets(0, buttonPad, 0, buttonPad);
    JButton button = ArrowButton.createUpDownArrow(spinner,
                                                   getArrowIcon(direction),
                                                   getArrowInactiveIcon(direction), direction,
                                                   false, true, insets);
    Border buttonBorder = UIManager.getBorder("Spinner.arrowButtonBorder");
    if (buttonBorder instanceof UIResource) {
        // Wrap the border to avoid having the UIResource be replaced by
        // the ButtonUI. This is the opposite of using BorderUIResource.
        button.setBorder(new CompoundBorder(buttonBorder, null));
    } else {
        button.setBorder(buttonBorder);
    }
    button.setInheritsPopupMenu(true);
    return button;
}
 
Example 2
Source Project: jdk8u-jdk   Source File: ContrastMetalTheme.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public void addCustomEntriesToTable(UIDefaults table) {

    Border blackLineBorder =
            new BorderUIResource(new LineBorder(getBlack()));
    Border whiteLineBorder =
            new BorderUIResource(new LineBorder(getWhite()));

    Object textBorder = new BorderUIResource(new CompoundBorder(
            blackLineBorder,
            new BasicBorders.MarginBorder()));

    table.put("ToolTip.border", blackLineBorder);
    table.put("TitledBorder.border", blackLineBorder);
    table.put("Table.focusCellHighlightBorder", whiteLineBorder);
    table.put("Table.focusCellForeground", getWhite());

    table.put("TextField.border", textBorder);
    table.put("PasswordField.border", textBorder);
    table.put("TextArea.border", textBorder);
    table.put("TextPane.font", textBorder);


}
 
Example 3
@Override
public void addCustomEntriesToTable(UIDefaults table) {

    Border blackLineBorder =
            new BorderUIResource(new LineBorder(getBlack()));
    Border whiteLineBorder =
            new BorderUIResource(new LineBorder(getWhite()));

    Object textBorder = new BorderUIResource(new CompoundBorder(
            blackLineBorder,
            new BasicBorders.MarginBorder()));

    table.put("ToolTip.border", blackLineBorder);
    table.put("TitledBorder.border", blackLineBorder);
    table.put("Table.focusCellHighlightBorder", whiteLineBorder);
    table.put("Table.focusCellForeground", getWhite());

    table.put("TextField.border", textBorder);
    table.put("PasswordField.border", textBorder);
    table.put("TextArea.border", textBorder);
    table.put("TextPane.font", textBorder);


}
 
Example 4
Source Project: ghidra   Source File: GhidraIconCache.java    License: Apache License 2.0 6 votes vote down vote up
private Icon createIcon(AttributedVertex vertex) {
	rendererLabel.setText(ProgramGraphFunctions.getLabel(vertex));

	rendererLabel.setFont(new Font(DEFAULT_FONT_NAME, Font.BOLD, DEFAULT_FONT_SIZE));
	rendererLabel.setForeground(Color.black);
	rendererLabel.setBackground(Color.white);
	rendererLabel.setOpaque(true);
	Border lineBorder = BorderFactory.createLineBorder((Color) Colors.getColor(vertex), 2);
	Border marginBorder = BorderFactory.createEmptyBorder(DEFAULT_MARGIN_BORDER_SIZE,
		DEFAULT_MARGIN_BORDER_SIZE, DEFAULT_MARGIN_BORDER_SIZE, DEFAULT_MARGIN_BORDER_SIZE);
	rendererLabel.setBorder(new CompoundBorder(lineBorder, marginBorder));

	Dimension labelSize = rendererLabel.getPreferredSize();
	rendererLabel.setSize(labelSize);
	Shape shape = ProgramGraphFunctions.getVertexShape(vertex);

	IconShape.Type shapeType = iconShapeFunction.apply(shape);

	return createImageIcon(vertex, shapeType, rendererLabel, labelSize, shape);
}
 
Example 5
/**
 * Returns the rendered header cell for the supplied value and column.
 *
 * @param jtRevokedCerts The JTable
 * @param value The value to assign to the cell
 * @param bIsSelected True if cell is selected
 * @param iRow The row of the cell to render
 * @param iCol The column of the cell to render
 * @param bHasFocus If true, render cell appropriately
 * @return The rendered cell
 */
@Override
public Component getTableCellRendererComponent(JTable jtRevokedCerts, Object value, boolean bIsSelected,
    boolean bHasFocus, int iRow, int iCol)
{
	// Get header renderer
	JLabel header = (JLabel) jtRevokedCerts.getColumnModel().getColumn(iCol).getHeaderRenderer();

	// The headers contain text
	header.setText(value.toString());
	header.setHorizontalAlignment(LEFT);

	// Set tool tips
	if (iCol == 0)
	{
		header.setToolTipText(RB.getString("RevokedCertsTableHeadRend.SerialNumberColumn.tooltip"));
	}
	else
	{
		header.setToolTipText(RB.getString("RevokedCertsTableHeadRend.RevocationDateColumn.tooltip"));
	}

	header.setBorder(new CompoundBorder(new BevelBorder(BevelBorder.RAISED), new EmptyBorder(0, 5, 0, 5)));

	return header;
}
 
Example 6
@Override
public void addCustomEntriesToTable(UIDefaults table) {

    Border blackLineBorder =
            new BorderUIResource(new LineBorder(getBlack()));
    Border whiteLineBorder =
            new BorderUIResource(new LineBorder(getWhite()));

    Object textBorder = new BorderUIResource(new CompoundBorder(
            blackLineBorder,
            new BasicBorders.MarginBorder()));

    table.put("ToolTip.border", blackLineBorder);
    table.put("TitledBorder.border", blackLineBorder);
    table.put("Table.focusCellHighlightBorder", whiteLineBorder);
    table.put("Table.focusCellForeground", getWhite());

    table.put("TextField.border", textBorder);
    table.put("PasswordField.border", textBorder);
    table.put("TextArea.border", textBorder);
    table.put("TextPane.font", textBorder);


}
 
Example 7
Source Project: jdk8u_jdk   Source File: ContrastMetalTheme.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public void addCustomEntriesToTable(UIDefaults table) {

    Border blackLineBorder =
            new BorderUIResource(new LineBorder(getBlack()));
    Border whiteLineBorder =
            new BorderUIResource(new LineBorder(getWhite()));

    Object textBorder = new BorderUIResource(new CompoundBorder(
            blackLineBorder,
            new BasicBorders.MarginBorder()));

    table.put("ToolTip.border", blackLineBorder);
    table.put("TitledBorder.border", blackLineBorder);
    table.put("Table.focusCellHighlightBorder", whiteLineBorder);
    table.put("Table.focusCellForeground", getWhite());

    table.put("TextField.border", textBorder);
    table.put("PasswordField.border", textBorder);
    table.put("TextArea.border", textBorder);
    table.put("TextPane.font", textBorder);


}
 
Example 8
Source Project: dctb-utfpr-2018-1   Source File: SignIn.java    License: Apache License 2.0 6 votes vote down vote up
public JButton styleButtons(){
    JButton submit = new JButton();
    Color colorForeground = new Color(0x8D8D8D);
    Color colorBackground = new Color(0xF1F1F1);
    submit.setForeground(colorForeground);
    submit.setBackground(colorBackground);
    Border line = new LineBorder(colorForeground);
    Border margin = new EmptyBorder(5, 15, 5, 15);
    Border compound = new CompoundBorder(line, margin);
    submit.setBorder(compound);
    submit.setAlignmentX(Component.CENTER_ALIGNMENT);
    return submit;
}
 
Example 9
Source Project: netbeans   Source File: DetailsPanel.java    License: Apache License 2.0 6 votes vote down vote up
private void initComponents2() {
    header = new HeaderPanel();
    title = header.getTitle();
    button = header.getButton();
    button2 = header.getButton2();
    Border outsideBorder = BorderFactory.createMatteBorder(0, 0, 1, 0, Color.gray);        
    Border insideBorder = BorderFactory.createEmptyBorder(3, 3, 3, 3);
    CompoundBorder compoundBorder = BorderFactory.createCompoundBorder(outsideBorder, insideBorder);
    header.setBorder(compoundBorder);
    button.setVisible(false);
    button2.setVisible(false);        
    rightCornerHeader  = new JPanel();        
    rightCornerHeader.setBorder(compoundBorder);
    
    Color headerBgColor = UnitTable.getDarkerColor(getBackground());
    header.setBackground(headerBgColor);
    if (button != null) {
        button.setOpaque(false);
    }
    if (button2 != null) {
        button2.setOpaque(false);
    }        
    rightCornerHeader.setBackground(headerBgColor);
    setBorder(BorderFactory.createEmptyBorder(3, 3, 0, 0));
}
 
Example 10
Source Project: netbeans   Source File: OptionsPanel.java    License: Apache License 2.0 6 votes vote down vote up
void setHighlighted() {
    if (!isMac) {
        setBorder(new CompoundBorder(
                new CompoundBorder(
                new LineBorder(getTabPanelBackground()),
                new LineBorder(highlightedB)
                ),
                new EmptyBorder(0, 2, 0, 2)
                ));
        setBackground(highlighted);
    }
    if (!category.isHighlited()) {
        if (categoryModel.getHighlitedCategoryID() != null) {
            CategoryButton b = buttons.get(categoryModel.getHighlitedCategoryID());
            if (b != null && !b.category.isCurrent()) {
                b.setNormal();
            }
        }
        categoryModel.setHighlited(category,true);
    }
}
 
Example 11
Source Project: netbeans   Source File: BorderBuilders.java    License: Apache License 2.0 6 votes vote down vote up
static BorderBuilder fromField(Instance instance, String field, boolean uiresource, Heap heap) {
    Object _border = instance.getValueOfField(field);
    if (!(_border instanceof Instance)) return null;

    Instance border = (Instance)_border;

    // Make sure subclasses are listed before base class if using isSubclassOf
    if (DetailsUtils.isSubclassOf(border, BevelBorder.class.getName())) {
        return new BevelBorderBuilder(border, heap);
    } else if (DetailsUtils.isSubclassOf(border, MatteBorder.class.getName())) { // Must be before EmptyBorder (extends EmptyBorder)
        return new EmptyBorderBuilder(border, heap);
    } else if (DetailsUtils.isSubclassOf(border, EmptyBorder.class.getName())) {
        return new MatteBorderBuilder(border, heap);
    } else if (DetailsUtils.isSubclassOf(border, EtchedBorder.class.getName())) {
        return new EtchedBorderBuilder(border, heap);
    } else if (DetailsUtils.isSubclassOf(border, LineBorder.class.getName())) {
        return new LineBorderBuilder(border, heap);
    } else if (DetailsUtils.isSubclassOf(border, TitledBorder.class.getName())) {
        return new TitledBorderBuilder(border, heap);
    } else if (DetailsUtils.isSubclassOf(border, CompoundBorder.class.getName())) {
        return new CompoundBorderBuilder(border, heap);
    }

    return null;
}
 
Example 12
Source Project: netbeans   Source File: ParametersPanel.java    License: Apache License 2.0 6 votes vote down vote up
private void showProblem(Problem problem) {
    if(dialog == null) {
        return;
    }
    if (problem == null) {
        label.setText(" "); // NOI18N
        innerPanel.setBorder(null);
        next.setEnabled(!isPreviewRequired());
        previewButton.setEnabled(true);
        return;
    }
    innerPanel.setBorder(new CompoundBorder(new javax.swing.border.LineBorder(java.awt.Color.gray),
                         new EmptyBorder(0, 2, 2, 2)));
    progressPanel.setVisible(true);
    if (problem.isFatal()) {
        displayError(problem.getMessage());
    } else {
        displayWarning(problem.getMessage());
    }
    dialog.pack();
}
 
Example 13
Source Project: netbeans   Source File: ExitDialog.java    License: Apache License 2.0 6 votes vote down vote up
/** Constructs rest of dialog.
*/
private void draw () {
    list = new JList(listModel);
    list.setBorder(new EmptyBorder(2, 2, 2, 2));
    list.addListSelectionListener (new ListSelectionListener () {
        @Override
                                       public void valueChanged (ListSelectionEvent evt) {
                                           updateSaveButton ();
                                       }
                                   }
                                  );
    // bugfix 37941, select first item in list
    if (!listModel.isEmpty ()) {
        list.setSelectedIndex (0);
    } else {                              
        updateSaveButton ();
    }
    JScrollPane scroll = new JScrollPane (list);
    scroll.setBorder (new CompoundBorder (new EmptyBorder (12, 12, 11, 0), scroll.getBorder ()));
    add(scroll, BorderLayout.CENTER);
    list.setCellRenderer(new ExitDlgListCellRenderer());
    list.getAccessibleContext().setAccessibleName((NbBundle.getBundle(ExitDialog.class)).getString("ACSN_ListOfChangedFiles"));
    list.getAccessibleContext().setAccessibleDescription((NbBundle.getBundle(ExitDialog.class)).getString("ACSD_ListOfChangedFiles"));
    this.getAccessibleContext().setAccessibleDescription((NbBundle.getBundle(ExitDialog.class)).getString("ACSD_ExitDialog"));
}
 
Example 14
Source Project: netbeans   Source File: VersioningPanel.java    License: Apache License 2.0 6 votes vote down vote up
private void adjustToolbarComponentSize(JComponent button) {
    
    if (adjusted.contains(button)) return;
    
    // as we cannot get the button small enough using the margin and border...
    if (button.getBorder() instanceof CompoundBorder) { // from BasicLookAndFeel
        Dimension pref = button.getPreferredSize();
        
        // XXX #41827 workaround w2k, that adds eclipsis (...) instead of actual text
        if ("Windows".equals(UIManager.getLookAndFeel().getID())) {  // NOI18N
            pref.width += 9;
        }
        button.setPreferredSize(pref);
    }
    
    adjusted.add(button);
}
 
Example 15
Source Project: pumpernickel   Source File: QComboBoxUI.java    License: MIT License 6 votes vote down vote up
@Override
public void installUI(JComponent c) {
	super.installUI(c);

	// an unpleasant quirk of the BasicComboBoxUI:
	// the background is always used for the renderer.
	// if we set the background to a transparent color
	// then we get the expected results.
	comboBox.setBackground(new Color(0, 0, 0, 0));
	comboBox.setOpaque(false);

	// add some left padding because when you click an item: the popup is
	// much wider than the original JComboBox because it includes a
	// checkmark. The popup will still jut out to the left of the popup a
	// little bit, but with this offset it's a little less conspicuous
	comboBox.setBorder(new CompoundBorder(buttonUI
			.createBackground(comboBox), new EmptyBorder(0, 8, 0, 0)));

	// this can't be called in installListeners because arrowButton is not
	// initialized there
	arrowButton.getModel()
			.addChangeListener(arrowButtonModelChangeListener);

	comboBox.setRenderer(new QComboBoxRenderer(this));
	refreshButtonState();
}
 
Example 16
Source Project: plugins   Source File: VarInspector.java    License: GNU General Public License v3.0 5 votes vote down vote up
private void addVarLog(VarType type, String name, String old, String neew)
{
	if (!type.getCheckBox().isSelected())
	{
		return;
	}

	int tick = client.getTickCount();
	SwingUtilities.invokeLater(() ->
	{
		if (tick != lastTick)
		{
			lastTick = tick;
			JLabel header = new JLabel("Tick " + tick);
			header.setFont(FontManager.getRunescapeSmallFont());
			header.setBorder(new CompoundBorder(
				BorderFactory.createMatteBorder(0, 0, 1, 0, ColorScheme.LIGHT_GRAY_COLOR),
				BorderFactory.createEmptyBorder(3, 6, 0, 0)
			));
			tracker.add(header);
		}
		tracker.add(new JLabel(String.format("%s %s changed: %s -> %s", type.getName(), name, old, neew)));

		// Cull very old stuff
		while (tracker.getComponentCount() > MAX_LOG_ENTRIES)
		{
			tracker.remove(0);
		}

		tracker.revalidate();
	});
}
 
Example 17
Source Project: darklaf   Source File: InternalFrameDemo.java    License: MIT License 5 votes vote down vote up
@Override
public JComponent createComponent() {
    desktop = new JDesktopPane();
    JPanel panel = new JPanel();
    panel.setBorder(new CompoundBorder(new EmptyBorder(20, 20, 20, 20),
                                       DarkBorders.createLineBorder(1, 1, 1, 1)));
    panel.setLayout(new BorderLayout());
    panel.add(desktop, BorderLayout.CENTER);

    createFrame();

    desktop.setDragMode(JDesktopPane.LIVE_DRAG_MODE);
    return new DemoPanel(desktop, new BorderLayout(), 10);
}
 
Example 18
Source Project: MercuryTrade   Source File: ComponentsFactory.java    License: MIT License 5 votes vote down vote up
/**
 * Get label with custom params
 *
 * @param fontStyle path of exile font type
 * @param frColor   foreground color
 * @param alignment font alignment
 * @param size      font size
 * @param text      initial text on font
 * @return JLabel object
 */
public JLabel getTextLabel(FontStyle fontStyle, Color frColor, TextAlignment alignment, float size, String text) {
    JLabel label = new JLabel(text);
    if (isAscii(text)) {
        label.setFont(getSelectedFont(fontStyle).deriveFont(scale * size));
    } else {
        label.setFont(DEFAULT_FONT.deriveFont(scale * size));
    }
    label.setForeground(frColor);
    Border border = label.getBorder();
    label.setBorder(new CompoundBorder(border, new EmptyBorder(0, 5, 0, 5)));

    if (alignment != null) {
        switch (alignment) {
            case LEFTOP: {
                label.setAlignmentX(Component.LEFT_ALIGNMENT);
                label.setAlignmentY(Component.TOP_ALIGNMENT);
            }
            break;
            case RIGHTOP: {
                label.setAlignmentX(Component.RIGHT_ALIGNMENT);
                label.setAlignmentY(Component.TOP_ALIGNMENT);
            }
            case CENTER: {
                label.setAlignmentX(Component.CENTER_ALIGNMENT);
                label.setAlignmentY(Component.TOP_ALIGNMENT);
            }
            break;
        }
    }
    return label;
}
 
Example 19
Source Project: ghidra   Source File: ColumnFilterDialog.java    License: Apache License 2.0 5 votes vote down vote up
private JComponent buildHeaderPanel() {
	JPanel headerPanel = new JPanel(new FilterPanelLayout(200, 0));

	headerPanel.add(new GLabel("Table Column", SwingConstants.CENTER));
	headerPanel.add(new GLabel("Filter", SwingConstants.CENTER));
	headerPanel.add(new GLabel("Filter Value", SwingConstants.CENTER));

	headerPanel.setBorder(new CompoundBorder(
		BorderFactory.createMatteBorder(0, 0, 1, 0, Color.DARK_GRAY.brighter().brighter()),
		BorderFactory.createEmptyBorder(4, 0, 4, 0)));
	return headerPanel;
}
 
Example 20
Source Project: MercuryTrade   Source File: ComponentsFactory.java    License: MIT License 5 votes vote down vote up
public JButton getBorderedButton(String text, float fontSize) {
    CompoundBorder compoundBorder = BorderFactory.createCompoundBorder(
            BorderFactory.createLineBorder(AppThemeColor.BORDER, 1),
            BorderFactory.createLineBorder(AppThemeColor.BUTTON, 3)
    );
    return getButton(FontStyle.BOLD, AppThemeColor.BUTTON, compoundBorder, text, scale * fontSize);
}
 
Example 21
Source Project: portecle   Source File: FPortecle.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initialize FPortecle frame's status bar GUI components.
 */
private void initStatusBar()
{
	m_jlStatusBar = new JLabel();

	m_jlStatusBar.setBorder(new CompoundBorder(new EmptyBorder(3, 3, 3, 3),
	    new CompoundBorder(new BevelBorder(BevelBorder.LOWERED), new EmptyBorder(0, 2, 0, 2))));
	setDefaultStatusBarText();

	getContentPane().add(m_jlStatusBar, BorderLayout.SOUTH);
}
 
Example 22
Source Project: MercuryTrade   Source File: ComponentsFactory.java    License: MIT License 5 votes vote down vote up
/**
 * Get bordered button with default properties.
 *
 * @param text text on button
 * @return Default bordered app button
 */
public JButton getBorderedButton(String text) {
    CompoundBorder compoundBorder = BorderFactory.createCompoundBorder(
            BorderFactory.createLineBorder(AppThemeColor.BORDER, 1),
            BorderFactory.createLineBorder(AppThemeColor.BUTTON, 3)
    );
    return getButton(FontStyle.BOLD, AppThemeColor.BUTTON, compoundBorder, text, scale * 14f);
}
 
Example 23
Source Project: littleluck   Source File: TableDemo.java    License: Apache License 2.0 5 votes vote down vote up
private void showCredits() {
    credits = new JLabel(getString("TableDemo.credits",
            "<html><p align=\"center\">Academy Award data<br>courtesy of Howard Katz</p></html>"));
    credits.setFont(UIManager.getFont("Table.font").deriveFont(24f));
    credits.setHorizontalAlignment(JLabel.CENTER);
    credits.setBorder(new CompoundBorder(new TitledBorder(""),
            new EmptyBorder(20,20,20,20)));
    dataPanel.showMessageLayer(credits, .75f);
}
 
Example 24
Source Project: jdk8u60   Source File: Test8039750.java    License: GNU General Public License v2.0 5 votes vote down vote up
private static void test(Object value, String one, String two) {
    if (value instanceof CompoundBorder) {
        CompoundBorder border = (CompoundBorder) value;
        test(border.getOutsideBorder(), one);
        test(border.getInsideBorder(), two);
    } else {
        throw new Error("CompoundBorder");
    }
}
 
Example 25
Source Project: nanoleaf-desktop   Source File: DiscoveryCellRenderer.java    License: MIT License 5 votes vote down vote up
public DiscoveryCellRenderer()
{
	setOpaque(true);
	setBorder(new CompoundBorder(
			new LineBorder(java.awt.Color.GRAY, 1),
			new EmptyBorder(0, 0, 10, 0)));
	setVerticalTextPosition(JLabel.BOTTOM);
	setHorizontalTextPosition(JLabel.CENTER);
	setIconTextGap(10);
	setFont(new Font("Tahoma", Font.PLAIN, 22));
	setForeground(java.awt.Color.WHITE);
}
 
Example 26
Source Project: opsu-dance   Source File: ErrorHandler.java    License: GNU General Public License v3.0 5 votes vote down vote up
private static JTextArea readonlyTextarea(String contents)
{
	JTextArea textArea = new JTextArea(15, 80);
	textArea.setEditable(false);
	textArea.setBackground(UIManager.getColor("Panel.background"));
	textArea.setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
	textArea.setTabSize(2);
	textArea.setLineWrap(false);
	textArea.setWrapStyleWord(true);
	textArea.setFont(new JLabel().getFont());
	textArea.setText(contents);
	final EmptyBorder padding = new EmptyBorder(5, 5, 5, 5);
	textArea.setBorder(new CompoundBorder(textArea.getBorder(), padding));
	return textArea;
}
 
Example 27
Source Project: dctb-utfpr-2018-1   Source File: SignIn.java    License: Apache License 2.0 5 votes vote down vote up
public JButton styleButtons(){
    JButton submit = new JButton();
    Color colorForeground = new Color(0x8D8D8D);
    Color colorBackground = new Color(0xF1F1F1);
    submit.setForeground(colorForeground);
    submit.setBackground(colorBackground);
    Border line = new LineBorder(colorForeground);
    Border margin = new EmptyBorder(5, 15, 5, 15);
    Border compound = new CompoundBorder(line, margin);
    submit.setBorder(compound);
    submit.setAlignmentX(Component.CENTER_ALIGNMENT);
    return submit;
}
 
Example 28
Source Project: dctb-utfpr-2018-1   Source File: SignIn.java    License: Apache License 2.0 5 votes vote down vote up
public JButton styleButtons(){
    JButton submit = new JButton();
    Color colorForeground = new Color(0x8D8D8D);
    Color colorBackground = new Color(0xF1F1F1);
    submit.setForeground(colorForeground);
    submit.setBackground(colorBackground);
    Border line = new LineBorder(colorForeground);
    Border margin = new EmptyBorder(5, 15, 5, 15);
    Border compound = new CompoundBorder(line, margin);
    submit.setBorder(compound);
    submit.setAlignmentX(Component.CENTER_ALIGNMENT);
    return submit;
}
 
Example 29
public BannerPanel() {
  setBorder(
    new CompoundBorder(new EtchedBorder(), LookAndFeelTweaks.PANEL_BORDER));

  setOpaque(true);
  setBackground(UIManager.getColor("Table.background"));

  titleLabel = new JLabel();
  titleLabel.setOpaque(false);

  subtitleLabel = new JEditorPane("text/html", "<html>");
  subtitleLabel.setFont(titleLabel.getFont());

  LookAndFeelTweaks.makeBold(titleLabel);
  LookAndFeelTweaks.makeMultilineLabel(subtitleLabel);
  LookAndFeelTweaks.htmlize(subtitleLabel);

  iconLabel = new JLabel();
  iconLabel.setPreferredSize(new Dimension(50, 50));

  setLayout(new BorderLayout());

  JPanel nestedPane = new JPanel(new BorderLayout());
  nestedPane.setOpaque(false);
  nestedPane.add("North", titleLabel);
  nestedPane.add("Center", subtitleLabel);
  add("Center", nestedPane);
  add("East", iconLabel);
}
 
Example 30
Source Project: netbeans   Source File: CompoundBorderBeanInfo.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected PropertyDescriptor[] createPropertyDescriptors() throws IntrospectionException {
    return new PropertyDescriptor[] {
        createRO(CompoundBorder.class, "outsideBorder"), // NOI18N
        createRO(CompoundBorder.class, "insideBorder"), // NOI18N
    };
}