Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-23-2008, 12:07 AM
Moderator
 
Join Date: Nov 2007
Posts: 1,637
Java Tip will become famous soon enoughJava Tip will become famous soon enough
Area Add
Code:
import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.geom.Area; import java.awt.geom.Ellipse2D; import javax.swing.JApplet; import javax.swing.JFrame; public class AreaAdd extends JApplet { Ellipse2D.Double circle = new Ellipse2D.Double(); Ellipse2D.Double oval = new Ellipse2D.Double(); Area circ = new Area(circle); Area ov = new Area(oval); public void init() { setBackground(Color.white); } public void paint (Graphics g) { Graphics2D g2 = (Graphics2D) g; double halfWdith = getSize().width/2; double halfHeight = getSize().height/2; circle.setFrame(halfWdith-25, halfHeight, 50.0, 50.0); oval.setFrame(halfWdith-19, halfHeight-20, 40.0, 70.0); circ = new Area(circle); ov = new Area(oval); circ.add(ov); g2.fill(circ); } public static void main(String s[]) {JFrame f = new JFrame("Pear"); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) {System.exit(0);} }); JApplet applet = new AreaAdd(); f.getContentPane().add("Center", applet); applet.init(); f.pack(); f.setSize(new Dimension(150,200)); f.show(); } }
__________________
Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
to our beloved Java Forums! (closes on July 27, 2008)
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Area Subtract Java Tip java.awt 0 06-23-2008 12:07 AM
Area Intersect Java Tip java.awt 0 06-23-2008 12:07 AM
Text Area problem mcal New To Java 0 02-11-2008 10:42 PM
textfiled and text area to UTF-16? Mr tuition AWT / Swing 0 12-04-2007 01:40 PM
Print Area Riftwalker Advanced Java 0 11-28-2007 08:28 PM


All times are GMT +3. The time now is 04:37 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org