• Post Reply Bookmark Topic Watch Topic
  • New Topic

swing image code returns empty page  RSS feed

 
muntago Richard
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please Expert, I want to display image from database but when i run the code it runs but displays an empty page .please help me fix the problem thanks

 
Rob Spoor
Sheriff
Posts: 21095
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The preferred size of each ImagePanel is 0x0. You should call setPreferredSize in the constructor, based on the image's size.
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or use JLabels with ImageIcons instead of JPanels which will take care of both sizing and painting without custom code.

Also, please learn how to format your code with indents for readability.
http://www.oracle.com/technetwork/java/codeconvtoc-136057.html
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!