List of utility methods to do Swing TitledBorder
Border | myBorder(String title) my Border return BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), title, TitledBorder.LEFT, TitledBorder.LEFT, fnt_label1, new Color(25, 25, 250)); |
void | setBoldTitledBorder(String title, JComponent p) Formats and sets the title border of the passed component. if (title == null) title = ""; if (p == null) return; TitledBorder border = new TitledBorder(title); border.setTitleFont(p.getFont().deriveFont(Font.BOLD)); p.setBorder(border); |
void | setBorder(Container panel, String title) set Border if (panel instanceof JPanel) { ((JPanel) panel).setBorder(BorderFactory.createTitledBorder(title)); |
void | setBorder(JComponent component, String text, int titleJustification) set Border component.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), text, titleJustification, TitledBorder.TOP)); |
void | setLabelBorder(String label, JComponent c) set Label Border TitledBorder b = new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED), label); b.setTitleColor(darkBlue); c.setBorder(b); |
void | setPanelBorder(final JPanel p, final String s) Set Border of JPanel. p.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(s), BorderFactory.createEmptyBorder(5, 5, 5, 5))); |
void | setTitleBorder(JComponent pane, String title) set Title Border if (title != null) { pane.setBorder( new TitledBorder(new LineBorder(Color.BLACK), title, TitledBorder.LEFT, TitledBorder.TOP)); } else { pane.setBorder(new LineBorder(Color.BLACK)); |
B | titledBorder(String title, B comp) titled Border comp.setBorder(BorderFactory.createTitledBorder(title));
return comp;
|
JPanel | withTitledBorder(String title, JComponent c) Place content within a titled border JPanel p = new JPanel(new GridLayout(1, 1)); p.setBorder(BorderFactory.createTitledBorder(title)); p.add(c); return p; |