Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / March 2008

Tip: Looking for answers? Try searching our database.

Color of a pixel of a JPanel

Thread view: 
mearvk - 04 Mar 2008 08:37 GMT
I'm stuck and tired.

How can I find the color of an arbitrary pixel of a JPanel or
JComponent for that matter? Something like: getColor(x, y) is all I
really need.

Also while I'm posting is this a cleverer way than color
differentiation (hence the above question) to satisfy an arbitrary
(custom) Shape's contains(Point2D p) method? I let the user draw a
pair of identical CubicCurve2D curves and connect them with a pair of
Line2Ds. I need a good way to determine, for an arbitrary "strip", if
an arbitrary point is in or out of it. I would even settle for a way
to get at all the points Graphics2D fills when I do a
g2.fill(myShape).

[API]

contains(Point2D p)
Tests if a specified Point2D is inside the boundary of the Shape.

http://java.sun.com/javase/6/docs/api/index.html

[API]

Thanks!
Daniel Pitts - 04 Mar 2008 20:13 GMT
> I'm stuck and tired.
>
[quoted text clipped - 21 lines]
>
> Thanks!
Look up GeneralPath (or Path2D in version 1.6)
You can create your own Shape object based on several other shapes, and
then you can call .contains.

Signature

Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>

mearvk - 05 Mar 2008 09:02 GMT
On Mar 4, 3:13 pm, Daniel Pitts
<newsgroup.spamfil...@virtualinfinity.net> wrote:
> > I'm stuck and tired.
>
[quoted text clipped - 30 lines]
>
> - Show quoted text -

Thanks.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.