java.awt.DefaultFocusTraversalPolicy#javax.swing.text.DefaultFormatterFactory源码实例Demo

下面列出了java.awt.DefaultFocusTraversalPolicy#javax.swing.text.DefaultFormatterFactory 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: gcs   文件: FeatureEditor.java
/**
 * @param amt The current {@link LeveledAmount}.
 * @param min The minimum value to allow.
 * @param max The maximum value to allow.
 * @return The {@link EditorField} that allows a {@link LeveledAmount} to be changed.
 */
protected EditorField addLeveledAmountField(LeveledAmount amt, int min, int max) {
    AbstractFormatter formatter;
    Object            value;
    Object            prototype;
    if (amt.isIntegerOnly()) {
        formatter = new IntegerFormatter(min, max, true);
        value = Integer.valueOf(amt.getIntegerAmount());
        prototype = Integer.valueOf(max);
    } else {
        formatter = new DoubleFormatter(min, max, true);
        value = Double.valueOf(amt.getAmount());
        prototype = Double.valueOf(max + 0.25);
    }
    EditorField field = new EditorField(new DefaultFormatterFactory(formatter), this, SwingConstants.LEFT, value, prototype, null);
    field.putClientProperty(LeveledAmount.class, amt);
    UIUtilities.setToPreferredSizeOnly(field);
    add(field);
    return field;
}
 
源代码2 项目: gcs   文件: ReactionBonusEditor.java
@Override
protected void rebuildSelf(FlexGrid grid, FlexRow right) {
    ReactionBonus bonus = (ReactionBonus) getFeature();
    FlexRow       row   = new FlexRow();
    row.add(addChangeBaseTypeCombo());
    LeveledAmount amount = bonus.getAmount();
    row.add(addLeveledAmountField(amount, -99999, 99999));
    row.add(addLeveledAmountCombo(amount, false));
    row.add(new FlexSpacer(0, 0, true, false));
    grid.add(row, 0, 0);

    row = new FlexRow();
    row.setInsets(new Insets(0, 20, 0, 0));

    DefaultFormatter formatter = new DefaultFormatter();
    formatter.setOverwriteMode(false);
    mSituationField = new EditorField(new DefaultFormatterFactory(formatter), this, SwingConstants.LEFT, bonus.getSituation(), null);
    add(mSituationField);
    row.add(mSituationField);
    row.add(new FlexSpacer(0, 0, true, false));
    grid.add(row, 1, 0);
}
 
源代码3 项目: gcs   文件: ContainedWeightReductionEditor.java
@Override
protected void rebuildSelf(FlexGrid grid, FlexRow right) {
    ContainedWeightReduction feature = (ContainedWeightReduction) getFeature();
    FlexRow                  row     = new FlexRow();
    row.add(addChangeBaseTypeCombo());
    EditorField field = new EditorField(new DefaultFormatterFactory(new WeightReductionFormatter()), (event) -> {
        EditorField source = (EditorField) event.getSource();
        if ("value".equals(event.getPropertyName())) {
            feature.setValue(source.getValue());
            notifyActionListeners();
        }
    }, SwingConstants.LEFT, feature.getValue(), new WeightValue(new Fixed6(999999999), getRow().getDataFile().defaultWeightUnits()), I18n.Text("Enter a weight or percentage, e.g. \"2 lb\" or \"5%\"."));
    UIUtilities.setToPreferredSizeOnly(field);
    add(field);
    row.add(field);
    row.add(new FlexSpacer(0, 0, true, false));
    grid.add(row, 0, 0);
}
 
public NumberPropertyEditor(Class type) {
  if (!Number.class.isAssignableFrom(type)) {
    throw new IllegalArgumentException("type must be a subclass of Number");
  }

  editor = new JFormattedTextField();
  this.type = type;
  ((JFormattedTextField)editor).setValue(getDefaultValue());
  ((JFormattedTextField)editor).setBorder(LookAndFeelTweaks.EMPTY_BORDER);

  // use a custom formatter to have numbers with up to 64 decimals
  NumberFormat format = NumberConverters.getDefaultFormat();

  ((JFormattedTextField) editor).setFormatterFactory(
      new DefaultFormatterFactory(new NumberFormatter(format))
  );
}
 
