Re: JPanel Listener Problem



MikeSmith813@xxxxxxxxx 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/
.



Relevant Pages

  • JPanel Listener Problem
    ... I have a JApplet that contains a JPanel. ... something based on the JComponent selected. ... I tried adding a MouseListener, FocusListener, and a ContainerListener ...
    (comp.lang.java.gui)
  • Remapping input and actions
    ... The component extends JPanel. ... fragment just typed in the JTextField. ... JList are siblings in the JComponent hierarchy. ... if I naively try to use the input map of the list as ...
    (comp.lang.java.gui)
  • zoomable JPanel which can take JComponents (with full mouse support)?
    ... how it draws itself, but also so any JComponents within the panel ... and so can't be overridden to make it look in the transformed coordinate ... a JComponent calls setBackground, a repaint call seems ... to happen directly on the JComponent, and the zoomable JPanel does not get ...
    (comp.lang.java.gui)
  • Re: Editing JTree nodes
    ... > chance that some really strange code is about to come up. ... JComponent, if you intend to always draw every pixel in the area of the ... If this is all Greek to you, use JPanel. ... JComponent or JPanel, override paintComponent(), not paint. ...
    (comp.lang.java.gui)
  • JComponent painting problem
    ... I have implemented a custom JComponent that I'd like to add to a JPanel ... derived container. ... reason or another the component just won't show up. ...
    (comp.lang.java.gui)