List of utility methods to do Swing Border
JPanel | generatePanelWithoutBorder() generate Panel Without Border JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS)); return panel; |
Border | getDefaultBorder() get Default Border return new JTextField().getBorder(); |
Color | getDefaultBorderColour() Convenience method for consistent border colour. return UIManager.getColor("controlShadow"); |
Border | getTextFieldBorder() get Text Field Border return UIManager.getBorder("TextField.border"); |
Border | getToolTipBorder() Gets the toolTipBorder attribute of the TapUtils class return (Border) UIManager.get("ToolTip.border"); |
Shape | getWebBorderShape(final JComponent component, final int shadeWidth, final int round) get Web Border Shape if (round > 0) { return new RoundRectangle2D.Double(shadeWidth, shadeWidth, component.getWidth() - shadeWidth * 2 - 1, component.getHeight() - shadeWidth * 2 - 1, round * 2, round * 2); } else { return new Rectangle2D.Double(shadeWidth, shadeWidth, component.getWidth() - shadeWidth * 2 - 1, component.getHeight() - shadeWidth * 2 - 1); |
JPanel | initLineBorderPanel(Color color, Color lineColor) Creates a gridbag layout panel with a line border JPanel result = new JPanel(); result.setBackground(color); result.setBorder(new LineBorder(lineColor, 1)); result.setLayout(new GridBagLayout()); return result; |
void | installBorder(JComponent c, Border defaultBorder) install Border Border border = c.getBorder(); if (border == null || border instanceof UIResource) { c.setBorder(defaultBorder); |
boolean | isStandardBorder(Border b) is Standard Border if (b instanceof UIResource) { return true; while (b instanceof CompoundBorder) { b = ((CompoundBorder) b).getInsideBorder(); return (b instanceof UIResource); |
TitledBorder | makeTitledBorder(JComponent panel, String title, Color color) make Titled Border TitledBorder result = BorderFactory.createTitledBorder(
BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), title, TitledBorder.DEFAULT_JUSTIFICATION,
TitledBorder.DEFAULT_POSITION, null, color);
panel.setBorder(result);
return result;
|