源代码5 项目: pcgen   文件: SkillInfoTab.java
private SkillRankSpinnerEditor(SkillRankSpinnerModel model)
{
	super(model);
	this.model = model;

	DefaultEditor editor = new DefaultEditor(spinner);
	NumberFormatter formatter = new NumberFormatter(new DecimalFormat("#0.#")); //$NON-NLS-1$
	formatter.setValueClass(Float.class);
	DefaultFormatterFactory factory = new DefaultFormatterFactory(formatter);

	JFormattedTextField ftf = editor.getTextField();
	ftf.setEditable(true);
	ftf.setFormatterFactory(factory);
	ftf.setHorizontalAlignment(SwingConstants.RIGHT);

	spinner.setEditor(editor);
}
 
源代码6 项目: CodenameOne   文件: NumberPropertyEditor.java
public NumberPropertyEditor(Class type) {
  if (!Number.class.isAssignableFrom(type)) {
    throw new IllegalArgumentException("type must be a subclass of Number");
  }

  editor = new JFormattedTextField();
  this.type = type;
  ((JFormattedTextField)editor).setValue(getDefaultValue());
  ((JFormattedTextField)editor).setBorder(LookAndFeelTweaks.EMPTY_BORDER);

  // use a custom formatter to have numbers with up to 64 decimals
  NumberFormat format = NumberConverters.getDefaultFormat();

  ((JFormattedTextField) editor).setFormatterFactory(
      new DefaultFormatterFactory(new NumberFormatter(format))
  );
}
 
源代码7 项目: java-swing-tips   文件: MainPanel.java
protected LocalDateTimeEditor(JSpinner spinner, String dateFormatPattern) {
  super(spinner);
  if (!(spinner.getModel() instanceof SpinnerLocalDateTimeModel)) {
    throw new IllegalArgumentException("model not a SpinnerLocalDateTimeModel");
  }
  dateTimeFormatter = DateTimeFormatter.ofPattern(dateFormatPattern);
  model = (SpinnerLocalDateTimeModel) spinner.getModel();
  DefaultFormatter formatter = new LocalDateTimeFormatter();

  EventQueue.invokeLater(() -> {
    formatter.setValueClass(LocalDateTime.class);
    JFormattedTextField ftf = getTextField();
    try {
      String maxString = formatter.valueToString(model.getStart());
      String minString = formatter.valueToString(model.getEnd());
      ftf.setColumns(Math.max(maxString.length(), minString.length()));
    } catch (ParseException ex) {
      // PENDING: hmuller
      ex.printStackTrace();
      UIManager.getLookAndFeel().provideErrorFeedback(ftf);
    }
    ftf.setHorizontalAlignment(SwingConstants.LEFT);
    ftf.setEditable(true);
    ftf.setFormatterFactory(new DefaultFormatterFactory(formatter));
  });
}
 
源代码8 项目: pcgen   文件: SkillInfoTab.java
private SkillRankSpinnerEditor(SkillRankSpinnerModel model)
{
	super(model);
	this.model = model;

	DefaultEditor editor = new DefaultEditor(spinner);
	NumberFormatter formatter = new NumberFormatter(new DecimalFormat("#0.#")); //$NON-NLS-1$
	formatter.setValueClass(Float.class);
	DefaultFormatterFactory factory = new DefaultFormatterFactory(formatter);

	JFormattedTextField ftf = editor.getTextField();
	ftf.setEditable(true);
	ftf.setFormatterFactory(factory);
	ftf.setHorizontalAlignment(SwingConstants.RIGHT);

	spinner.setEditor(editor);
}
 
源代码9 项目: consulo   文件: SingleIntegerFieldOptionsPanel.java
/**
 * Sets integer number format to JFormattedTextField instance,
 * sets value of JFormattedTextField instance to object's field value,
 * synchronizes object's field value with the value of JFormattedTextField instance.
 *
 * @param textField  JFormattedTextField instance
 * @param owner      an object whose field is synchronized with {@code textField}
 * @param property   object's field name for synchronization
 */
public static void setupIntegerFieldTrackingValue(final JFormattedTextField textField,
                                                  final InspectionProfileEntry owner,
                                                  final String property) {
    NumberFormat formatter = NumberFormat.getIntegerInstance();
    formatter.setParseIntegerOnly(true);
    textField.setFormatterFactory(new DefaultFormatterFactory(new NumberFormatter(formatter)));
    textField.setValue(getPropertyValue(owner, property));
    final Document document = textField.getDocument();
    document.addDocumentListener(new DocumentAdapter() {
        @Override
        public void textChanged(DocumentEvent e) {
            try {
                textField.commitEdit();
                setPropertyValue(owner, property,
                        ((Number) textField.getValue()).intValue());
            } catch (ParseException e1) {
                // No luck this time
            }
        }
    });
}
 
