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


Java JXDatePicker类代码示例

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


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

示例1: getPickDateDlg

import org.jdesktop.swingx.JXDatePicker; //导入依赖的package包/类
private Date getPickDateDlg() {	
	
	JPanel panel = new JPanel();

	JXDatePicker picker = new JXDatePicker();
	picker.setDate(Calendar.getInstance().getTime());
	picker.setFormats(new SimpleDateFormat("dd.MM.yyyy")); //$NON-NLS-1$

	panel.add(picker);
	
	int result = JOptionPane.showConfirmDialog(frame,
               panel,
               Messages.getString("ExportActionListener.1"), //$NON-NLS-1$
               JOptionPane.OK_CANCEL_OPTION,
               JOptionPane.PLAIN_MESSAGE);		
	if( result ==  JOptionPane.OK_OPTION ){ 
		return picker.getDate();
	}else{
		return null;
	}
}
 
开发者ID:openforis,项目名称:collect-earth,代码行数:22,代码来源:ExportActionListener.java

示例2: MarketDataSpecificationComponent

import org.jdesktop.swingx.JXDatePicker; //导入依赖的package包/类
public MarketDataSpecificationComponent(List<LiveDataMetaDataProvider> metaDataProviders, ConfigMaster configMaster, MarketDataSnapshotMaster snapshotMaster) {
  super();
  _configMaster = configMaster;
  _snapshotMaster = snapshotMaster;
  _metaDataProviders = metaDataProviders;
  _dataSourceTypeCombo = createDataSourceTypeCombo();
  _dataSourceCombo = createDataSourceCombo();
  _snapshotVersionCombo = createSnapshotVersionCombo();
  _datePicker = new JXDatePicker();
  _datePicker.setPreferredSize(SNAPSHOT_VERSION_PREFERRED_SIZE);
  _datePicker.setMinimumSize(SNAPSHOT_VERSION_PREFERRED_SIZE);
  _datePicker.setMaximumSize(SNAPSHOT_VERSION_PREFERRED_SIZE);
  createModels();
  addComponents();
  setPreferredSize(COMPONENT_PREFERRED_SIZE);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:17,代码来源:MarketDataSpecificationComponent.java

示例3: DatePickerCellEditor

import org.jdesktop.swingx.JXDatePicker; //导入依赖的package包/类
/**
 * Instantiates an editor with the given dateFormat. If
 * null, the datePickers default is used.
 * 
 * @param dateFormat
 */
public DatePickerCellEditor(DateFormat dateFormat) {
    // JW: the copy is used to synchronize .. can 
    // we use something else?
    this.dateFormat = dateFormat != null ? dateFormat : 
        DateFormat.getDateInstance();
    datePicker = new JXDatePicker();
    // default border crushes the editor/combo
    datePicker.getEditor().setBorder(
            BorderFactory.createEmptyBorder(0, 1, 0, 1)); 
    // should be fixed by j2se 6.0
    datePicker.setFont(UIManager.getDefaults().getFont("TextField.font")); 
    if (dateFormat != null) {
        datePicker.setFormats(dateFormat);
    }
    datePicker.addActionListener(getPickerActionListener());
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:23,代码来源:DatePickerCellEditor.java

示例4: installKeyboardActions

import org.jdesktop.swingx.JXDatePicker; //导入依赖的package包/类
protected void installKeyboardActions() {
    // install picker's actions
    ActionMap pickerMap = datePicker.getActionMap();
    pickerMap.put(JXDatePicker.CANCEL_KEY, createCancelAction());
    pickerMap.put(JXDatePicker.COMMIT_KEY, createCommitAction());
    pickerMap.put(JXDatePicker.HOME_NAVIGATE_KEY, createHomeAction(false));
    pickerMap.put(JXDatePicker.HOME_COMMIT_KEY, createHomeAction(true));
    TogglePopupAction popupAction = createTogglePopupAction();
    pickerMap.put("TOGGLE_POPUP", popupAction);
    
    InputMap pickerInputMap = datePicker.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    pickerInputMap.put(KeyStroke.getKeyStroke("ENTER"), JXDatePicker.COMMIT_KEY);
    pickerInputMap.put(KeyStroke.getKeyStroke("ESCAPE"), JXDatePicker.CANCEL_KEY);
    // PENDING: get from LF
    pickerInputMap.put(KeyStroke.getKeyStroke("F5"), JXDatePicker.HOME_COMMIT_KEY);
    pickerInputMap.put(KeyStroke.getKeyStroke("shift F5"), JXDatePicker.HOME_NAVIGATE_KEY);
    pickerInputMap.put(KeyStroke.getKeyStroke("alt DOWN"), "TOGGLE_POPUP");
    
    installLinkPanelKeyboardActions();
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:21,代码来源:BasicDatePickerUI.java

示例5: installLinkPanelKeyboardActions

import org.jdesktop.swingx.JXDatePicker; //导入依赖的package包/类
/**
 * Installs actions and key bindings on the datePicker's linkPanel. Does
 * nothing if the linkPanel is null.
 * 
 * PRE: keybindings installed on picker.
 */
protected void installLinkPanelKeyboardActions() {
    if (datePicker.getLinkPanel() == null)
        return;
    ActionMap map = datePicker.getLinkPanel().getActionMap();
    map.put(JXDatePicker.HOME_COMMIT_KEY, datePicker.getActionMap().get(
            JXDatePicker.HOME_COMMIT_KEY));
    map.put(JXDatePicker.HOME_NAVIGATE_KEY, datePicker.getActionMap().get(
            JXDatePicker.HOME_NAVIGATE_KEY));
    InputMap inputMap = datePicker.getLinkPanel().getInputMap(
            JComponent.WHEN_IN_FOCUSED_WINDOW);
    // PENDING: get from LF
    inputMap.put(KeyStroke.getKeyStroke("F5"), 
            JXDatePicker.HOME_COMMIT_KEY);
    inputMap.put(KeyStroke.getKeyStroke("shift F5"),
            JXDatePicker.HOME_NAVIGATE_KEY);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:23,代码来源:BasicDatePickerUI.java

示例6: testFocusedInitialTrue

import org.jdesktop.swingx.JXDatePicker; //导入依赖的package包/类
@Test
public void testFocusedInitialTrue() throws InterruptedException, InvocationTargetException {
    // This test will not work in a headless configuration.
    if (GraphicsEnvironment.isHeadless()) {
        LOG.fine("cannot run test - headless environment");
        return;
    }
    final JXDatePicker picker = getRealizedDatePicker();
    picker.requestFocusInWindow();
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getPermanentFocusOwner();
            assertTrue("sanity: focus transfered into picker hierarchy", 
                    SwingXUtilities.isDescendingFrom(focusOwner, picker));
            CompoundFocusListener l = new CompoundFocusListener(picker);
            assertTrue("listener must take initial focused state ", l.isFocused());
        }
    });
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:21,代码来源:CompoundFocusListenerTest.java

示例7: testRelease

import org.jdesktop.swingx.JXDatePicker; //导入依赖的package包/类
/**
 * Test no property change fired after release.
 * 
 * @throws InterruptedException
 * @throws InvocationTargetException
 */
@Test
public void testRelease() throws InterruptedException, InvocationTargetException {
    // This test will not work in a headless configuration.
    if (GraphicsEnvironment.isHeadless()) {
        LOG.fine("cannot run test - headless environment");
        return;
    }
    JXDatePicker picker = getRealizedDatePicker();
    Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getPermanentFocusOwner();
    assertFalse("sanity: initial focus must not be in picker", 
            SwingXUtilities.isDescendingFrom(focusOwner, picker));
    CompoundFocusListener l = new CompoundFocusListener(picker);
    final PropertyChangeReport report = new PropertyChangeReport();
    l.addPropertyChangeListener(report);
    l.release();
    picker.requestFocusInWindow();
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            assertEquals(0, report.getEventCount("focused"));
        }
    });
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:30,代码来源:CompoundFocusListenerTest.java

