List of usage examples for javax.swing JComponent setBorder
@BeanProperty(preferred = true, visualUpdate = true, description = "The component's border.") public void setBorder(Border border)
From source file:pcgen.gui2.tabs.SummaryInfoTab.java
private static void setPanelTitle(JComponent panel, String title) { panel.setBorder( BorderFactory.createTitledBorder(null, title, TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION)); }
From source file:pcgen.gui2.tabs.SummaryInfoTab.java
private void highlightBorder(final JComponent comp) { final Border oldBorder = comp.getBorder(); Border highlightBorder = BorderFactory.createLineBorder(Color.GREEN, 3); comp.setBorder(highlightBorder); SwingUtilities.invokeLater(() -> { try {//w w w .ja v a2 s . c om Thread.sleep(500); } catch (InterruptedException e) { // Ignored as we'll exit shortly anyway. } comp.setBorder(oldBorder); }); }
From source file:shuffle.fwk.service.teams.EditTeamService.java
private void setBorderFor(JComponent c, boolean isSelected, boolean haveSelect) { if (c != null) { ConfigManager manager = getUser().getPreferencesManager(); int borderThick = manager.getIntegerValue(KEY_ROSTER_CELL_BORDER_THICK, DEFAULT_BORDER_WIDTH); borderThick = getUser().scaleBorderThickness(borderThick); int outlineThick = manager.getIntegerValue(KEY_ROSTER_CELL_OUTLINE_THICK, DEFAULT_BORDER_OUTLINE); outlineThick = getUser().scaleBorderThickness(outlineThick); int marginThick = manager.getIntegerValue(KEY_ROSTER_CELL_MARGIN_THICK, DEFAULT_BORDER_MARGIN); marginThick = getUser().scaleBorderThickness(marginThick); Border margin = new EmptyBorder(marginThick, marginThick, marginThick, marginThick); Border greyOutline = new LineBorder(Color.gray, outlineThick); Border innerChunk = BorderFactory.createCompoundBorder(greyOutline, margin); Border toSet;/*from w w w.j a va 2 s . c om*/ if (haveSelect) { Border main; if (isSelected) { main = new LineBorder(Color.BLACK, borderThick); } else { main = new EmptyBorder(borderThick, borderThick, borderThick, borderThick); } Border outerChunk = BorderFactory.createCompoundBorder(main, margin); Border finalBorder = BorderFactory.createCompoundBorder(outerChunk, innerChunk); toSet = finalBorder; } else { toSet = innerChunk; } c.setBorder(toSet); } }