你的主函数没有错误,你应该恢复主函数原来的样子
public static void main(String[] args){
User user=new User();
user.setId(1001);
user.setName("user");
user.setStuNum("1001");
new TicketBooker(user);
}
你的Java程序是在109行JCB_Year.setSelectedIndex(date.getYear()+1900-Integer.parseInt(arrayYear[0]));这句出问题了,因为今年是2018年,date.getYear()+1900=2018,2018-2014=4,JCB_Year.setSelectedIndex(4);而你的private JComboBox JCB_Year=new JComboBox(arrayYear);arrayYear是只定义了三个字符串的数组
private static final String arrayYear[]={"2014","2015","2016"};所以造成JComboBox下标Index越界,本来下标只有0到2你访问到了4.
改正办法把arrayYear数组加两个元素,把private static final String arrayYear[]={"2014","2015","2016"};改成private static final String arrayYear[]={"2014","2015","2016","2017","2018"};就没问题了.注意,arrayYear数组 2019年还需要加"2019",2020年还需要加"2020"
加载异常,初始化错误,属性new