Trouble with CardLayout (I think)

A

AJ

I have an application that looks like this:

--------------------------
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
--------------------------


The thing on the left is a JPanel with Buttons and other things on it.
The thing on the right is a JPanel with a CardLayout. I am having a
problem with the various cards in the CardLayout receiving mouse
clicks. As of now, I only have 2 cards in my card layout. One is a
JEditorPane, and one is a Java X Server application. The applications
which I display on the X Server in the one card don't seem to get
keyboard input. The html I am displaying in the JEditorPane doesn't
respond to hyperlinks (Yes, I did make it a hyperlinkistener). The
code in question seems to work fine in sample applications that don't
use the CardLayout. Any ideas?

Thanks!

AJ
 
A

Andrew Thompson

.....
| ...The
| code in question seems to work fine in sample applications that
don't
| use the CardLayout. Any ideas?

Try to add both of the Panels into a GridLayout
instead of CardLayout, and see if _that_ works.
If it does, it strongly indicates the CardLayout is
the problem..
 
W

Wilhelm Stockhammer

I once wrote an applet for conversion of arabic numbers to roman.
I added the two numpads (one for arabic and one for roman), that
contained the numbers in form of clickable buttons, into a cardlayout.
I had a similiar problam as you. The buttons did not respond to
mouse-clicks.
I found out, that after changing the size of the browser-window, the
application worked properly. (which, I must confess is not very
satisfying as a solution, but it may point out that the problem
is maybe on the hand of the window manager or the vm).
I made that experience on a Debian Linux system.

Willi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top