This site requires JavaScript, please enable it in your browser!
Greenfoot
Username
Password
Remember Me?
Sign Up, Lost Password
Activity
About
Documentation
Download
Discuss
Scenarios
baileyjstewart
wrote ...
2014/1/7
image in JFrame
baileyjstewart
2014/1/7
#
Hi! I've been trying to add an image in a JFrame using a JLabel. Once I compile the data, the images don't show up. It's a grey screen. I've debugged the code and it should work, but it doesn't. Anyone that can help, that would be great!
baileyjstewart
2014/1/7
#
here is my code if(player1points == player2points) { //JOptionPane.showMessageDialog(null, " " + Player1 + " and " + Player2 + " TIE!"); winnerMessage = new JLabel(" " + Player2 + " and " + Player1 + " TIE!!!"); System.out.println("last one works"); spades = new JLabel(""); clubs = new JLabel(""); spades.setIcon(new ImageIcon("pik.png")); clubs.setIcon(new ImageIcon("kreuz.png")); myWinnerPanel = new JPanel(); winner.setSize(500, 500); winner.setLocationRelativeTo(null); myWinnerPanel.add(winnerMessage); myWinnerPanel.add(clubs); myWinnerPanel.add(spades); winner.setTitle("WINNER"); winner.add(myWinnerPanel); winner.setVisible(true);
You need to login to post a reply.
X