Results 21 to 23 of 23
-
Re: How to add an ImageIcon on a JPanel???
I would use whatever layout works best for the situation. In my code, I used the JPanel layout default, which you are correct, is FlowLayout.
You can use a JCompnent, but if all you're doing with it is showing the image, a JLabel does this much more simply and easily. If you use a JComponent, you'd have to also override getPreferredSize and have it return the size of the image. You might also would need to override getSize if you use null layout.so I can not use a generic JComponent, but I have to define the avatar as a JLabel right?
If you have a container use null layout, then you the coder are directly responsible for specifying the container's components' sizes and locations. I would only use this layout if I wanted to have the user manually drag a component around or if I wanted to animate the motion of a component.why if I set the layout = null the image does not appear?
- 12-19-2011, 12:51 PM #22
Member
- Join Date
- Dec 2011
- Posts
- 24
- Rep Power
- 0
Re: How to add an ImageIcon on a JPanel???
Anyway thank you so much!!!
-
Similar Threads
-
JFrame+JPanel+JButton+JtextArea+ImageIcon
By zusss in forum AWT / SwingReplies: 11Last Post: 02-18-2011, 10:40 AM -
Need help with ImageIcon and int
By proceeded in forum New To JavaReplies: 9Last Post: 01-23-2011, 10:10 PM -
ImageIcon HELP!
By ben1989 in forum New To JavaReplies: 1Last Post: 05-05-2010, 08:48 PM -
send imageIcon over RMI
By nadia in forum Advanced JavaReplies: 4Last Post: 01-06-2009, 03:41 PM -
ImageIcon and size
By wokena in forum Java 2DReplies: 3Last Post: 12-21-2008, 08:47 AM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks