🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.jbuilder.java.swing
5 messages
5 total messages Started by GUI-Majician Tue, 28 Dec 2004 16:09
Cursor won't display in components in a JWindow
#703
Author: GUI-Majician
Date: Tue, 28 Dec 2004 16:09
8 lines
1188 bytes
I have some input fields, like JTextField in a JPanel on a JWindow but I
can't get the cursor to show up in the text components.  These components
are not custom but regular Swing, so is the JWindow.  The components do
receive focus and you can type but no cursor!

Is there a way to force a new cursor?

Thanks.
Re: Cursor won't display in components in a JWindow
#705
Author: GUI-Majician
Date: Wed, 29 Dec 2004 16:24
27 lines
2533 bytes
"GUI-Majician" <nospam@centurytel.net> wrote in message
news:41d18515$1@newsgroups.borland.com...
> I have some input fields, like JTextField in a JPanel on a JWindow but I
> can't get the cursor to show up in the text components.  These components
> are not custom but regular Swing, so is the JWindow.  The components do
> receive focus and you can type but no cursor!
>
> Is there a way to force a new cursor?
>
Once again I have to answer my own questions. :-(

The problem is in the FocusManager.  It does not allow focus to travel from
one JWindow to another, or to the components that is.  You get focusGained()
but not focusLost(), windowActivated(), windowDeactivated() events.  This is
part of it anyway.  You can get the cursor (caret) to show up sometimes but
you cannot tab between fields.  JWindow does not work well with focus and
text input JComponents.  Java 1.5 has not solved the problem either.

I have my own conspiracy theory about this one, and it has everything to do
with Transparent Top Level Containers and JWindows.  So far as I know, I am
the only person on planet Earth thats figured out how to get it to work
(yeah me!).  Sun apparantly doesn't want you using JWindows $$$.  Does MS
have a patent on Transparent Frames???  There is definately something going
on between Sun and MS over JWindow.  So far I only see mutlimedia apps using
Transparent Top Levels, but none in Java, except my apps of course. ;-)

Bottom line is that JWindow is good for splash screens and thats about it.
Re: Cursor won't display in components in a JWindow
#706
Author: Lori M Olson [TeamB]
Date: Wed, 29 Dec 2004 18:09
37 lines
2549 bytes
GUI-Majician wrote:

> Once again I have to answer my own questions. :-(
> 

If you posted some code or some details, it would be easier to answer 
your questions.

> The problem is in the FocusManager.  It does not allow focus to travel from
> one JWindow to another, or to the components that is.  You get focusGained()
> but not focusLost(), windowActivated(), windowDeactivated() events.  This is
> part of it anyway.  You can get the cursor (caret) to show up sometimes but
> you cannot tab between fields.  JWindow does not work well with focus and
> text input JComponents.  Java 1.5 has not solved the problem either.

FocusManagers are largely deprecated as of JDK 1.4.  You want 
FocusTraversalPolicy.  And you can always write your own focus traversal 
policy if the default one is not doing what you want.

-- 

Regards,

Lori Olson [TeamB]

------------

Save yourself, and everyone else, some time and search the
newsgroups and the FAQ-O-Matic before posting your next
question.

Google Advanced Newsgroup Search
     http://www.google.ca/advanced_group_search
Other Newsgroup Searches:
     http://www.borland.com/newsgroups/ngsearch.html
Joi Ellis's FAQ-O-Matic:
     http://www.visi.com/~gyles19/fom-serve/cache/1.html
Re: Cursor won't display in components in a JWindow
#707
Author: GUI-Majician
Date: Wed, 29 Dec 2004 19:24
17 lines
1712 bytes
"Lori M Olson [TeamB]" <javadragon@techie.com> wrote in message
news:41d2f2d0$1@newsgroups.borland.com...
> GUI-Majician wrote:
>
> FocusManagers are largely deprecated as of JDK 1.4.  You want
> FocusTraversalPolicy.  And you can always write your own focus traversal
> policy if the default one is not doing what you want.
>
> Regards,
>
> Lori Olson [TeamB]

I don't think FocusTraversalPolicy is the problem.  There is a bug in
JWindow that prevents JComponents from displaying the Caret, plus you can't
move from field to field even if you click the component with the mouse.
Try creating a JWindow and then open a second JWindow from that window.  The
second JWindow's text components will not work.
Re: Cursor won't display in components in a JWindow
#711
Author: John McGrath [TeamB]
Date: Thu, 30 Dec 2004 06:11
24 lines
2025 bytes
On 12/28/2004 at 11:09:16 AM, GUI-Majician wrote:

> I have some input fields, like JTextField in a JPanel on a JWindow but I
> can't get the cursor to show up in the text components.  These components
> are not custom but regular Swing, so is the JWindow.  The components do
> receive focus and you can type but no cursor!

It sounds like the Window has no owner, or its owner is not visible.  If
that is the case, it cannot receive the focus.  For more information, see
the JavaDocs for the Window.isFocusableWindow() method.

If it makes sense for your window to have an owner Frame (or Dialog), then
make sure you specify it in the constructor.  If not, then consider using
a Frame instead of a Window.  You can make the Frame undecorated to
eliminate the title bar.

-- 
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
    http://www.JPMcGrath.net/newsgroups/e-mail.html
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads