@Override public Object getValue() { if ((valFromTextField != null) && valFromTextField.equals(getText())) { //#47430 - JTextField will strip \n's from edited text. If no //change to the text field value, return what we originally got return null == valFromEditor ? "" : valFromEditor; } else { return getText(); } }
@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; }
@Override public void reset() { String txt; txt = editor.getAsText(); //don't want an editor with the text "different values" in it //NOI18N if (editor instanceof PropUtils.DifferentValuesEditor) { txt = ""; //NOI18N } valFromEditor = txt; //issue 26367, form editor needs ability to set a custom value //when editing is initiated (event handler combos, part of them //cleaning up their EnhancedPropertyEditors). if ((getClass() == StringInplaceEditor.class) && (env != null) && (env.getFeatureDescriptor() != null)) { String initialEditValue = (String) env.getFeatureDescriptor().getValue("initialEditValue"); //NOI18N if (initialEditValue != null) { txt = initialEditValue; valFromEditor = txt; } } if (txt == null) { txt = ""; } setText(txt); valFromTextField = getText(); setSelectionStart(0); setSelectionEnd(txt.length()); }
valFromTextField = getText(); setSelectionStart (0); setSelectionEnd(txt.length());
valFromTextField = getText(); setSelectionStart (0); setSelectionEnd(txt.length());