Java Swing Calendar Popup Button Example
Best Java code snippets using org.jdesktop.swingx.JXDatePicker.setFormats (Showing top 20 results out of 315)
import java.text.SimpleDateFormat; import java.util.Calendar; import javax.swing.JFrame; import javax.swing.JPanel; import org.jdesktop.swingx.JXDatePicker; public class DatePickerExample extends JPanel { public static void main(String[] args) { JFrame frame = new JFrame( "JXPicker Example" ); JPanel panel = new JPanel(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds( 400 , 400 , 250 , 100 ); JXDatePicker picker = new JXDatePicker(); picker.setDate(Calendar.getInstance().getTime()); picker. setFormats ( new SimpleDateFormat( "dd.MM.yyyy" )); panel.add(picker); frame.getContentPane().add(panel); frame.setVisible( true ); } }
public void setFormats(DateFormat... formats) { datePicker. setFormats (formats); } /**
public void setFormats(DateFormat... formats) { datePicker. setFormats (formats); } /**
public void setFormats(DateFormat... formats) { datePicker. setFormats (formats); } /**
public void setFormats(DateFormat... formats) { datePicker. setFormats (formats); } /**
public void setFormats(DateFormat... formats) { datePicker. setFormats (formats); } /**
JXDatePicker picker = new JXDatePicker(); SimpleDateFormat format = new SimpleDateFormat( "dd/MM/yyyy" ); picker. setFormats (format);
public CreateTimeIntervalUI() { initComponents(); defaultStartDatePicker. setFormats ( "yyyy-MM-dd" ); defaultEndDatePicker. setFormats ( "yyyy-MM-dd" ); dateFormatComboBox.addItem( "yyyy-MM-dd" ); dateFormatComboBox.addItem( "yyyy/MM/dd" ); dateFormatComboBox.addItem( "dd-MM-yyyy" ); dateFormatComboBox.addItem( "dd/MM/yyyy" ); dateFormatComboBox.addItem( "yyyy-MM-dd HH:mm:ss" ); dateFormatComboBox.addItem( "yyyy/MM/dd HH:mm:ss" ); dateFormatComboBox.addItem( "dd-MM-yyyy HH:mm:ss" ); dateFormatComboBox.addItem( "dd/MM/yyyy HH:mm:ss" ); dateFormatComboBox.setSelectedIndex( 0 ); }
import java.text.SimpleDateFormat; import java.util.Calendar; import javax.swing.JFrame; import javax.swing.JPanel; import org.jdesktop.swingx.JXDatePicker; @SuppressWarnings( "serial" ) public class DatePickerExample extends JPanel { public static void main(String[] args) { JFrame frame = new JFrame( "JXPicker Example" ); JPanel panel = new JPanel(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds( 400 , 400 , 250 , 100 ); JXDatePicker picker = new JXDatePicker(); picker.setDate(Calendar.getInstance().getTime()); picker. setFormats ( new SimpleDateFormat( "dd.MM.yyyy" )); panel.add(picker); frame.getContentPane().add(panel); frame.setVisible( true ); } }
public void setFormats(String... formats) { DateFormat[] dateFormats = null; if (formats != null) { Contract.asNotNull(formats, "the array of format strings must not " + "must not contain null elements" ); dateFormats = new DateFormat[formats.length]; for ( int counter = formats.length - 1 ; counter >= 0 ; counter--) { dateFormats[counter] = new SimpleDateFormat(formats[counter], getLocale()); } } setFormats (dateFormats); }
JXDatePicker datePicker = new JXDatePicker(); datePicker. setFormats ( "dd-MM-yyyy HH:mm:ss" ); JFormattedTextField editor = datePicker.getEditor(); Date dateInDatePicker = (Date) editor.getValue();
public DatePickerCellEditor(DateFormat dateFormat) { this .dateFormat = dateFormat != null ? dateFormat : DateFormat.getDateInstance(); datePicker = new JXDatePicker(); datePicker.getEditor().setBorder( BorderFactory.createEmptyBorder( 0 , 1 , 0 , 1 )); datePicker.setFont(UIManager.getDefaults().getFont( "TextField.font" )); if (dateFormat != null) { datePicker. setFormats (dateFormat); } datePicker.addActionListener(getPickerActionListener()); }
public DatePickerCellEditor(DateFormat dateFormat) { this .dateFormat = dateFormat != null ? dateFormat : DateFormat.getDateInstance(); datePicker = new JXDatePicker(); datePicker.getEditor().setBorder( BorderFactory.createEmptyBorder( 0 , 1 , 0 , 1 )); datePicker.setFont(UIManager.getDefaults().getFont( "TextField.font" )); if (dateFormat != null) { datePicker. setFormats (dateFormat); } datePicker.addActionListener(getPickerActionListener()); }
public DatePickerCellEditor(DateFormat dateFormat) { this .dateFormat = dateFormat != null ? dateFormat : DateFormat.getDateInstance(); datePicker = new JXDatePicker(); datePicker.getEditor().setBorder( BorderFactory.createEmptyBorder( 0 , 1 , 0 , 1 )); datePicker.setFont(UIManager.getDefaults().getFont( "TextField.font" )); if (dateFormat != null) { datePicker. setFormats (dateFormat); } datePicker.addActionListener(getPickerActionListener()); }
public DatePickerCellEditor(DateFormat dateFormat) { this .dateFormat = dateFormat != null ? dateFormat : DateFormat.getDateInstance(); datePicker = new JXDatePicker(); datePicker.getEditor().setBorder( BorderFactory.createEmptyBorder( 0 , 1 , 0 , 1 )); datePicker.setFont(UIManager.getDefaults().getFont( "TextField.font" )); if (dateFormat != null) { datePicker. setFormats (dateFormat); } datePicker.addActionListener(getPickerActionListener()); }
public DatePickerCellEditor(DateFormat dateFormat) { this .dateFormat = dateFormat != null ? dateFormat : DateFormat.getDateInstance(); datePicker = new JXDatePicker(); datePicker.getEditor().setBorder( BorderFactory.createEmptyBorder( 0 , 1 , 0 , 1 )); datePicker.setFont(UIManager.getDefaults().getFont( "TextField.font" )); if (dateFormat != null) { datePicker. setFormats (dateFormat); } datePicker.addActionListener(getPickerActionListener()); }
private JXDatePicker createDatePicker() { final JXDatePicker datePicker = new JXDatePicker(); datePicker. setFormats (DATE_FORMAT); datePicker.addActionListener(e -> { clearRadioGroup(); updateWidget(); }); datePicker.getEditor().addFocusListener( new FocusListener() { @Override public void focusGained( final FocusEvent e) { clearRadioGroup(); } @Override public void focusLost( final FocusEvent e) { } }); return datePicker; }
protected void initDatePicker( final JXDatePicker picker) { if (log.isDebugEnabled()) { log.debug( "disable JXDatePicker editor" + picker.getName()); } String dateFormat = getContext().getDateFormat(); picker. setFormats (dateFormat); picker.setToolTipText(t( "jaxx.application.common.datefield.tip" , dateFormat)); picker.getEditor().addFocusListener( new FocusAdapter() { @Override public void focusLost(FocusEvent e) { try { picker.commitEdit(); } catch (ParseException ex) { if (log.isDebugEnabled()) { log.debug( "format error" , ex); } picker.requestFocus(); } } }); if (isAutoSelectOnFocus(picker)) { addAutoSelectOnFocus(picker.getEditor()); } }
protected void installComponents() { JFormattedTextField editor = datePicker.getEditor(); if (SwingXUtilities.isUIInstallable(editor)) { DateFormat[] formats = getCustomFormats(editor); datePicker.setEditor(createEditor()); if (formats != null) { datePicker. setFormats (formats); } } updateFromEditorChanged(null, false ); popupButton = createPopupButton(); if (popupButton != null) { JComboBox box = new JComboBox(); Object preventHide = box.getClientProperty( "doNotCancelPopup" ); popupButton.putClientProperty( "doNotCancelPopup" , preventHide); datePicker.add(popupButton); popupButton.setEnabled(datePicker.isEnabled()); popupButton.setInheritsPopupMenu( true ); } updateChildLocale(datePicker.getLocale()); }
protected void installComponents() { JFormattedTextField editor = datePicker.getEditor(); if (SwingXUtilities.isUIInstallable(editor)) { DateFormat[] formats = getCustomFormats(editor); datePicker.setEditor(createEditor()); if (formats != null) { datePicker. setFormats (formats); } } updateFromEditorChanged(null, false ); popupButton = createPopupButton(); if (popupButton != null) { JComboBox box = new JComboBox(); Object preventHide = box.getClientProperty( "doNotCancelPopup" ); popupButton.putClientProperty( "doNotCancelPopup" , preventHide); datePicker.add(popupButton); } updateChildLocale(datePicker.getLocale()); }
Source: https://www.tabnine.com/code/java/methods/org.jdesktop.swingx.JXDatePicker/setFormats
0 Response to "Java Swing Calendar Popup Button Example"
Post a Comment