MichaelT4646 / Group8

0 stars 0 forks source link

Using for loops on initializing/declaring frames #6

Open Andrew231456 opened 3 years ago

Andrew231456 commented 3 years ago

In DrawingPanel.java, there seems to be a lot of repetition on the code such as from line 61 - line 81 which says

JComboBox comboBox1 = new JComboBox();
JComboBox comboBox2 = new JComboBox();
etc...

and many more occurance in the code doing the same thing, there could be a simpler way to initialize and declare these objects such as maybe:

JComboBox[] ComboBox = new JComboBox [20];

for (i=0;i<ComboBox.length; i++)
{
    JComboBox comboBox[i] = new JComboBox();
}

or something along those lines would provide readability, organization and much more as there would be fewer lines and could be way faster to edit the code for future updates.

Although this might not be possible with the current package to make it im sure there is a way to make the code more readable and organized, what do you think?

MichaelT4646 commented 3 years ago

Hey Andrew! I totally agree with you! I think adding this for loop would be really useful for our code. It would also make it way more presentable and easier to read. We already did something similar on line 50-54, and it seems to have worked very well there.

Sadjell commented 3 years ago

Hi Andrew! I think it's a great idea to add the loops. It was really annoying to write all those lines of code, it was receptive. This seems to be a more efficient was of writing the code.