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 2006

Tip: Looking for answers? Try searching our database.

possible to create a borderless rounded JPanel / JDialog

Thread view: 
dtown22@gmail.com - 20 Mar 2006 18:13 GMT
Hi,

I want to create a small popup information bubble (similar to the ones
that pop up above the task bar in windows), but I cant seem to figure
out how to do this, if someone could point me in the right direction, I
would greatly appreciate it.

I have succesfully created a rounded JPanel, but I cant make it visible
(my guess is because it is not contained within a JDialog/JFrame), I
have thought about using popups, but I am having a similar problem.
Thomas Weidenfeller - 20 Mar 2006 18:25 GMT
> I want to create a small popup information bubble (similar to the ones
> that pop up above the task bar in windows),

A Tooltip? Then using a window is probably the wrong way to do it. Check
the Tooltip class in case you are talking about a tooltip.

> but I cant seem to figure
> out how to do this, if someone could point me in the right direction, I
> would greatly appreciate it.
>
> I have succesfully created a rounded JPanel,

Which will not help you, and will not really work.

> but I cant make it visible
> (my guess is because it is not contained within a JDialog/JFrame), I
> have thought about using popups, but I am having a similar problem.

See Q3.5 of the FAQ. Java 1.6 will have some changes in the desktop
integration department, but I didn't check if they add such features.

/Thomas

Signature

The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/

dtown22@gmail.com - 20 Mar 2006 18:36 GMT
Basically, a tooltip is what I want, however, I want to be able to
round the edges, and add a little arrow on the side of it, but I havent
been able to control the way the tooltip is displayed (i.e. its shape)
Steve W. Jackson - 20 Mar 2006 20:22 GMT
> Basically, a tooltip is what I want, however, I want to be able to
> round the edges, and add a little arrow on the side of it, but I havent
> been able to control the way the tooltip is displayed (i.e. its shape)

Looking inside Sun's code, a tooltip is a javax.swing.Popup, and it
would appear to create a JWindow for its display.  So perhaps you could
work out how to round its corners.

= Steve =
Signature

Steve W. Jackson
Montgomery, Alabama

Thomas Weidenfeller - 21 Mar 2006 09:11 GMT
> Basically, a tooltip is what I want, however, I want to be able to
> round the edges, and add a little arrow on the side of it, but I havent
> been able to control the way the tooltip is displayed (i.e. its shape)

You usually can't. As pointed out in the FAQ, typically the heavyweight
top-level windows are non-transparent, rectangular windows. With the
exception of what Apple does in their Java implementation.

/Thomas
Signature

The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/

Andrey Kuznetsov - 21 Mar 2006 09:26 GMT
>> Basically, a tooltip is what I want, however, I want to be able to
>> round the edges, and add a little arrow on the side of it, but I havent
[quoted text clipped - 3 lines]
> top-level windows are non-transparent, rectangular windows. With the
> exception of what Apple does in their Java implementation.

probably you can use JNIWrapper to make Java Window transparent (on M$
Windows).

Andrey

Signature

http://uio.imagero.com Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities

Andrey Kuznetsov - 21 Mar 2006 09:29 GMT
>>> Basically, a tooltip is what I want, however, I want to be able to
>>> round the edges, and add a little arrow on the side of it, but I havent
[quoted text clipped - 6 lines]
> probably you can use JNIWrapper to make Java Window transparent (on M$
> Windows).

hmm, Linux and Mac seems to be supported too.

Andrey

Signature

http://uio.imagero.com Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities

JFalt - 22 Mar 2006 21:59 GMT
You could put that JPanel in a JFrame and then use the
setUndecorated(true) function on the JFrame.

As far as making it rounded, you could probably do some kind of hack
where you could get the color of the desktop at the popup position
(using something like java.awt.Robot getPixelColor()) and then make the
JPanel rounded by creating a custom paintComponent() and then setting
the background to whatever getPixelColor() returns, thus creating the
illusion that it is rounded.  This is certainly a hack though.
Lars - 23 Mar 2006 10:51 GMT
> You could put that JPanel in a JFrame and then use the
> setUndecorated(true) function on the JFrame.
[quoted text clipped - 5 lines]
> the background to whatever getPixelColor() returns, thus creating the
> illusion that it is rounded.  This is certainly a hack though.

Another (well known?) hack for your problem:
"Create translucent and shaped windows, while avoiding native code,
with clever use of a screenshot."
http://www.onjava.com/pub/a/onjava/excerpt/swinghks_hack41/index.html


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.