源代码10 项目: atdl4j   文件: SwingNullableSpinner.java
private NumberEditorNull(JSpinner spinner, DecimalFormat format) {
	super(spinner);
	if (!(spinner.getModel() instanceof SpinnerNumberModelNull)) {
		return;
	}
	
	SpinnerNumberModelNull model = (SpinnerNumberModelNull) spinner.getModel();
	NumberFormatter formatter = new NumberEditorFormatterNull(model, format);
	DefaultFormatterFactory factory = new DefaultFormatterFactory(formatter);
	JFormattedTextField ftf = getTextField();
	ftf.setEditable(true);
	ftf.setFormatterFactory(factory);
	ftf.setHorizontalAlignment(JTextField.RIGHT);
	
	try {
		String maxString = formatter.valueToString(model.getMinimum());
		String minString = formatter.valueToString(model.getMaximum());
		ftf.setColumns(Math.max(maxString.length(), minString.length()));
	}
	catch (ParseException e) {
		// TBD should throw a chained error here
	}
}
 
源代码11 项目: darklaf   文件: ColorValueFormatter.java
public static ColorValueFormatter init(final DarkColorModel model, final int index,
                                       final boolean hex, final JFormattedTextField text) {
    ColorValueFormatter formatter = new ColorValueFormatter(model, index, hex);
    formatter.setText(text);
    text.setFormatterFactory(new DefaultFormatterFactory(formatter));
    text.setMinimumSize(text.getPreferredSize());
    text.addFocusListener(formatter);
    return formatter;
}
 
源代码12 项目: jdk1.8-source-analysis   文件: ValueFormatter.java
static void init(int length, boolean hex, JFormattedTextField text) {
    ValueFormatter formatter = new ValueFormatter(length, hex);
    text.setColumns(length);
    text.setFormatterFactory(new DefaultFormatterFactory(formatter));
    text.setHorizontalAlignment(SwingConstants.RIGHT);
    text.setMinimumSize(text.getPreferredSize());
    text.addFocusListener(formatter);
}
 
源代码13 项目: dragonwell8_jdk   文件: ValueFormatter.java
static void init(int length, boolean hex, JFormattedTextField text) {
    ValueFormatter formatter = new ValueFormatter(length, hex);
    text.setColumns(length);
    text.setFormatterFactory(new DefaultFormatterFactory(formatter));
    text.setHorizontalAlignment(SwingConstants.RIGHT);
    text.setMinimumSize(text.getPreferredSize());
    text.addFocusListener(formatter);
}
 
源代码14 项目: ghidra   文件: AbstractTextFilter.java
private JComponent createComponent(String filterName) {
	final JPanel panel = new JPanel(new BorderLayout());
	Border paddingBorder = BorderFactory.createEmptyBorder(1, 5, 1, 5);
	Border outsideBorder = BorderFactory.createBevelBorder(BevelBorder.LOWERED);
	panel.setBorder(BorderFactory.createCompoundBorder(outsideBorder, paddingBorder));

	DefaultFormatterFactory factory = new DefaultFormatterFactory(new DefaultFormatter());
	textField = new FilterFormattedTextField(factory, defaultValue);
	textField.setName(filterName + " Field"); // for debugging 	
	textField.setColumns(20);
	textField.setMinimumSize(textField.getPreferredSize());

	// we handle updates in real time, so ignore focus events, which trigger excess filtering
	textField.disableFocusEventProcessing();

	JLabel label = new GDLabel(filterName + ": ");
	panel.add(label, BorderLayout.WEST);
	panel.add(textField, BorderLayout.CENTER);

	StatusLabel nameFieldStatusLabel = new StatusLabel(textField, defaultValue);
	textField.addFilterStatusListener(nameFieldStatusLabel);
	textField.addFilterStatusListener(status -> fireStatusChanged(status));

	final JLayeredPane layeredPane = new JLayeredPane();
	layeredPane.add(panel, BASE_COMPONENT_LAYER);
	layeredPane.add(nameFieldStatusLabel, HOVER_COMPONENT_LAYER);

	layeredPane.setPreferredSize(panel.getPreferredSize());
	layeredPane.addComponentListener(new ComponentAdapter() {
		@Override
		public void componentResized(java.awt.event.ComponentEvent e) {
			Dimension preferredSize = layeredPane.getSize();
			panel.setBounds(0, 0, preferredSize.width, preferredSize.height);
			panel.validate();
		}
	});

	return layeredPane;
}
 
