¿Cómo usar JXDatePicker?

I want a datepicker in my jframe. I am using JXDatePicker from SwingX, but I have trouble to find out how it works, the datepicker doesnt show.

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

        JXDatePicker picker = new JXDatePicker();


what I would like is for the picker to show when on actionperformed of a button and then write the seledted date in a jlabel. Any Ideas?

preguntado el 03 de mayo de 12 a las 19:05

1 Respuestas

JXDatePicker is designed as a component that combines a button, an editable field and a JXMonthView component. The user can select a date from the calendar component, which appears when the button is pressed.

So, don't forget to add your picker to the container, ie:


Aquí se presenta una ejemplo.

contestado el 03 de mayo de 12 a las 19:05

can we make the editable field as non-editable by the user i.e. only a button click allow user to add entry in field. - Anchit Mittal

@AnchitMittal datePicker.getEditor().setEditable(false); debería hacer el truco. - saxo tenor

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.