View Single Post
  #4 (permalink)  
Old 12-08-2007, 06:54 PM
hardwired hardwired is offline
Senior Member
 
Join Date: Jul 2007
Posts: 1,189
hardwired is on a distinguished road
In working with null layout you can add the label and call setBounds on it to position it. Use the image width and height for the bounds width and height. You can always set an etched border on it (temporarily, during development) to see its size.
The other option is to draw the image on the panel:
Code:
class Pseudo extends JPanel { BufferedImage image; Pseudo(BufferedImage image) { this.image = image; // or load it in this class setLayout(null); add components... } protected void paintComponent(Graphics g) { super.paintComponent(g); int x = int y = g.drawImage(image, x, y, this); } }
Reply With Quote