源代码15 项目: TencentKona-8   文件: ValueFormatter.java
static void init(int length, boolean hex, JFormattedTextField text) {
    ValueFormatter formatter = new ValueFormatter(length, hex);
    text.setColumns(length);
    text.setFormatterFactory(new DefaultFormatterFactory(formatter));
    text.setHorizontalAlignment(SwingConstants.RIGHT);
    text.setMinimumSize(text.getPreferredSize());
    text.addFocusListener(formatter);
}
 
源代码16 项目: jdk8u60   文件: ValueFormatter.java
static void init(int length, boolean hex, JFormattedTextField text) {
    ValueFormatter formatter = new ValueFormatter(length, hex);
    text.setColumns(length);
    text.setFormatterFactory(new DefaultFormatterFactory(formatter));
    text.setHorizontalAlignment(SwingConstants.RIGHT);
    text.setMinimumSize(text.getPreferredSize());
    text.addFocusListener(formatter);
}
 
源代码17 项目: JDKSourceCode1.8   文件: ValueFormatter.java
static void init(int length, boolean hex, JFormattedTextField text) {
    ValueFormatter formatter = new ValueFormatter(length, hex);
    text.setColumns(length);
    text.setFormatterFactory(new DefaultFormatterFactory(formatter));
    text.setHorizontalAlignment(SwingConstants.RIGHT);
    text.setMinimumSize(text.getPreferredSize());
    text.addFocusListener(formatter);
}
 
源代码18 项目: openjdk-jdk8u   文件: ValueFormatter.java
static void init(int length, boolean hex, JFormattedTextField text) {
    ValueFormatter formatter = new ValueFormatter(length, hex);
    text.setColumns(length);
    text.setFormatterFactory(new DefaultFormatterFactory(formatter));
    text.setHorizontalAlignment(SwingConstants.RIGHT);
    text.setMinimumSize(text.getPreferredSize());
    text.addFocusListener(formatter);
}
 
源代码19 项目: marathonv5   文件: IntegerEditor.java
public IntegerEditor(int min, int max) {
    super(new JFormattedTextField());
    ftf = (JFormattedTextField) getComponent();
    minimum = new Integer(min);
    maximum = new Integer(max);

    // Set up the editor for the integer cells.
    integerFormat = NumberFormat.getIntegerInstance();
    NumberFormatter intFormatter = new NumberFormatter(integerFormat);
    intFormatter.setFormat(integerFormat);
    intFormatter.setMinimum(minimum);
    intFormatter.setMaximum(maximum);

    ftf.setFormatterFactory(new DefaultFormatterFactory(intFormatter));
    ftf.setValue(minimum);
    ftf.setHorizontalAlignment(JTextField.TRAILING);
    ftf.setFocusLostBehavior(JFormattedTextField.PERSIST);

    // React when the user presses Enter while the editor is
    // active. (Tab is handled as specified by
    // JFormattedTextField's focusLostBehavior property.)
    ftf.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "check");
    ftf.getActionMap().put("check", new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
            if (!ftf.isEditValid()) { // The text is invalid.
                if (userSaysRevert()) { // reverted
                    ftf.postActionEvent(); // inform the editor
                }
            } else
                try { // The text is valid,
                    ftf.commitEdit(); // so use it.
                    ftf.postActionEvent(); // stop editing
                } catch (java.text.ParseException exc) {
                }
        }
    });
}
 
源代码20 项目: netbeans   文件: AdvancedSecurityPanel.java
public AdvancedSecurityPanel(Binding binding, ConfigVersion cfgVersion) {
    this.binding = binding;
    this.cfgVersion = cfgVersion;
    
    freshnessff = new DefaultFormatterFactory();
    NumberFormat freshnessFormat = NumberFormat.getIntegerInstance();
    freshnessFormat.setGroupingUsed(false);
    NumberFormatter freshnessFormatter = new NumberFormatter(freshnessFormat);
    freshnessFormat.setMaximumIntegerDigits(8);
    freshnessFormatter.setCommitsOnValidEdit(true);
    freshnessFormatter.setMinimum(0);
    freshnessFormatter.setMaximum(99999999);
    freshnessff.setDefaultFormatter(freshnessFormatter);
            
    skewff = new DefaultFormatterFactory();
    NumberFormat skewFormat = NumberFormat.getIntegerInstance();
    skewFormat.setGroupingUsed(false);
    NumberFormatter skewFormatter = new NumberFormatter(skewFormat);
    skewFormat.setMaximumIntegerDigits(8);
    skewFormatter.setCommitsOnValidEdit(true);
    skewFormatter.setMinimum(0);
    skewFormatter.setMaximum(99999999);
    skewff.setDefaultFormatter(skewFormatter);

    initComponents();
    
    sync();
}
 
