本文整理汇总了Java中javax.swing.JFormattedTextField.AbstractFormatterFactory类的典型用法代码示例。如果您正苦于以下问题:Java AbstractFormatterFactory类的具体用法?Java AbstractFormatterFactory怎么用?Java AbstractFormatterFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AbstractFormatterFactory类属于javax.swing.JFormattedTextField包,在下文中一共展示了AbstractFormatterFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCustomFormats
import javax.swing.JFormattedTextField.AbstractFormatterFactory; //导入依赖的package包/类
/**
* Checks and returns custom formats on the editor, if any.
*
* @param editor the editor to check
* @return the custom formats uses in the editor or null if it had
* used defaults as defined in the datepicker properties
*/
private DateFormat[] getCustomFormats(JFormattedTextField editor) {
DateFormat[] formats = null;
if (editor != null) {
AbstractFormatterFactory factory = editor.getFormatterFactory();
if (factory != null) {
AbstractFormatter formatter = factory.getFormatter(editor);
// fix for #1144: classCastException for custom formatters
// PENDING JW: revisit for #1138
if ((formatter instanceof DatePickerFormatter) && !(formatter instanceof UIResource)) {
// if (!(formatter instanceof DatePickerFormatterUIResource)) {
formats = ((DatePickerFormatter) formatter).getFormats();
}
}
}
return formats;
}
示例2: getFormats
import javax.swing.JFormattedTextField.AbstractFormatterFactory; //导入依赖的package包/类
/**
* Returns an array of the formats used by the installed formatter
* if it is a subclass of <code>JXDatePickerFormatter<code>.
* <code>javax.swing.JFormattedTextField.AbstractFormatter</code>
* and <code>javax.swing.text.DefaultFormatter</code> do not have
* support for accessing the formats used.
*
* @return array of formats guaranteed to be not null, but might be empty.
*/
public DateFormat[] getFormats() {
// Dig this out from the factory, if possible, otherwise return null.
AbstractFormatterFactory factory = _dateField.getFormatterFactory();
if (factory != null) {
AbstractFormatter formatter = factory.getFormatter(_dateField);
if (formatter instanceof DatePickerFormatter) {
return ((DatePickerFormatter) formatter).getFormats();
}
}
return EMPTY_DATE_FORMATS;
}
示例3: setFormatterFactory
import javax.swing.JFormattedTextField.AbstractFormatterFactory; //导入依赖的package包/类
public void setFormatterFactory(final AbstractFormatterFactory formatter)
{
if (textComponent instanceof JFormattedTextField)
{
((JFormattedTextField)textComponent).setFormatterFactory(formatter);
}
}
示例4: getFormatterFactory
import javax.swing.JFormattedTextField.AbstractFormatterFactory; //导入依赖的package包/类
public AbstractFormatterFactory getFormatterFactory()
{
if (textComponent instanceof JFormattedTextField)
{
return ((JFormattedTextField)textComponent).getFormatterFactory();
}
else
{
return null;
}
}
示例5: getCustomFormats
import javax.swing.JFormattedTextField.AbstractFormatterFactory; //导入依赖的package包/类
/**
* Checks and returns custom formats on the editor, if any.
*
* @param editor the editor to check
* @return the custom formats uses in the editor or null if it had
* used defaults as defined in the datepicker properties
*/
private DateFormat[] getCustomFormats(JFormattedTextField editor) {
DateFormat[] formats = null;
if (editor != null) {
AbstractFormatterFactory factory = editor.getFormatterFactory();
if (factory != null) {
AbstractFormatter formatter = factory.getFormatter(editor);
if (!(formatter instanceof DatePickerFormatterUIResource)) {
formats = ((DatePickerFormatter) formatter).getFormats();
}
}
}
return formats;
}
示例6: getFormats
import javax.swing.JFormattedTextField.AbstractFormatterFactory; //导入依赖的package包/类
/**
* Returns an array of the formats used by the installed formatter
* if it is a subclass of <code>JXDatePickerFormatter<code>.
* <code>javax.swing.JFormattedTextField.AbstractFormatter</code>
* and <code>javax.swing.text.DefaultFormatter</code> do not have
* support for accessing the formats used.
*
* @return array of formats or null if unavailable.
*/
public DateFormat[] getFormats() {
// Dig this out from the factory, if possible, otherwise return null.
AbstractFormatterFactory factory = _dateField.getFormatterFactory();
if (factory != null) {
AbstractFormatter formatter = factory.getFormatter(_dateField);
if (formatter instanceof JXDatePickerFormatter) {
return ((JXDatePickerFormatter)formatter).getFormats();
}
}
return null;
}
示例7: getFormatterFactory
import javax.swing.JFormattedTextField.AbstractFormatterFactory; //导入依赖的package包/类
@Override
public AbstractFormatterFactory getFormatterFactory() {
return m_factory;
}
示例8: getFormatterFactory
import javax.swing.JFormattedTextField.AbstractFormatterFactory; //导入依赖的package包/类
@Override
public AbstractFormatterFactory getFormatterFactory() {
return null;
}
示例9: configureComponents
import javax.swing.JFormattedTextField.AbstractFormatterFactory; //导入依赖的package包/类
private void configureComponents() {
dateEchoField.setEditable(false);
AbstractFormatter formatter = new DateFormatter(DateFormat.getDateTimeInstance());
AbstractFormatterFactory tf = new DefaultFormatterFactory(formatter);
dateEchoField.setFormatterFactory(tf);
}
示例10: createFormatterFactory
import javax.swing.JFormattedTextField.AbstractFormatterFactory; //导入依赖的package包/类
/**
* Convenience method for creating a formatter factory with a
* {@code ScalableNumberFormatter} and a Java-style DecimalFormat.
*/
public static AbstractFormatterFactory createFormatterFactory(double min, double max, double multiplier, boolean allowsNullValue) {
JavaNumberFormatter formatter = new JavaNumberFormatter(min, max, multiplier, allowsNullValue, null);
return new DefaultFormatterFactory(formatter);
}
示例11: createFormatterFactory
import javax.swing.JFormattedTextField.AbstractFormatterFactory; //导入依赖的package包/类
public static AbstractFormatterFactory createFormatterFactory(boolean allowsNullValue) {
return new DefaultFormatterFactory(new FontFormatter(allowsNullValue));
}
示例12: createFormatterFactory
import javax.swing.JFormattedTextField.AbstractFormatterFactory; //导入依赖的package包/类
public static AbstractFormatterFactory createFormatterFactory() {
return createFormatterFactory(Format.RGB_INTEGER_SHORT, true, true);
}
示例13: createControl
import javax.swing.JFormattedTextField.AbstractFormatterFactory; //导入依赖的package包/类
protected JComponent createControl(Map context) {
return getComponentFactory().createFormattedTextField(
(AbstractFormatterFactory)context.get(FORMATTER_FACTORY_KEY));
}
示例14: createBoundFormattedTextField
import javax.swing.JFormattedTextField.AbstractFormatterFactory; //导入依赖的package包/类
public Binding createBoundFormattedTextField(String formProperty, AbstractFormatterFactory formatterFactory) {
Map context = createContext(FormattedTextFieldBinder.FORMATTER_FACTORY_KEY, formatterFactory);
return createBinding(JFormattedTextField.class, formProperty, context);
}
示例15: createFormattedTextField
import javax.swing.JFormattedTextField.AbstractFormatterFactory; //导入依赖的package包/类
public JFormattedTextField createFormattedTextField(AbstractFormatterFactory formatterFactory) {
PatchedJFormattedTextField patchedJFormattedTextField = new PatchedJFormattedTextField(formatterFactory);
configureTextField(patchedJFormattedTextField);
return patchedJFormattedTextField;
}