Ich versuche etwas zu machen, aber mein Label "Geld" erscheint nicht und ich weiß nicht warum. Ich habe versucht, es für eine Weile zu beheben. Das ist mein Code:Warum erscheint mein Etikett nicht? (Java)
public class main {
static int amountOM = 200;
static JFrame jf = new JFrame("Game");
static JPanel jp = new JPanel();
static JPanel jp2 = new JPanel();
static JButton exit = new JButton("Exit");
static JLabel money = new JLabel("$ "+amountOM);
public static void main(String[] args){
start();
}
public static void start() {
jf.setLayout(null);
jf.pack();
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jf.setSize(500, 500);
jf.setLocationRelativeTo(null);
jf.setResizable(false);
jp.setLocation(0, 0);
jp.setSize(400, 500);
jp2.setLocation(400, 0);
jp2.setSize(100, 500);
exit.setLocation(405, 10);
exit.setSize(85,50);
money.setLocation(405, 200);
money.setSize(100,50);
jp2.setBackground(Color.gray);
money.setBackground(Color.black);
jf.add(jp);
jf.add(jp2);
jf.add(exit);
jf.add(money);
jf.setVisible(true);
}
}
Wenn Sie das Problem kennen, bitte sagen Sie mir. Vielen Dank.
(es hält mir zu sagen, dass meine Post meist Code ist und bitte mehr Details so im hier diesen Text hinzufügen)
Ist die Taste angezeigt? – Hackerdarshi