本文整理汇总了Java中javax.swing.JFormattedTextField.AbstractFormatterFactory.getFormatter方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractFormatterFactory.getFormatter方法的具体用法?Java AbstractFormatterFactory.getFormatter怎么用?Java AbstractFormatterFactory.getFormatter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JFormattedTextField.AbstractFormatterFactory
的用法示例。
在下文中一共展示了AbstractFormatterFactory.getFormatter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例4: 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;
}