Results 1 to 4 of 4
  1. #1
    sandor is offline Member
    Join Date
    Apr 2007
    Location
    Pennsylvania,USA
    Posts
    45
    Rep Power
    0

    Default Making a session in swing

    This might be a little hard to comprehend but I want to query a database and get an object and then put that object in the 'session' so that all my screens have access to it and can work on it. For instance if I get a list of items, I might want it available to a number of of other little popup screens.
    Any ideas?

  2. #2
    levent Guest

    Default

    As far as i understood your problem: Why don't you create a class to hold you data and pass reference of the object created from that class between your dialogs?

  3. #3
    pegitha is offline Member
    Join Date
    Apr 2007
    Location
    Indiana
    Posts
    83
    Rep Power
    0

    Default

    NOt sure this is what you want but I usually make a singleton class called Application State. Then I control what is in it with methods such as below.
    Java Code:
     public Object getItem(String key)
        {
            return stateItems.get(key);
        }
    
        public void setItem(String key, Object item)
        {
            stateItems.put(key, item);
        }
    
        public void removeItem(String item)
        {
            stateItems.remove(item);
    
        }
    
        public void cleanUp()
        {
            stateItems.clear();
        }
    It is not configured for java 5.0. This is old code, but you can update. I think I got it from the pet shop example on Sun.
    Hope this helps.
    p

  4. #4
    levent Guest

    Default

    NOt sure this is what you want but I usually make a singleton class called Application State. Then I control what is in it with methods such as below.

    That is a good example. I meant something like that.

Similar Threads

  1. Making a stack from a LinkedList
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-16-2008, 10:28 PM
  2. Making triangle
    By banie in forum New To Java
    Replies: 4
    Last Post: 02-02-2008, 11:23 AM
  3. Help with making this algorithm better
    By RLRExtra in forum New To Java
    Replies: 6
    Last Post: 01-17-2008, 04:11 PM
  4. code for making a java swing program a demo verson
    By fakhruddin in forum AWT / Swing
    Replies: 1
    Last Post: 11-27-2007, 08:54 PM
  5. Making a Java web calendar
    By toby in forum Enterprise JavaBeans (EJB)
    Replies: 1
    Last Post: 08-07-2007, 06:05 AM

Posting Permissions

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