Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-22-2007, 11:00 PM
Member
 
Join Date: Apr 2007
Location: Pennsylvania,USA
Posts: 46
sandor is on a distinguished road
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?
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-22-2007, 11:03 PM
Senior Member
 
Join Date: Dec 2006
Posts: 748
levent is on a distinguished road
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?
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 04-22-2007, 11:05 PM
Member
 
Join Date: Apr 2007
Location: Indiana
Posts: 84
pegitha is on a distinguished road
Send a message via Skype™ to pegitha
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.
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
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 04-22-2007, 11:58 PM
Senior Member
 
Join Date: Dec 2006
Posts: 748
levent is on a distinguished road
Quote:
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.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Making a stack from a LinkedList Java Tip java.lang 0 04-16-2008 11:28 PM
Making triangle banie New To Java 4 02-02-2008 12:23 PM
Help with making this algorithm better RLRExtra New To Java 6 01-17-2008 05:11 PM
code for making a java swing program a demo verson fakhruddin AWT / Swing 1 11-27-2007 09:54 PM
Making a Java web calendar toby Enterprise JavaBeans 1 08-07-2007 07:05 AM


All times are GMT +3. The time now is 12:59 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org