Witam mam problem z lista rozwijalna. Jesli wybieram dany kolor, kolor pola tekstowego sie nie zmienia.:
JPanel cont = new JPanel();
textArea = new JTextArea("");
Choice cols = new Choice();
cols.add("Kolor tekstu:");
cols.add("Czerwony");
cols.add("Zielony");
cols.add("Żółty");
cols.add("Niebieski");
cols.add("Różowy");
cols.add("Cyrankowy");
cols.add("Czarny");
cols.add("Szary");
....
cont.add(cols, BorderLayout.SOUTH);
..
public void itemStateChanged(ItemEvent e)
{
switch(cols.getSelectedIndex( ))
{
case 1:
textArea.setBackground(Color.red);
break;
case 2:
textArea.setBackground(Color.green);
break;
case 3:
textArea.setBackground(Color.yellow);
break;
case 4:
textArea.setBackground(Color.blue);
break;
case 5:
textArea.setBackground(Color.pink);
break;
case 6:
textArea.setBackground(Color.cyan);
break;
case 7:
textArea.setBackground(Color.black);
break;
case 8:
textArea.setBackground(Color.gray);
break;
}
}