📅  最后修改于: 2022-03-11 14:52:06.694000             🧑  作者: Mango
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);
}
}