erstmal der code (ist nur ein ausschnitt):
wenn ich in dem fenster auf den knopf "Anzeigen" klicke bekomme ich die ausgabe von "System.out.println(fvonxtyp.getSelectedItem())" (also Lineare Funktion)aber ich bekomme immernoch den das label "test" angezeigt......
warum ändert sich nicht die anzeige?
schonmal danke für hilfe
Java:
final JComboBox fvonxtyp=new JComboBox();
fvonxtyp.addItem("Lineare Funktion");
fvonxtyp.addItem("Quadratische Funktion");
fvonxtyp.addItem("Potenz Funktion");
fvonxtyp.addItem("Wurzel Funktion");
fvonxtyp.addItem("Exponential Funktion");
fvonxtyp.addItem("Trigonometrische Funktion (Sinus)");
fvonxtyp.addItem("Trigonometrische Funktion (Cosinus)");
fvonxtyp.addItem("Trigonometrische Funktion (Tangens)");
fvonxtyp.addItem("Logarithmische Funktion");
fvonxtyp.addItem("Kubische Funktion");
componentAdd(cont,gbl,fvonxtyp,0,0,1,1,0,0);
final JPanel[] jpanel=new JPanel[1];
jpanel[0]=new JPanel();
JButton b=new JButton("Anzeigen");
jpanel[0].add(new JLabel("test"));
final JPanel a=new JPanel();
a.add(new JLabel("erfolgreich"));
b.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent arg0) {
if(fvonxtyp.getSelectedItem()=="Lineare Funktion")
{jpanel[0]= /*new Lineare_Funktion()*/a;
System.out.println(fvonxtyp.getSelectedItem());
jpanel[0].repaint();repaint();};
if(fvonxtyp.getSelectedItem()=="Quadratische Funktion")
jpanel[0]=new Quadratische_Funktion();
if(fvonxtyp.getSelectedItem()=="Potenz Funktion")
jpanel[0]=new Potenz_Funktion();
if(fvonxtyp.getSelectedItem()=="Wurzel Funktion")
jpanel[0]=new Wurzel_Funktion();
if(fvonxtyp.getSelectedItem()=="Exponential Funktion")
jpanel[0]=new Exponential_Funktion();
if(fvonxtyp.getSelectedItem()=="Trigonometrische Funktion (Sinus)")
jpanel[0]=new Trigonometrische_Funktion_Sinus();
if(fvonxtyp.getSelectedItem()=="Trigonometrische Funktion (Cosinus)")
jpanel[0]=new Trigonometrische_Funktion_Cosinus();
if(fvonxtyp.getSelectedItem()=="Trigonometrische Funktion (Tangens)")
jpanel[0]=new Trigonometrische_Funktion_Tangens();
if(fvonxtyp.getSelectedItem()=="Logarithmische Funktion")
jpanel[0]=new Logarithmische_Funktion();
if(fvonxtyp.getSelectedItem()=="Kubische Funktion")
jpanel[0]=new Kubische_Funktion();
repaint();
}
});
wenn ich in dem fenster auf den knopf "Anzeigen" klicke bekomme ich die ausgabe von "System.out.println(fvonxtyp.getSelectedItem())" (also Lineare Funktion)aber ich bekomme immernoch den das label "test" angezeigt......
warum ändert sich nicht die anzeige?
schonmal danke für hilfe