简体   繁体   English

如何以'dd-mm-yyyy'和'yyyy-yyyy'格式SWING在JComboBox中放置日期列表?

[英]How to put list of dates in JComboBox in 'dd-mm-yyyy' and also in 'yyyy-yyyy' format SWING?

I want to create a window and put on it a:我想创建一个 window 并放在上面:

  1. box that you can insert your birth date in 'dd-mm-yyyy' format您可以以“dd-mm-yyyy”格式插入您的出生日期的框
  2. box that you can put your studying year in 'yyyy-yyyy' format框,您可以将您的学习年份设置为“yyyy-yyyy”格式

But I don't know if I should do a combo box and put all the date or there is a solution like a type of box that has 'dd-mm-yyyy' format and another type of box that have 'yyyy-yyyy' format.但我不知道我是否应该做一个组合框并输入所有日期,或者有一种解决方案,例如一种具有“dd-mm-yyyy”格式的框和另一种具有“yyyy-yyyy”的框格式。 USING SWING使用 SWING

For the birth date use a date picker.对于出生日期,请使用日期选择器。 Make sure to use one that supports java.time, the modern Java date and time API, for example LGoodDatePicker (I haven't got experience with it).确保使用支持 java.time 的,现代的 Java 日期和时间 API,例如LGoodDatePicker (我没有经验)。

For the years of study you may want two boxes, one for picking the start year and one for the end year.对于学习年限,您可能需要两个框,一个用于选择开始年份,一个用于选择结束年份。 Once the start year has been chosen, you may fill the other one with only the years from the start year until today.选择开始年份后,您可以只填写从开始年份到今天的年份。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM