@Override public Dimension getPreferredSize() { Graphics g = PropUtils.getScratchGraphics(this); String s = getText(); if (s.length() > 1000) { //IZ 44152, debugger can return 512K+ long strings return new Dimension(4196, g.getFontMetrics(getFont()).getHeight()); } FontMetrics fm = g.getFontMetrics(getFont()); Dimension result = new Dimension(fm.stringWidth(s), fm.getHeight()); result.width = Math.max(result.width, PropUtils.getMinimumPropPanelWidth()); result.height = Math.max(result.height, PropUtils.getMinimumPropPanelHeight()); if (getBorder() != null) { Insets i = getBorder().getBorderInsets(this); result.width += (i.right + i.left); result.height += (i.top + i.bottom); } return result; }
public Dimension getPreferredSize() { Graphics g = PropUtils.getScratchGraphics(this); String s = getText(); if (s.length() > 1000) { //IZ 44152, debugger can return 512K+ long strings return new Dimension (4196, g.getFontMetrics(getFont()).getHeight()); } FontMetrics fm = g.getFontMetrics(getFont()); Dimension result = new Dimension(fm.stringWidth(s), fm.getHeight()); result.width = Math.max (result.width, PropUtils.getMinimumPropPanelWidth()); result.height = Math.max (result.height, PropUtils.getMinimumPropPanelHeight()); if (getBorder() != null) { Insets i = getBorder().getBorderInsets(this); result.width += i.right+i.left; result.height += i.top+i.bottom; } return result; }
public Dimension getPreferredSize() { Graphics g = PropUtils.getScratchGraphics(this); String s = getText(); if (s.length() > 1000) { //IZ 44152, debugger can return 512K+ long strings return new Dimension (4196, g.getFontMetrics(getFont()).getHeight()); } FontMetrics fm = g.getFontMetrics(getFont()); Dimension result = new Dimension(fm.stringWidth(s), fm.getHeight()); result.width = Math.max (result.width, PropUtils.getMinimumPropPanelWidth()); result.height = Math.max (result.height, PropUtils.getMinimumPropPanelHeight()); if (getBorder() != null) { Insets i = getBorder().getBorderInsets(this); result.width += i.right+i.left; result.height += i.top+i.bottom; } return result; }
public Dimension getPreferredSize() { int w = 0; int h = 0; Graphics g = PropUtils.getScratchGraphics(this); FontMetrics fm = g.getFontMetrics(getFont()); if (getIcon() != null) { w = getIcon().getIconWidth(); h = getIcon().getIconHeight(); } if (getBorder() != null) { Insets ins = getBorder().getBorderInsets(this); w+=ins.left + ins.right; h+=ins.bottom+ins.top; } w += fm.stringWidth(getText()) + 22; h = Math.max(fm.getHeight(), h) + 2; return new Dimension(w,h); } }
public Dimension getPreferredSize() { int w = 0; int h = 0; Graphics g = PropUtils.getScratchGraphics(this); FontMetrics fm = g.getFontMetrics(getFont()); if (getIcon() != null) { w = getIcon().getIconWidth(); h = getIcon().getIconHeight(); } if (getBorder() != null) { Insets ins = getBorder().getBorderInsets(this); w += (ins.left + ins.right); h += (ins.bottom + ins.top); } w += (fm.stringWidth(getText()) + 22); h = Math.max(fm.getHeight(), h) + 2; return new Dimension(w, h); } }
public Dimension getPreferredSize() { int w = 0; int h = 0; Graphics g = PropUtils.getScratchGraphics(this); FontMetrics fm = g.getFontMetrics(getFont()); if (getIcon() != null) { w = getIcon().getIconWidth(); h = getIcon().getIconHeight(); } if (getBorder() != null) { Insets ins = getBorder().getBorderInsets(this); w+=ins.left + ins.right; h+=ins.bottom+ins.top; } w += fm.stringWidth(getText()) + 22; h = Math.max(fm.getHeight(), h) + 2; return new Dimension(w,h); } }
Graphics g = PropUtils.getScratchGraphics(this); g.setFont(getFont());
Graphics g = PropUtils.getScratchGraphics(this); g.setFont(getFont()); String txt = getText();
Graphics g = PropUtils.getScratchGraphics(this); g.setFont(getFont()); String txt = getText();