List of utility methods to do Swing TitledBorder
Border | createGroupBorder(String title) create Group Border return new TitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), title, TitledBorder.LEFT, TitledBorder.TOP); |
Border | createGuiElementBorder(final String title) This method creates a titled border (used for structuring of GUI elements). final Border titledBorder = BorderFactory.createTitledBorder( BorderFactory.createMatteBorder(1, 1, 1, 1, Color.gray), title, TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION); final Border emptyBoder = BorderFactory.createEmptyBorder(0, 2, 0, 2); return BorderFactory.createCompoundBorder(titledBorder, emptyBoder); |
Border | createInsetTitledBorder(String title) create Inset Titled Border return BorderFactory.createCompoundBorder( new TitledBorder(BorderFactory.createLineBorder(Color.DARK_GRAY, 2), title, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, BORDER_FONT), BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
Border | createStyleAttributeBorder(String title) create Style Attribute Border Border outer = BorderFactory.createTitledBorder(title);
Border inner = BorderFactory.createEmptyBorder(10, 10, 10, 10);
return BorderFactory.createCompoundBorder(outer, inner);
|
Border | createTitleBorder(final String title) create Title Border final Border tb = BorderFactory.createTitledBorder(title); final Border eb = BorderFactory.createEmptyBorder(0, 5, 5, 5); return BorderFactory.createCompoundBorder(tb, eb); |
Border | createTitledBorder(final String title) create Titled Border final Border border; if (title == null || title.trim().isEmpty()) { final Border aquaBorder = isAquaLAF() ? UIManager.getBorder("InsetBorder.aquaVariant") : null; border = aquaBorder != null ? aquaBorder : BorderFactory.createTitledBorder("SAMPLE").getBorder(); } else { final Border aquaBorder = isAquaLAF() ? UIManager.getBorder("TitledBorder.aquaVariant") : null; final TitledBorder tb = aquaBorder != null ? BorderFactory.createTitledBorder(aquaBorder, title) : BorderFactory.createTitledBorder(title); ... |
Border | createTitledBorder(String label) create Titled Border TitledBorder border = BorderFactory.createTitledBorder(lineBorder, label);
border.setTitleFont(borderFont);
return border;
|
Border | createTitledBorder(String name) Create Titled Border Border margin = BorderFactory.createEmptyBorder(10, 10, 10, 10);
Border title = BorderFactory.createTitledBorder(name);
return BorderFactory.createCompoundBorder(title, margin);
|
TitledBorder | createTitledBorder(String title) This method creates and returns a border. return createTitledBorder(title, true);
|
TitledBorder | createTitledBorder(String title) Creates a Titled Border with appropriate font settings. TitledBorder border = new TitledBorder(title); Font font = border.getTitleFont(); Font newFont = new Font(font.getFamily(), Font.BOLD, font.getSize() + 2); border.setTitleFont(newFont); border.setTitleColor(new Color(102, 51, 51)); return border; |