Probably a stupid question but I can't figure it out for the life of me. I have this code :
JFrame frame = new JFrame("Game Window"); frame.setVisible(true); frame.setExtendedState(JFrame.MAXIMIZED_BOTH); JPanel Panel = new JPanel(); frame.add(Panel); Panel.add(new JLabel("<html>This is turn </html>"));
However, it prints turnCounter in italics and not the value of the variable. I've also tried %d but not too sure of the syntax. It makes the whole GUI turn blank so I'm guessing something is wrong. Would really appreciate some help !
Not tested:
turnCounterPanel.add(new JLabel( String.format( "<html>This is turn %d turnCounter %d </html>", var, var ) ));
2.1m questions
2.1m answers
60 comments
57.0k users