示例8: testFireFocusedProperty

import org.jdesktop.swingx.JXDatePicker; //导入依赖的package包/类
/**
 * Test property change fired on focusGained.
 * 
 * @throws InterruptedException
 * @throws InvocationTargetException
 */
@Test
public void testFireFocusedProperty() throws InterruptedException, InvocationTargetException {
    // This test will not work in a headless configuration.
    if (GraphicsEnvironment.isHeadless()) {
        LOG.fine("cannot run test - headless environment");
        return;
    }
    JXDatePicker picker = getRealizedDatePicker();
    Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getPermanentFocusOwner();
    assertFalse("sanity: initial focus must not be in picker", 
            SwingXUtilities.isDescendingFrom(focusOwner, picker));
    CompoundFocusListener l = new CompoundFocusListener(picker);
    final PropertyChangeReport report = new PropertyChangeReport();
    l.addPropertyChangeListener(report);
    picker.requestFocusInWindow();
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            assertEquals(1, report.getEventCount("focused"));
        }
    });
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:29,代码来源:CompoundFocusListenerTest.java

示例9: interactiveDatePickerCellEditorXTable

import org.jdesktop.swingx.JXDatePicker; //导入依赖的package包/类
/**
     * Issue ??-swingx: picker cell editor popup commit/cancel 
     * transfers focus out-off the table (1.5)
     * 
     * Looks like a core issue - editable combo misbehaves as well.
     * Here we use a JXTable.
     */
    public void interactiveDatePickerCellEditorXTable() {
        final JXTable table = new JXTable(createTableModel(2));
        table.setVisibleColumnCount(6);
//        table.setSurrendersFocusOnKeystroke(true);
        installEditors(table);
        Action action = new AbstractAction("toggle terminate") {

            public void actionPerformed(ActionEvent e) {
                table.setTerminateEditOnFocusLost(!table.isTerminateEditOnFocusLost());
                
            }
            
        };
        JXFrame frame = wrapWithScrollingInFrame(table, "JXTable - date picker cell editor");
        addAction(frame, action);
        frame.add(new JXDatePicker(), BorderLayout.SOUTH);
        show(frame);
    }
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:26,代码来源:DatePickerCellEditorVisualCheck.java

