当前位置: 首页>>代码示例>>Java>>正文


Java DatePickerFormatterUIResource类代码示例

本文整理汇总了Java中org.jdesktop.swingx.calendar.DatePickerFormatter.DatePickerFormatterUIResource的典型用法代码示例。如果您正苦于以下问题:Java DatePickerFormatterUIResource类的具体用法?Java DatePickerFormatterUIResource怎么用?Java DatePickerFormatterUIResource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DatePickerFormatterUIResource类属于org.jdesktop.swingx.calendar.DatePickerFormatter包,在下文中一共展示了DatePickerFormatterUIResource类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createEditor

import org.jdesktop.swingx.calendar.DatePickerFormatter.DatePickerFormatterUIResource; //导入依赖的package包/类
/**
 * Creates the editor used to edit the date selection. The editor is
 * configured with the default DatePickerFormatter marked as UIResource.
 * 
 * @return an instance of a JFormattedTextField
 */
protected JFormattedTextField createEditor() {
    JFormattedTextField f = new DefaultEditor(
            new DatePickerFormatterUIResource(datePicker.getLocale()));
    f.setName("dateField");
    // this produces a fixed pref widths, looking a bit funny
    // int columns = UIManagerExt.getInt("JXDatePicker.numColumns", null);
    // if (columns > 0) {
    // f.setColumns(columns);
    // }
    // that's always 0 as it comes from the resourcebundle
    // f.setColumns(UIManager.getInt("JXDatePicker.numColumns"));
    Border border = UIManager.getBorder("JXDatePicker.border");
    if (border != null) {
        f.setBorder(border);
    }
    return f;
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:24,代码来源:BasicDatePickerUI.java

示例2: updateFormatLocale

import org.jdesktop.swingx.calendar.DatePickerFormatter.DatePickerFormatterUIResource; //导入依赖的package包/类
private void updateFormatLocale(Locale locale) {
    if (locale != null) {
        // PENDING JW: timezone?
        if (getCustomFormats(datePicker.getEditor()) == null) {
            datePicker.getEditor().setFormatterFactory(
                    new DefaultFormatterFactory(
                            new DatePickerFormatterUIResource(locale)));
        }
    }
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:11,代码来源:BasicDatePickerUI.java

示例3: testPickerFormatterUIResourceCustomLocale

import org.jdesktop.swingx.calendar.DatePickerFormatter.DatePickerFormatterUIResource; //导入依赖的package包/类
/**
 * Issue #691-swingx: locale setting not taken.
 * Here: test contructor with locale in uiresource.
 */
@Test
public void testPickerFormatterUIResourceCustomLocale() {
    Locale locale = Locale.FRENCH;
    DatePickerFormatter formatter = new DatePickerFormatterUIResource(locale);
    SimpleDateFormat format = (SimpleDateFormat) formatter.getFormats()[0];
    String pattern = UIManagerExt.getString("JXDatePicker.longFormat", locale);
    assertEquals("format pattern must be same as from localized resource", 
            pattern, format.toPattern());
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:14,代码来源:DatePickerFormatterTest.java

示例4: testPickerFormatterUIResourceDefaultLocale

import org.jdesktop.swingx.calendar.DatePickerFormatter.DatePickerFormatterUIResource; //导入依赖的package包/类
/**
 * Issue #691-swingx: locale setting not taken.
 * Here: test empty contructor == default locale in uiresource.
 * Adjusted to fix of Issue ??-swingx: use system default format
 * if resources for Locale have no JXDatePicker entry
 */
@Test
public void testPickerFormatterUIResourceDefaultLocale() {
    DatePickerFormatter formatter = new DatePickerFormatterUIResource();
    SimpleDateFormat format = (SimpleDateFormat) formatter.getFormats()[0];
    String pattern = UIManagerExt.getString("JXDatePicker.longFormat");
    if (pattern != null) {
        assertEquals(pattern, format.toPattern()); 
    } else {
        LOG.info("can't run test, no datePicker resource entries for Locale " + Locale.getDefault());
    }
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:18,代码来源:DatePickerFormatterTest.java

示例5: getCustomFormats

import org.jdesktop.swingx.calendar.DatePickerFormatter.DatePickerFormatterUIResource; //导入依赖的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;
}
 
开发者ID:sing-group,项目名称:aibench-project,代码行数:22,代码来源:BasicDatePickerUI.java


注:本文中的org.jdesktop.swingx.calendar.DatePickerFormatter.DatePickerFormatterUIResource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。