Results 1 to 2 of 2
Thread: ...---::Graphics HELP! ::---...
- 09-20-2012, 08:21 PM #1
Member
- Join Date
- Dec 2011
- Posts
- 28
- Rep Power
- 0
...---::Graphics HELP! ::---...
Here is my code and it dosent seem to print a rectangle on the screen, why is that! Can anyone please take a took for me!

Java Code:package dharavsGraphics; import java.awt.Color; import java.awt.Graphics2D; import java.awt.Image; import java.awt.geom.Rectangle2D; import javax.swing.ImageIcon; import javax.swing.JFrame; import dharavGraphics.Graphics; public class Main extends JFrame{ public void paint (Graphics2D g) { Graphics2D ga = (Graphics2D)g; int x=900, y=900; Rectangle2D.Double square = new Rectangle2D.Double(10,10,880,880); ga.draw(square); ga.setColor(Color.black); } public static void main(String[] args) { JFrame frame = new Graphics(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(900,900); frame.setVisible(true); } }
- 09-20-2012, 09:15 PM #2
Re: ...---::Graphics HELP! ::---...
Go through this Lesson: Performing Custom Painting (The Java™ Tutorials > Creating a GUI With JFC/Swing)
You're doing it wrong.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
SVG graphics
By Lacrim in forum Advanced JavaReplies: 2Last Post: 06-09-2012, 12:54 AM -
Graphics 2D
By scopene in forum Java 2DReplies: 0Last Post: 03-26-2012, 01:21 AM -
Graphics g
By fatabass in forum New To JavaReplies: 9Last Post: 12-25-2011, 12:22 AM -
Drawing a graphics onto another Graphics ?
By Ziden in forum Java AppletsReplies: 0Last Post: 01-08-2011, 07:30 PM -
Help with 2d graphics please
By xbox_nutter in forum New To JavaReplies: 0Last Post: 04-02-2009, 11:48 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks