Results 1 to 2 of 2
- 07-10-2007, 05:08 PM #1
Member
- Join Date
- Jul 2007
- Posts
- 3
- Rep Power
- 0
Rectangle expands with applet frame
Hello,
I've been trying to get this program to work that when I expand the applet frame the rectangle will expand with it. Any ideas on how I can fix it or any good sources worth reading. Thanks for any help.
Java Code:import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Rectangle; import java.applet.Applet; import java.awt.*; public class blueRectangle extends Applet { public void paint(Graphics g) { Graphics2D g2 = (Graphics2D)g; Rectangle box = new Rectangle(0, 0, 200, 100); g2.draw(box); Color BLUE = new Color(0.0F, 0.0F, 1.0F); g2.setColor(Color.blue); g2.fill(box); } }
- 07-10-2007, 07:14 PM #2
If this is an applet, you wont need this because applet sizes are not dynamic. You specify the size inside html files.
If this was a jframe, i would suggest you to get the size of the frame, capture windowResized event, rescale the rectangle dimensions there and call repaint to redraw frame. But for applet i don't think there is a appletResized event. :)
Similar Threads
-
Rectangle Intersection
By Gwindow in forum Java 2DReplies: 1Last Post: 04-24-2008, 03:53 PM -
help with rectangle class
By darkgt in forum New To JavaReplies: 7Last Post: 11-14-2007, 06:19 PM -
Frame Query
By Daniel in forum AWT / SwingReplies: 1Last Post: 07-05-2007, 06:27 PM -
Web Services - IBM Expands SOA Management Practice
By Felissa in forum Web FrameworksReplies: 0Last Post: 06-25-2007, 04:08 AM -
Rectangle with rounded edges??
By orchid in forum Java 2DReplies: 1Last Post: 05-10-2007, 02:31 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks