Passing data with own AWT events - what would be the best way?

From: A. Farber (Alexander.Farber_at_t-online.de)
Date: 02/27/04


Date: 27 Feb 2004 04:37:17 -0800

Hi,

I have 2 own components in my card game applet:
http://pref.dyndns.org/pref3/pref3.html (JDK 1.1)

One is managing playing cards on a table and the
other is not visible and is managing network
connection to the server. Both components post
AWT action events to the applet using smth. like:

    actionListener.actionPerformed(new ActionEvent
  (this, ActionEvent.ACTION_PERFORMED, "address"));

My problem is though, that sometimes I need to pass
not just a string (like "address" above) with an
event, but more information, like a player number or
several cards she selected. Of course I could convert
that information into a string and then parse it
back at the listening side, but I wonder if there
is a better way?

Is it for example possible to create an AWT event which
would have an Integer and not a String as the argument?

Also an additional question: do I need to add() my
invisible network component to the applet or would
myComp.addActionListener(this); in the applet suffice?

Thanks
Alex



Relevant Pages

  • Own component flashes - despite double buffering
    ... I have a small applet + source code at ... where I'm trying to implement a card game. ... All cards are painted in my own Component ...
    (comp.lang.java.gui)
  • Help need to send email using java applet in html page
    ... the java applet show as below ... private String strRecipients = ""; ... public void destroy() { ... * @param exception java.lang.Throwable ...
    (comp.lang.java)
  • Re: Applet Help
    ... > I have an applet that I am suppose to write for a java class. ... > public void actionPerformed(ActionEvent actionEvent) ... The String that you get from ...
    (comp.lang.java.programmer)
  • Re: Detecting highlighted text in textarea.
    ... > new computer users in our local seniors' computer club. ... The applet ... > I wish to detect what the user highlighted and store it as a string to ... > public void paint{ ...
    (comp.lang.java)
  • Applet to JFrame GUI
    ... I am working on making an applet into a JFrame GUI and getting three ... public static void main ... private JLabel calcNameJLabel; ... String balString = balFieldJTextField.getText; ...
    (comp.lang.java.gui)