how to get event 'out of the class'

I have been reading myself silly about this, I either don't get it or it is very difficult.

What I want to do:

1) setup

2) show panel

3) handle input in panel

4) once valid

5) "get out"

6) display other panel.

I can go all the way to 4.

But I can't get "out" of the panel.

All I can guess/understand is that I have to trigger an event that will be handled below/outside this panel.

Has anybody some idea how to do this? Maybe a link to some example code?

There is tons to read about event handling but the (only) part I understand is about events within classes just as all the examples are (One panel two buttons, two pictures etc)

I guess the only option I might envision is dividing by zero and catching the error outside the panel.

That would be bazooking a mosquito, but it also shows what I try to implement.

I'd be so happy to understand this part of the 'java system' ...

(please understand that I don't want 'cardlayout', I want to understand what I need to do)

Much thanks for any help!

[1114 byte] By [WimEa] at [2007-11-26 16:27:38]
# 1

When you build your application, you add your panel to some container, possibly the frame.

What you want to do if I understand your question correctly, is replace that panel with another one when you are done.

Just like you can add a component to a container, you can also remove it with the remove() method. Pass in your old panel as the argument and it will be gone. Then simply add your new panel to the container. You could do this in the action event of a button press for example, or whenever your application decides that the input is valid.

gimbal2a at 2007-7-8 22:51:51 > top of Java-index,Java Essentials,Java Programming...
# 2

Thank you for your suggestion.

My problem is that I am (feel?) stuck within the panel.

So to put it differently, I cannot build a child panel with a button (in the child) that will have the parent pane change color. This as my 'code focus' is within the child panel and I cannot 'activate' code outside it.

I am totally confused now as to how java works.

So I cannot write a parent pane with a child pane where the child tests for a name and if the name is correct the child will be removed and some code will put in another child pane with fi a picture.

This seems so utterly basic to any programmers needs, but I cannot find one example - or I have gone blind looking for it. In my code if I want to read the input field I have to handle it within the child pane, if I want to change child panels I need to do that in the parents panel code. But I can't change the code focus. So the child needs to generate an event that the parents can act upon, but there are no examples while I actually expect tons of examples. So maybe I don't speak 'Java'.

This meaning that I cannot write a stack of panes and remove them one by one using fi the escape key.

I am just left clueless by Java.

WimEa at 2007-7-8 22:51:51 > top of Java-index,Java Essentials,Java Programming...