@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; }