public @Override Insets getInsets(Insets insets) { Insets result; //Call getBorder(), not just read the field - if swingRendering, the border will be constructed, and the //insets are what will make the indent property work; HtmlLabelUI doesn't need this, it just reads the //insets property, but BasicLabelUI and its ilk do Border b = getBorder(); if (b == null) { result = EMPTY_INSETS; } else { //workaround for open jdk bug, see issue #192388 try { result = b.getBorderInsets(this); } catch( NullPointerException e ) { Logger.getLogger(HtmlRendererImpl.class.getName()).log(Level.FINE, null, e); result = EMPTY_INSETS; } } if( null != insets ) { insets.set( result.top, result.left, result.bottom, result.right); return insets; } return result; }
@Override public Insets getBorderInsets(Component c, Insets insets) { insets.set(2, 2, 2, 0); return insets; } }
@Override public Insets getBorderInsets(Component component, Insets insets) { insets.set(0, 0, 0, 0); return insets; }
@Override public Insets getBorderInsets(final Component c, final Insets newInsets) { newInsets.set(verticalPadding, 2, verticalPadding, 2); return newInsets; } }
@SuppressWarnings({"WeakerAccess"}) public static Insets getDefaultInsets(Rectangle bounds, Insets insets) { int wi = bounds.height <= 100 ? SMALL_BORDER : LARGE_BORDER; int hi = bounds.width <= 100 ? SMALL_BORDER : LARGE_BORDER; insets.set(hi, wi, hi, wi); return insets; }
public Insets getBorderInsets(Component c, Insets insets) { insets.set(thickness, 0, 0, 0); return insets; } }
@Override public Insets getBorderInsets(Component c, Insets insets) { insets.set(4, 8, 4, 8); return insets; } }
public EasyGBC noInsets() { insets.set(0, 0, 0, 0); return this; }
@Override public Insets getBorderInsets(Component c, Insets insets) { insets.set(topSpace, leftSpace, borderWidth, borderWidth); return insets; }
public EasyGBC reset() { gridx = 0; gridy = 0; gridwidth = 1; gridheight = 1; weightx = 0.0; weighty = 0.0; fill = GridBagConstraints.NONE; insets.set(0, 0, 0, 0); return this; }
@Override public Insets getBorderInsets( Component c, Insets insets ) { insets.set( _margin.top, _margin.left, _margin.bottom, _margin.right ); return insets; } }
@Override public void defaultConstraints() { c.anchor = GridBagConstraints.LINE_START; c.fill = GridBagConstraints.HORIZONTAL; c.insets.set( 2, 1, 2, 1 ); }
public EasyGBC insets(int t, int l, int b, int r) { insets.set(t, l, b, r); return this; }
/** * Set text insets. These insets are used to offset the text from the * border lines. * * @param insets Text insets. */ public void setTextInsets( @NotNull final Insets insets ) { _textInsets.set( insets.top, insets.left, insets.bottom, insets.right ); }
@Override protected Insets doGetBorderInsets(Component c, Insets insets) { Insets result = origBorder.getBorderInsets(c); insets.set(result.top, result.left, result.bottom, result.right); return insets; }
@Override public Insets getInsets( final Insets insets ) { final Insets result = super.getInsets( insets ); if ( _image == null ) { result.set( 0, 0, 0, 0 ); } return result; }
private void setupButtons() { launchSCSButton = new JButton("Launch SCS"); launchUIButton = new JButton("Launch UI"); c.insets.set(0, 0, 0, 0); c.anchor = GridBagConstraints.CENTER; c.fill = GridBagConstraints.BOTH; c.weightx = 1.0; c.ipady = 20; c.gridy++; this.add(launchUIButton, c); c.gridy++; this.add(launchSCSButton, c); } }
@Override public Insets getInsets(Insets insets) { final NodeView nodeView = getNodeView(); int edgeWidth = nodeView.getEdgeWidth(); edgeWidth = Math.round(getUnzoomedBorderWidth()); if(insets == null) insets = new Insets(0, 2, edgeWidth, 2); else insets.set(0, 2, edgeWidth, 2); return insets; } private final static int SINGLE_CHILD_SHIFT = -2;
private void reload() { GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.weightx = 1.0; gbc.fill = GridBagConstraints.BOTH; gbc.insets.set(2, 2, 2, 2); this.contentPanel.removeAll(); for (ModCard card : this.cards) { boolean show = true; if (!this.searchField.getText().isEmpty()) { if (!Pattern.compile(Pattern.quote(this.searchField.getText()), Pattern.CASE_INSENSITIVE).matcher (card.mod.getName()).find()) { show = false; } } if (show) { this.contentPanel.add(card, gbc); gbc.gridy++; } } revalidate(); repaint(); } }