源代码21 项目: netbeans   文件: AdvancedRMPanel.java
public AdvancedRMPanel(Binding binding, ConfigVersion cfgVersion) {
    super();
    this.binding = binding;
    this.cfgVersion = cfgVersion;

    milisecondsff = new DefaultFormatterFactory();
    NumberFormat millisecondsFormat = NumberFormat.getIntegerInstance();        
    millisecondsFormat.setGroupingUsed(false);
    NumberFormatter millisecondsFormatter = new NumberFormatter(millisecondsFormat);
    millisecondsFormat.setMaximumIntegerDigits(8);
    millisecondsFormatter.setCommitsOnValidEdit(true);
    millisecondsFormatter.setMinimum(0);
    millisecondsFormatter.setMaximum(99999999);
    milisecondsff.setDefaultFormatter(millisecondsFormatter);

    maxBufff = new DefaultFormatterFactory();
    NumberFormat maxBufFormat = NumberFormat.getIntegerInstance();
    maxBufFormat.setGroupingUsed(false);
    NumberFormatter maxBufFormatter = new NumberFormatter(maxBufFormat);
    maxBufFormat.setMaximumIntegerDigits(8);
    maxBufFormatter.setCommitsOnValidEdit(true);
    maxBufFormatter.setMinimum(0);
    maxBufFormatter.setMaximum(99999999);
    maxBufff.setDefaultFormatter(maxBufFormatter);

    initComponents();

    inSync = true;
    for (RMDeliveryAssurance assurance : RMDeliveryAssurance.values()) {
        deliveryAssuranceCombo.addItem(assurance);
    }
    inSync = false;
    
    sync();
    refresh();
}
 
源代码22 项目: netbeans   文件: STSConfigServicePanel.java
/**
 * Creates new form STSConfigServicePanel
 */
public STSConfigServicePanel( Project p, Binding binding, ConfigVersion cfgVersion) {
    this.project = p;
    this.binding = binding;
    this.cfgVersion = cfgVersion;

    lifeTimeDff = new DefaultFormatterFactory();
    NumberFormat lifetimeFormat = NumberFormat.getIntegerInstance();
    lifetimeFormat.setGroupingUsed(false);
    lifetimeFormat.setParseIntegerOnly(true);
    lifetimeFormat.setMaximumFractionDigits(0);
    NumberFormatter lifetimeFormatter = new NumberFormatter(lifetimeFormat);
    lifetimeFormatter.setCommitsOnValidEdit(true);
    lifetimeFormatter.setMinimum(0);
    lifeTimeDff.setDefaultFormatter(lifetimeFormatter);

    initComponents();

    inSync = true;
    ServiceProvidersTablePanel.ServiceProvidersTableModel tablemodel = new ServiceProvidersTablePanel.ServiceProvidersTableModel();
    this.remove(serviceProvidersPanel);
    
    STSConfiguration stsConfig = ProprietarySecurityPolicyModelHelper.getSTSConfiguration(binding);
    if (stsConfig == null) {
        stsConfig = ProprietarySecurityPolicyModelHelper.createSTSConfiguration(binding);
    }
    serviceProvidersPanel = new ServiceProvidersTablePanel(tablemodel, stsConfig, cfgVersion);
    ((ServiceProvidersTablePanel)serviceProvidersPanel).populateModel();
    inSync = false;

    sync();
    
}
 
源代码23 项目: openjdk-jdk8u-backup   文件: ValueFormatter.java
static void init(int length, boolean hex, JFormattedTextField text) {
    ValueFormatter formatter = new ValueFormatter(length, hex);
    text.setColumns(length);
    text.setFormatterFactory(new DefaultFormatterFactory(formatter));
    text.setHorizontalAlignment(SwingConstants.RIGHT);
    text.setMinimumSize(text.getPreferredSize());
    text.addFocusListener(formatter);
}
 
