How to make a floating JToolBar resizeable?

  • Follow


I want to make panels from my application to be detachable from the main 
application window. This can be done, if I use JToolBar instances and 
place the desired JPanels inside these toolbars. This works fine, but:

1. I do not know how to put the names in the title bars of created 
windows when I drag out my toolbars.
2. How to make these detached windows resizeable?

Any help with this or other suggestion on how to implement detachable 
panels (like in JBuilder IDE) would be appreciated.

Boris Yamrom
0
Reply Boris 9/24/2004 7:43:01 PM

Boris Yamrom wrote:
> I want to make panels from my application to be detachable from the main 
> application window. This can be done, if I use JToolBar instances and 
> place the desired JPanels inside these toolbars. This works fine, but:
> 
> 1. I do not know how to put the names in the title bars of created 
> windows when I drag out my toolbars.
> 2. How to make these detached windows resizeable?
> 
> Any help with this or other suggestion on how to implement detachable 
> panels (like in JBuilder IDE) would be appreciated.
> 
> Boris Yamrom

Well, I have figured out the first:

  toolbar.setName("Name");

The second is still a mystery.

Boris Yamrom
0
Reply Boris 9/24/2004 7:59:51 PM


In article <41547C10.7070905@verizon.net>,
 Boris Yamrom <byamrom@verizon.net> wrote:

>:Boris Yamrom wrote:
>:> I want to make panels from my application to be detachable from the main 
>:> application window. This can be done, if I use JToolBar instances and 
>:> place the desired JPanels inside these toolbars. This works fine, but:
>:> 
>:> 1. I do not know how to put the names in the title bars of created 
>:> windows when I drag out my toolbars.
>:> 2. How to make these detached windows resizeable?
>:> 
>:> Any help with this or other suggestion on how to implement detachable 
>:> panels (like in JBuilder IDE) would be appreciated.
>:> 
>:> Boris Yamrom
>:
>:Well, I have figured out the first:
>:
>:  toolbar.setName("Name");
>:
>:The second is still a mystery.
>:
>:Boris Yamrom

I think you'll have to subclass BasicToolbarUI to handle that part.  
When you drag a toolbar away from its docked location, a JDialog is 
created by this class (the toolbar's UI delegate).  Its protected 
createFloatingWindow method handles this and returns what I believe is 
an instance of an inner JDialog subclass.  It calls setResizable(false) 
on that dialog before returning it.  Your subclass may be as simple as 
overriding this method to call the superclass method, get the dialog and 
call setResizable(true), and then return it.  Of course, I haven't dealt 
with the workings of the UI delegate in a while, so I could've forgotten 
some details.

= Steve =
-- 
Steve W. Jackson
Montgomery, Alabama
0
Reply Steve 9/24/2004 8:11:13 PM

Steve W. Jackson wrote:
> In article <41547C10.7070905@verizon.net>,
>  Boris Yamrom <byamrom@verizon.net> wrote:
> 
> 
>>:Boris Yamrom wrote:
>>:> I want to make panels from my application to be detachable from the main 
>>:> application window. This can be done, if I use JToolBar instances and 
>>:> place the desired JPanels inside these toolbars. This works fine, but:
>>:> 
>>:> 1. I do not know how to put the names in the title bars of created 
>>:> windows when I drag out my toolbars.
>>:> 2. How to make these detached windows resizeable?
>>:> 
>>:> Any help with this or other suggestion on how to implement detachable 
>>:> panels (like in JBuilder IDE) would be appreciated.
>>:> 
>>:> Boris Yamrom
>>:
>>:Well, I have figured out the first:
>>:
>>:  toolbar.setName("Name");
>>:
>>:The second is still a mystery.
>>:
>>:Boris Yamrom
> 
> 
> I think you'll have to subclass BasicToolbarUI to handle that part.  
> When you drag a toolbar away from its docked location, a JDialog is 
> created by this class (the toolbar's UI delegate).  Its protected 
> createFloatingWindow method handles this and returns what I believe is 
> an instance of an inner JDialog subclass.  It calls setResizable(false) 
> on that dialog before returning it.  Your subclass may be as simple as 
> overriding this method to call the superclass method, get the dialog and 
> call setResizable(true), and then return it.  Of course, I haven't dealt 
> with the workings of the UI delegate in a while, so I could've forgotten 
> some details.
> 
> = Steve =

Thank you, Steve. Worked marvelously. Exactly as you said.

Boris

0
Reply Boris 9/24/2004 11:09:33 PM

3 Replies
272 Views

(page loaded in 0.099 seconds)

Similiar Articles:




7/10/2012 8:02:52 PM


Reply: