The Artima Developer Community
Sponsored Link

Java Answers Forum
A drawingprogram

6 replies on 1 page. Most recent reply: Feb 3, 2004 10:50 AM by Patrik Larsson

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 6 replies on 1 page
Patrik Larsson

Posts: 4
Nickname: mrx
Registered: Jan, 2004

A drawingprogram Posted: Jan 26, 2004 8:38 AM
Reply to this message Reply
Advertisement
I'm creating a drawingprogram using awt components and I've made it possible to draw filled and nonfilled rectangles, nonfilled rectangles and to erase an area by drawing a rectangle, all by using the Graphics object that is associated with the canvas object that I use. To be able to redraw the picture if needed, I am using a linked list to store the shapes in. I'm using a linked list because I don't know any other datastructure. But soon I'll learn more about datastructures in school...

Now to my problem...

I want to be able to draw and erase by freehand using "brushes" of different size, how do I make this possible.

Regards,

Patrik


mausam

Posts: 243
Nickname: mausam
Registered: Sep, 2003

Re: A drawingprogram Posted: Jan 27, 2004 4:15 AM
Reply to this message Reply
Whenver user selects the option for a certain type change the font of the graphics accordingly.

There is the method .setFont where u can set the font with ur size.

Patrik Larsson

Posts: 4
Nickname: mrx
Registered: Jan, 2004

Re: A drawingprogram Posted: Jan 28, 2004 1:05 AM
Reply to this message Reply
mausam, you didn't answer my question I think...

I just wanted to know what method(s) I must call to be able to DRAW by freehand, in other word, I wish to color the pixles where the mouse is. If I need to get a hold of the whole pixle matrix of the canvas, then how do I do this?

Mrutunjay Chell

Posts: 1
Nickname: mrutunjay
Registered: Jan, 2004

Re: A ststusbar program Posted: Jan 28, 2004 10:04 PM
Reply to this message Reply
can i color the statusbar in java.
and
the foreground color of text .
Mrutunjay
thanks

mausam

Posts: 243
Nickname: mausam
Registered: Sep, 2003

Re: A drawingprogram Posted: Jan 29, 2004 2:36 AM
Reply to this message Reply
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Robot.html

This class will be very useful to u to make a drawing programme.

mausam

Posts: 243
Nickname: mausam
Registered: Sep, 2003

Re: A ststusbar program Posted: Jan 29, 2004 2:42 AM
Reply to this message Reply
U can set foreGround and backGround of amy JComponent

setForeground(Color cl) w//ll change the text colour assoociated with the component

and setBackGround(Color cl)

Patrik Larsson

Posts: 4
Nickname: mrx
Registered: Jan, 2004

Re: A ststusbar program Posted: Feb 3, 2004 10:50 AM
Reply to this message Reply
Yes you can, but you'll have to do it in the implementation. You could make a dialog where the user can change the color of almost any component and all text.
Thanks,
Patrik

Flat View: This topic has 6 replies on 1 page
Topic: how to open .chm? Previous Topic   Next Topic Topic: Why it behaves differently?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use