示例10: doDatePickerAction

import org.jdesktop.swingx.JXDatePicker; //导入依赖的package包/类
private static void doDatePickerAction(TestStep step) throws HeadlessException {
    int componentId = step.getComponent();
    TestStep.Action action = step.getAction();
    JXDatePicker datePicker = bankAppStarter.retrieveComponent(componentId, JXDatePicker.class);
    switch (action.getName()) {
        case PICK_DATE:
            sleep(step.getPreWait());
            Date date = Calendar.getInstance().getTime();
            try {
                date = parseString2Date(action.getParameter());
            } catch (ParseException ex) {
                exitWithErr(new StringBuilder("Illegal parameter setting in DatePicker PickDate action, it must be yyyy-MM-dd. ")
                        .append(" with component ID ")
                        .append(componentId).toString());
            }
            datePicker.setDate(date);
            sleep(step.getPostWait());
            break;
        default:
            exitWithErr(new StringBuilder("Unsupported DatePicker action ")
                    .append(action.getName())
                    .append(" with component ID ")
                    .append(componentId).toString());
    }
}
 
开发者ID:toyboxman,项目名称:yummy-xml-UI,代码行数:26,代码来源:AutomaticTestBankApp.java

示例11: retrieveNumber

import org.jdesktop.swingx.JXDatePicker; //导入依赖的package包/类
protected long retrieveNumber(int componentID) {
    long value = Long.MIN_VALUE;
    king.flow.view.Component meta = (king.flow.view.Component) getBlockMeta(componentID);
    ComponentEnum type = meta.getType();
    switch (type) {
        case DATE:
            JXDatePicker jdp = getBlock(componentID, JXDatePicker.class);
            Date date = jdp.getDate();
            value = date.getTime();
            break;
        case TEXT_FIELD:
            JTextField jtf = getBlock(componentID, JTextField.class);
            String text = jtf.getText();
            try {
                value = Long.parseLong(text);
            } catch (NumberFormatException e) {
                CommonUtil.getLogger(DefaultAction.class.getName()).log(Level.WARNING,
                        "Invalidated textfiled numeric value", e);
            }
            break;
        default:
            CommonUtil.getLogger(DefaultAction.class.getName()).log(Level.INFO,
                    "Unsupported more-less-comparing component type : {0}", type);
    }
    return value;
}
 
