Hey ho, was mach ich falsch?
Ich habe folgendes:
Bei "f.setLabelText(label, "trololo");" kommt:
label cannot be rosolved as Variable
Was kann ich da machen?
LG
Water
Ich habe folgendes:
Java:
public Nebenklasse(){
frame = new JFrame();
frame.setSize(new Dimension(250,300));
frame.setLocationRelativeTo(null);
frame.setVisible(true);
label = new JLabel();
label.setVerticalAlignment(SwingConstants.CENTER);
label.setHorizontalAlignment(SwingConstants.CENTER);
label.setVisible(true);
frame.add(label);
}
public void setLabelText(JLabel label, String text){
label.setText(text);
}
Java:
import javax.swing.*;
public class Hauptklasse {
public static void main(String[] args) {
Nebenklasse f = new Nebenklasse();
f.setFrameText("Kappa");
f.setLabelText(label, "trololo");
}
}
Bei "f.setLabelText(label, "trololo");" kommt:
label cannot be rosolved as Variable
Was kann ich da machen?
LG
Water