|
|||
|
I have a JApplet that contains a JPanel. The JPanel contains
JComponents, each of which have a FocusListener. On FocusGained I do something with the JComponent. My problem is that I need the JApplet class to know each time the FocusGained() method is invoked inside the JPanel and it needs to do something based on the JComponent selected. How do I implement a listener on the JPanel in the JApplet class that will know when one of the components is clicked. I tried adding a MouseListener, FocusListener, and a ContainerListener to the JPanel and I've been unable to determine when a component was clicked with each. Any help would be great! |
|
|
||||
|
||||
|
|
|
|||
|
MikeSmith813@gmail.com wrote:
> I have a JApplet that contains a JPanel. The JPanel contains > JComponents, each of which have a FocusListener. On FocusGained I do > something with the JComponent. > > My problem is that I need the JApplet class to know each time the > FocusGained() method is invoked inside the JPanel and it needs to do > something based on the JComponent selected. > > How do I implement a listener on the JPanel in the JApplet class that > will know when one of the components is clicked. > > I tried adding a MouseListener, FocusListener, and a ContainerListener > to the JPanel and I've been unable to determine when a component was > clicked with each. > > Any help would be great! > One way is to put a method in the applet that you can call from your component focus listener. -- Knute Johnson email s/nospam/knute/ |
|
|||
|
Is that the only way? There's no listener that I can put on the JPanel
within the applet? It seems odd to have the JPanel send control back to the Applet from the focus listener. What if the JPanel isn't finished executing at the time that I need the Applet to execute another process? |
|
|||
|
MikeSmith813@gmail.com wrote:
> Is that the only way? There's no listener that I can put on the JPanel > within the applet? It seems odd to have the JPanel send control back > to the Applet from the focus listener. What if the JPanel isn't > finished executing at the time that I need the Applet to execute > another process? > You will have to write your own. Here is a really good article on how to do that: http://www.javaworld.com/javaworld/j...javatip35.html I think I would use the suggestion I gave you unless this is an exercise in OO. -- Knute Johnson email s/nospam/knute/ |
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Re: SAS Problem | nospam@HOWLES.COM (Howard Schreier | Newsgroup comp.soft-sys.sas | 0 | 05-03-2006 03:23 AM |
| Re: SAS ETL- is Password Protection for files a problem? | GE Consumer Finance | Newsgroup comp.soft-sys.sas | 1 | 01-18-2006 09:17 AM |
| SAS -> MSWord DDE problem: report | Howard Cherniack | Newsgroup comp.soft-sys.sas | 0 | 05-29-2005 10:11 AM |
| Re: Help on a grouping problem | nospam@HOWLES.COM (Howard Schreier | Newsgroup comp.soft-sys.sas | 0 | 02-16-2005 02:52 AM |
| Re: Help on a grouping problem | Sigurd Hermansen | Newsgroup comp.soft-sys.sas | 0 | 02-15-2005 11:49 PM |