Results 1 to 3 of 3
  1. #1
    dan0 is offline Member
    Join Date
    Feb 2009
    Posts
    40
    Rep Power
    0

    Question How to manage/access variables between classes

    I have 3 applet parameters that I need send to a class which creates and sends an Http Request. My code is setup as follows:

    1. Applet Class ( one containing init() ) creates a new instance of a GUI class which creates and appends a GUI to the applet class.

    2. The GUI class monitors button clicks, upon clicking a certain button the GUI class create a new instance of the Http Request class which then sends the request.

    How do I get the parameter data from the Applet class to the Http Request class?

    The only way I can think of doing it, is by sending the params as arguments from the Applet class -> GUI class -> Http Request class. The problem with that idea is there is so much coupling. There's got to be a better way. Any ideas/suggestions?

    Thanks.

  2. #2
    emceenugget is offline Senior Member
    Join Date
    Sep 2008
    Posts
    564
    Rep Power
    7

    Default

    Applet calls GUI.setBlah(Whatever)
    GUI calls Request.setBlah(Whatever)

    that enough?

  3. #3
    dan0 is offline Member
    Join Date
    Feb 2009
    Posts
    40
    Rep Power
    0

    Default

    Quote Originally Posted by emceenugget View Post
    Applet calls GUI.setBlah(Whatever)
    GUI calls Request.setBlah(Whatever)

    that enough?
    So your suggestion is to send the parameters as arguments from the Applet class to the GUI class, and then from the GUI class to the HttpRequest class?

    If yes,
    Quote Originally Posted by dan0
    The only way I can think of doing it, is by sending the params as arguments from the Applet class -> GUI class -> Http Request class...There's got to be a better way. Any ideas/suggestions?
    then the answer to my above question is: No, there is no better way?

Similar Threads

  1. Replies: 3
    Last Post: 03-14-2009, 07:22 AM
  2. How to access private data types from public classes?
    By kevzspeare in forum New To Java
    Replies: 3
    Last Post: 03-07-2009, 04:19 AM
  3. Object access between classes
    By qazplm123890 in forum AWT / Swing
    Replies: 1
    Last Post: 03-05-2009, 05:00 AM
  4. sending variables to different classes?
    By Erdrick in forum New To Java
    Replies: 9
    Last Post: 08-04-2008, 11:11 AM
  5. [SOLVED] Need help using variables between classes
    By Renegade85 in forum New To Java
    Replies: 4
    Last Post: 04-22-2008, 02:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •