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 / General / July 2007

Tip: Looking for answers? Try searching our database.

Can One Clip to a Box while Drawing on a <JPanel>?

Thread view: 
kvnsmnsn@hotmail.com - 30 Jul 2007 16:29 GMT
Is there some way to draw on a <JPanel> or write a <String> to it in
such a way that only the portion of what I'm drawing or writing that
takes place inside a box gets shown?  I'd like to have three windows
show up in my <JPanel>, and I'd like to draw things to them, but it's
possible that the things I'm drawing to them might extend beyond one
such window's boundaries and I don't want that to happen.  For ex-
ample, if I'm drawing "the sky is blue" to one such window and the
lower part of that string would end up outside the window's bounda-
ries, then I only want the top part of each character to be drawn.

                               ---Kevin Simonson

"You'll never get to heaven, or even to LA,
if you don't believe there's a way."
from _Why Not_
Daniel Pitts - 30 Jul 2007 17:31 GMT
On Jul 30, 8:29 am, kvnsm...@hotmail.com wrote:
> Is there some way to draw on a <JPanel> or write a <String> to it in
> such a way that only the portion of what I'm drawing or writing that
[quoted text clipped - 11 lines]
> if you don't believe there's a way."
> from _Why Not_

There are two ways to do this, but the best way would be to have each
of your "boxes" be individual components, such as JComponent.

Alternatively, you can use Graphics.setClip(), but its definitely
better to go the JComponent approach.


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.