源代码24 项目: Bytecoder   文件: ValueFormatter.java
static void init(int length, boolean hex, JFormattedTextField text) {
    ValueFormatter formatter = new ValueFormatter(length, hex);
    text.setColumns(length);
    text.setFormatterFactory(new DefaultFormatterFactory(formatter));
    text.setHorizontalAlignment(SwingConstants.RIGHT);
    text.setMinimumSize(text.getPreferredSize());
    text.addFocusListener(formatter);
}
 
源代码25 项目: openjdk-jdk9   文件: ValueFormatter.java
static void init(int length, boolean hex, JFormattedTextField text) {
    ValueFormatter formatter = new ValueFormatter(length, hex);
    text.setColumns(length);
    text.setFormatterFactory(new DefaultFormatterFactory(formatter));
    text.setHorizontalAlignment(SwingConstants.RIGHT);
    text.setMinimumSize(text.getPreferredSize());
    text.addFocusListener(formatter);
}
 
源代码26 项目: jdk8u-jdk   文件: ValueFormatter.java
static void init(int length, boolean hex, JFormattedTextField text) {
    ValueFormatter formatter = new ValueFormatter(length, hex);
    text.setColumns(length);
    text.setFormatterFactory(new DefaultFormatterFactory(formatter));
    text.setHorizontalAlignment(SwingConstants.RIGHT);
    text.setMinimumSize(text.getPreferredSize());
    text.addFocusListener(formatter);
}
 
源代码27 项目: gcs   文件: PrintPanel.java
private void createCopiesField(PrintRequestAttributeSet set) {
    PrintService service = getService();
    if (service.isAttributeCategorySupported(Copies.class)) {
        mCopies = new EditorField(new DefaultFormatterFactory(new IntegerFormatter(1, 999, false)), null, SwingConstants.RIGHT, Integer.valueOf(PrintUtilities.getCopies(service, set)), Integer.valueOf(999), null);
        UIUtilities.setToPreferredSizeOnly(mCopies);
        LinkedLabel label = new LinkedLabel(I18n.Text("Copies"), mCopies);
        add(label, new PrecisionLayoutData().setEndHorizontalAlignment());
        add(mCopies);
    } else {
        mCopies = null;
    }
}
 
源代码28 项目: gcs   文件: EditorPanel.java
/**
 * @param compare The current string compare object.
 * @return The field that allows a string comparison to be changed.
 */
protected EditorField addStringCompareField(StringCriteria compare) {
    DefaultFormatter formatter = new DefaultFormatter();
    formatter.setOverwriteMode(false);
    EditorField field = new EditorField(new DefaultFormatterFactory(formatter), this, SwingConstants.LEFT, compare.getQualifier(), null);
    field.putClientProperty(StringCriteria.class, compare);
    add(field);
    return field;
}
 
源代码29 项目: gcs   文件: EditorPanel.java
/**
 * @param compare   The current compare object.
 * @param min       The minimum value to allow.
 * @param max       The maximum value to allow.
 * @param forceSign Whether to force the sign to be visible.
 * @return The {@link EditorField} that allows an integer comparison to be changed.
 */
protected EditorField addNumericCompareField(IntegerCriteria compare, int min, int max, boolean forceSign) {
    EditorField field = new EditorField(new DefaultFormatterFactory(new IntegerFormatter(min, max, forceSign)), this, SwingConstants.LEFT, Integer.valueOf(compare.getQualifier()), Integer.valueOf(max), null);
    field.putClientProperty(IntegerCriteria.class, compare);
    UIUtilities.setToPreferredSizeOnly(field);
    add(field);
    return field;
}
 
源代码30 项目: gcs   文件: EditorPanel.java
/**
 * @param compare   The current compare object.
 * @param min       The minimum value to allow.
 * @param max       The maximum value to allow.
 * @param forceSign Whether to force the sign to be visible.
 * @return The {@link EditorField} that allows a double comparison to be changed.
 */
protected EditorField addNumericCompareField(DoubleCriteria compare, double min, double max, boolean forceSign) {
    EditorField field = new EditorField(new DefaultFormatterFactory(new DoubleFormatter(min, max, forceSign)), this, SwingConstants.LEFT, Double.valueOf(compare.getQualifier()), Double.valueOf(max), null);
    field.putClientProperty(DoubleCriteria.class, compare);
    UIUtilities.setToPreferredSizeOnly(field);
    add(field);
    return field;
}