开发者ID:toyboxman,项目名称:yummy-xml-UI,代码行数:27,代码来源:DefaultAction.java

示例12: buildStartDatePicker

import org.jdesktop.swingx.JXDatePicker; //导入依赖的package包/类
private JXDatePicker buildStartDatePicker() {
    startDatePicker = buildDatePicker(resourceManager.getString("start.date"));
    startDatePicker.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            if (dateRangeList.isNotEmpty()) {
                Date startDate = startDatePicker.getDate();
                DateRange dateRange = dateRangeList.getSelectedEntity();
                try {
                    dateRange.setStartDate(startDate);
                } catch (IllegalArgumentException e) {
                    showDatePickerErrorMessage(startDatePicker, e);
                }
            }
        }
    });
    return startDatePicker;
}
 
开发者ID:objektwerks,项目名称:swing,代码行数:19,代码来源:RegimeStatisticsPanel.java

示例13: buildEndDatePicker

import org.jdesktop.swingx.JXDatePicker; //导入依赖的package包/类
private JXDatePicker buildEndDatePicker() {
    endDatePicker = buildDatePicker(resourceManager.getString("end.date"));
    endDatePicker.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            if (dateRangeList.isNotEmpty()) {
                Date endDate = endDatePicker.getDate();
                DateRange dateRange = dateRangeList.getSelectedEntity();
                try {
                    dateRange.setEndDate(endDate);
                } catch (IllegalArgumentException e) {
                    showDatePickerErrorMessage(endDatePicker, e);
                }
            }
        }
    });
    return endDatePicker;
}
 
开发者ID:objektwerks,项目名称:swing,代码行数:19,代码来源:RegimeStatisticsPanel.java

示例14: validateDateChooser

import org.jdesktop.swingx.JXDatePicker; //导入依赖的package包/类
private void validateDateChooser(JXDatePicker button) {
    Date startDate = startDateButton.getDate();
    Date endDate = stopDateButton.getDate();
    if (startDate == null || endDate == null) {
        return;
    }
    if (startDate.after(endDate)) {
        if (button.equals(startDateButton)) {
            startDateButton.setDate(endDate);
            LOG.info("Start date after end date: Set start date to end date.");
        } else if (button.equals(stopDateButton)) {
            stopDateButton.setDate(startDate);
            LOG.info("Start date after end date: Set end date to start date.");
        }
    }
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:17,代码来源:TimeRangeFilter.java

示例15: installKeyboardActions

import org.jdesktop.swingx.JXDatePicker; //导入依赖的package包/类
@Override
protected void installKeyboardActions() {
    super.installKeyboardActions();
    ActionMap pickerMap = datePicker.getActionMap();
    pickerMap.remove(JXDatePicker.CANCEL_KEY);
    InputMap pickerInputMap = datePicker.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    pickerInputMap.remove(KeyStroke.getKeyStroke("ESCAPE"));
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:9,代码来源:CustomDatePickerUI.java


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