Pictures in a JFrame in Java

TRARP

Junior Member
Sep 21, 2007
7
0
0
Hi, Mike again, thanks for the help earlier.
I have most of my program running now except im having difficulty adding bitmaps anywhere. After browsing the internet for quite a while, i came up with this:

ImageIcon image = new ImageIcon("filepath.bmp");
Picture1.add(image, BorderLayout.North);

Picture1 is the name of my JLabel, but no dice.

This would make sense to me, but the first line wont compile, saying there are two illegal escape characters. Dunno what the problem is and would appreciate the help if possible.
 

Onund

Senior member
Jul 19, 2007
287
0
0
Strange, it will compile for me. I copy/pasted your line above and hit compile. Are you sure the program is dying at compile time and not runtime when it hits that line?

For all things Java, I look at the java.sun.com site. That site is the reason why I love Java. Here is the tutorial page for using icons, maybe it will help
http://java.sun.com/docs/books...g/components/icon.html