Das ist die Erste Klasse:
Und das ist die zweite Klasse:
Wieso erscheint JTextLabel nicht?
Java:
public class Datentypen2{
public static void main(String[] args){
DatentypenMethoden2.menüframe();
}
}
Und das ist die zweite Klasse:
Java:
import javax.swing.*;
import java.awt.*;
public class DatentypenMethoden2 {
public static void menüframe(){
JFrame frame = new JFrame();
frame.getContentPane().setBackground(Color.gray.darker());
frame.setSize(500, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
frame.setLocationRelativeTo(null);
frame.setResizable(false);
frame.setTitle("Datentypen");
JLabel label = new JLabel();
JTextArea textarea = new JTextArea(10,10);
label.add(textarea);
frame.add(label);
}
}
Wieso erscheint JTextLabel nicht?