Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

graphics  RSS feed

 
rob armstrong
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
haveing trouble figureing out this problem....

1. Want to setup a JFrame with a Picture (jpeg) in the background. (complete)
2. Want to add a SHAPE (Ellipse2D.Float) to the JFrame and have the the 1st Jpeg still visible behind the Shape (Ellipse2D.Float).

How does one do this?
 
Matti Poro
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Extend a JPanel and override its paintComponent-method. Then use JFrame's setContentPane-method on the JPanel.



To draw an ellipse write the appropriate code at the end of paintComponent-method.
 
rob armstrong
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your help. I have to problems left i can't figure out.

cannont find symbol class BufferredImage
and
cannont find symbol variable ImageIO


roba
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Googling for "BufferedImage site:java.sun.com" and "ImageIO site:java.sun.com" will get you the javadocs for those classes.
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One easy way to find out the package of a class is to go to the API:

http://java.sun.com/j2se/1.4.2/docs/api/

Use your browser to search in the "All Classes" frame for the class
in question. Click on it and its page will appear in the right frame.
The package name will appear just above the class name. Try it now
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Talk about "teaching a man to fish"! Now he knows fly fishing and ice fishing!
[ January 04, 2006: Message edited by: Jeff Albrechtsen ]
 
rob armstrong
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
looking at the api i still dont fully understand how the JComponent works and what i have to manipulate to get it to work. Is there a recomended book or something i can get help with on reading the api or Swing?
roba
 
rob armstrong
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok got it working fine now. Thanks for your help!
roba
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!