I have made a gui with something like this:
String[] days29 = {"1",....."29"};
String[] days30 = {"1",....."30"};
String[] days31 = {"1",....."31"};
String[] mths = {"January",..."December"};
JComboBox months = new JComboBox(mths);
JComboBox days = new JComboBox();
public daysAdjuster(){
if(months.getSelectedItem().equals.("January")){
days = new JComboBox(days31);
}else if(months.getSelectedItem().equals.("February")){
days = new JComboBox(days29);
}else if(months.getSelectedItem().equals.("April")){
days = new JComboBox(days30);
}
public static void main(String[] args){
// JFrame codes here
daysAdjuster();
}
What I want to do is that if I select the months with 31 days in JComboBox "months" the JComboBox "days" will output items using the "days31" string array and if I select months with 30 days only, it will output the string array "days30" in my days JComboBox.
But the only thing I'm getting is [[ days = new JComboBox(days31) ]] even though I've selected a different month. For example, if I select Febraury, it still displays a "days" JComboBox with "days31" string array with it. Obviously, I made a mistake in my daysAdjuster or just made it the wrong way, please correct my error, can't figure it out. Thanks in advance!
Notes:
January is the default selected item in the jcombobox "months"
Never made a spelling mistake in the if-else statement and in the string array declaration (in case you find some wrong spelling in my example)
The "months" and "days" jcombobox are visible in the jframe, never made a mistake with the jcomboboxes in the gui I'm making right now