private BufferedImage image;
public ImagePanel() {
try {
image = ImageIO.read(new File("image name and path"));
} catch (IOException ex) {
// handle exception...
}
}
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawImage(image, 0, 0, null); // see javadoc for more info on the parameters
}
what is the equivalent in codenameone? how do i position it manually the to the (x,y) i want?
place base.png under src/ folder and check if the images are in the jar file.
place base.png under src/ folder and check if the images are in the jar file.
--
You received this message because you are subscribed to the Google
Groups "CodenameOne Discussions" group.
For more information about Codename One please visit http://www.codenameone.com/
To post to this group, send email to
codenameone...@googlegroups.com
To unsubscribe from this group, send email to
codenameone-discu...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/codenameone-discussions?hl=en?hl=en
Its best not to override paint or define a painter in Codename One, you can show an image either by setting an icon to a label or by setting it as a bgImage to a style object e.g. component.getUnselectedStyle().setBgImage(...);