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; }
public Insets getInsets() { 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 { result = b.getBorderInsets(this); } return result; }
public Insets getInsets() { 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 { result = b.getBorderInsets(this); } return result; }