List of utility methods to do Swing Border
void | paintBorderDebugInfo(final Graphics g, final JComponent c) Paints border debug information. paintBorderDebugInfo(g, c, Color.RED); |
void | removePopupBorder(final Container c) remove Popup Border EventQueue.invokeLater(() -> { Container p = c; while (p != null) { if (p instanceof JComponent) { ((JComponent) p).setBorder(null); p = p.getParent(); }); |
void | repaintBorder(JComponent component) repaint Border JComponent c = component; Border border = null; Container container = component.getParent(); if (container instanceof JViewport) { c = (JComponent) container.getParent(); if (c != null) { border = c.getBorder(); if (border == null) { border = component.getBorder(); c = component; if (border != null && c != null) { int w = c.getWidth(); int h = c.getHeight(); Insets insets = c.getInsets(); c.repaint(0, 0, w, insets.top); c.repaint(0, insets.top, insets.left, h - insets.bottom - insets.top); c.repaint(0, h - insets.bottom, w, insets.bottom); c.repaint(w - insets.right, insets.top, insets.right, h - insets.bottom - insets.top); |
void | repaintBorder(JComponent component) repaint Border JComponent c = component; Border border = null; Container container = component.getParent(); if (container instanceof JViewport) { c = (JComponent) container.getParent(); if (c != null) { border = c.getBorder(); if (border == null) { border = component.getBorder(); c = component; if (border != null && c != null) { int w = c.getWidth(); int h = c.getHeight(); Insets insets = c.getInsets(); c.repaint(0, 0, w, insets.top); c.repaint(0, 0, insets.left, h); c.repaint(0, h - insets.bottom, w, insets.bottom); c.repaint(w - insets.right, 0, insets.right, h); |
void | setBorder(Border b, JComponent... components) Set the border of the given components. for (JComponent c : components) {
c.setBorder(b);
|
JComponent | setBorder(JComponent comp, boolean setBorder, Color col) set Border Border redline = BorderFactory.createLineBorder(col); Border raisedbevel = BorderFactory.createRaisedBevelBorder(); Border loweredbevel = BorderFactory.createLoweredBevelBorder(); Border compound1 = BorderFactory.createCompoundBorder(raisedbevel, loweredbevel); Border compound2 = BorderFactory.createCompoundBorder(redline, compound1); if (setBorder) comp.setBorder(compound2); else ... |
void | setBorder(JComponent comp, Border border) Sets the border in a given component. if (comp.getBorder() != null) { comp.setBorder(BorderFactory.createCompoundBorder(comp.getBorder(), border)); } else { comp.setBorder(border); |
void | setDebugBorder(final JComponent component) set Debug Border component.setBorder(BorderFactory.createDashedBorder(debugBorderPaint)); |
void | setDefaultComponentsTabOrder(Vector v) set Default Components Tab Order Object tmp; int i, j, c; for (i = 0, c = v.size(); i < c; i++) { for (j = i; j < c; j++) { if (i == j) continue; if (compareTabOrder((Component) v.elementAt(j), (Component) v.elementAt(i))) { tmp = v.elementAt(i); ... |
void | setViewportBorder(JScrollPane scrollPane, int vertical, int horizontal) set Viewport Border scrollPane.setViewportBorder(BorderFactory.createMatteBorder(vertical, horizontal, vertical, horizontal, scrollPane.getViewport().getView().getBackground())); |