Try extending JPopupMenu and then using your popup subclass in you
JComboBox. If you look at the Sun source code for ComboBoxUI you will see
how the popup menu is set. By using a subclass of JPopupMenu in your
JComboBox, it will automatically know when to appear as a 'heavyweight'
window that exends beyond your frame border.

-----Original Message-----
From: Charles Hymes
To: 'Greg Munt'; '[EMAIL PROTECTED]'
Sent: 2/8/02 2:29 PM
Subject: RE: How to make "pulldowns" and "popups" overlap a containers bor
der?

Hi Greg,

Thanks for the response, I hope you don't mind a more detailed response.

How would changing the "look and feel" of a JComboBox help place a JTree
in the pulldown?

I would LOVE to reuse, but it seems to me that a new component is the
only way to go.

I am extending JComboBox, but only because I want ((JComboTree
isinstance JComboBox) == true). I have not figured out any way to
replace the list of the JComboBox with a JTree.

So I'm creating a new component. You say "create a new component with a
L&F based on that of a combo box". Do you mean that I should not extend
JComboBox, but instead extend ComboBoxUI? Interesting, That may make
more since....

So now I'm looking at ComboBoxUI, BasicComboBoxUI, and MetalComboBoxUI.
But this leads me back to the same implementation questions, namely how
to duplicate the observed behavior of Swing combo boxes and menus, where
the list has the ability to descend beyond the JFrame's border.

I'm interpreting your last two comments to mean that a JWindow is
implemented as a native peer, and will give the appearance of a pulldown
extending beyond the "parent" windows borders. Is this what you meant?

Thanks!

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Greg Munt
Sent: Friday, February 08, 2002 4:19 AM
To: Charles Hymes; [EMAIL PROTECTED]
Subject: Re: How to make "pulldowns" and "popups" overlap a containers
border?


You will need to look at changing the L&F of a combo box, I'd imagine.
Or create a new component with a L&F based on that of a combo box. Why
duplicate behaviour? Reuse it, where possible.
 
If the popup extends beyond the window frame, a component with a native
peer is used.
 
If by "frame" you mean the window borders and title bar, use a JWindow
instead of a JDialog.

----- Original Message ----- 
From: Charles Hymes <mailto:[EMAIL PROTECTED]>  
To: '[EMAIL PROTECTED]' <mailto:'[EMAIL PROTECTED]'>  
Sent: Thursday, February 07, 2002 7:26 PM
Subject: How to make "pulldowns" and "popups" overlap a containers
border?


Hi folks, 
I'm creating a TreeCombobox, when activated, the pulldown contains a
JTree instead of a list. 
I was going to implement the pulldown as a JPanel, and place it in the
JLayeredPane.POPUP_LAYER but I discovered that the panel is truncated at
the window's borders.

Real Swing components that use popups, such as JMenus and JCombox,
extend beyond any window's border. What is the best way to duplicate
this behavior? 

I figure that there is no way to remove the "frame" from a JDialog, is
that true? 

Charlweed 

_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to