Java JSpinner.DateEditor with custom format
import java.awt.FlowLayout; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JSpinner; import javax.swing.SpinnerDateModel; import javax.swing.SpinnerModel; public class Main extends JFrame { public Main() { super("java2s.com"); setDefaultCloseOperation(EXIT_ON_CLOSE); setLayout(new FlowLayout()); SpinnerModel model = new SpinnerDateModel(); JSpinner spinner = new JSpinner(model); JComponent editor = new JSpinner.DateEditor(spinner, "MMMM yyyy"); spinner.setEditor(editor);/*from www . j av a 2 s . c o m*/ getContentPane().add(spinner); } public static void main(String[] args) { Main frame = new Main(); frame.pack(); frame.setVisible(true); } }