Java JSpinner create for month year value
import java.awt.FlowLayout; import java.util.Calendar; import java.util.Date; import javax.swing.JFrame; import javax.swing.JSpinner; import javax.swing.SpinnerDateModel; public class Main extends JFrame { public Main() { super("java2s.com"); setDefaultCloseOperation(EXIT_ON_CLOSE); setLayout(new FlowLayout()); Date today = new Date(); JSpinner spinner = new JSpinner(new SpinnerDateModel(today, null, null, Calendar.MONTH)); JSpinner.DateEditor de = new JSpinner.DateEditor(spinner, "MM/yy"); spinner.setEditor(de);// w w w. j av a 2s .c o m getContentPane().add(spinner); } public static void main(String[] args) { Main frame = new Main(); frame.pack(); frame.setVisible(true); } }