我使用org.jdatepicker.impl.JDatePanelImpl
让用户选择弹出日历的日期。
问题是当组件位于窗口的底部时,弹出日历显示在组件下方,用户无法选择日期。
有没有办法让弹出窗口显示在JDatePicker
组件上方?
import java.awt.Dimension;
import java.util.Properties;
import org.jdatepicker.impl.JDatePanelImpl;
import org.jdatepicker.impl.JDatePickerImpl;
import org.jdatepicker.impl.UtilDateModel;
public class MyDatePicker{
JDatePanelImpl jDatePickerPanel;
JDatePickerImpl datePicker;
public MyDatePicker(){
UtilDateModel model = new UtilDateModel();
//model.setDate(20,04,2014);
Properties p = new Properties();
p.put("text.today", "Today");
p.put("text.month", "Month");
p.put("text.year", "Year");
jDatePickerPanel=new JDatePanelImpl(model, p);
//datePicker.
//jDatePickerPanel.getComponentPopupMenu().setLocation(100, 100);
datePicker = new JDatePickerImpl(jDatePickerPanel, new DateLabelFormatter());
}
public JDatePickerImpl datePicker(){
return datePicker;
}
public JDatePanelImpl datePickerPanel(){
return jDatePickerPanel;
}
public void setColumns(int columns){
datePicker.getJFormattedTextField().setColumns(columns);
}
}