Hallo zusammen,
jemand eine Idee warum mein Frame nicht die Farbe anpasst?
Was mache ich hier falsch?
[CODE lang="java" highlight="24,25"]import javax.swing.*;
import java.awt.*;
public class InfoFrame extends JFrame {
static JLabel text;
public InfoFrame() {
setVisible(true);
setSize(300, 100);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setLocationRelativeTo(null);
setTitle("Boss Info");
setResizable(false);
setLayout(null);
text = new JLabel();
setForeground(Color.BLUE);
setBackground(Color.BLACK);
text.setBounds(0, 15, 300, 20);
add(text);
}
public static void setStatus(String status) {
text.setText(status);
}
}
[/CODE]
So sieht das ganze dann aus

jemand eine Idee warum mein Frame nicht die Farbe anpasst?
Was mache ich hier falsch?
[CODE lang="java" highlight="24,25"]import javax.swing.*;
import java.awt.*;
public class InfoFrame extends JFrame {
static JLabel text;
public InfoFrame() {
setVisible(true);
setSize(300, 100);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setLocationRelativeTo(null);
setTitle("Boss Info");
setResizable(false);
setLayout(null);
text = new JLabel();
setForeground(Color.BLUE);
setBackground(Color.BLACK);
text.setBounds(0, 15, 300, 20);
add(text);
}
public static void setStatus(String status) {
text.setText(status);
}
}
[/CODE]
So sieht das ganze dann aus

Zuletzt bearbeitet: