Global messages in java

L

loquak

Hello.
I have a remote dialog where clicking a certain button should make changes
in a few other dialogs. Not wanting to use global static variables, is there
a global message dispatch system in java which allows to communicate between
independent objects?
 
T

Tony Morris

loquak said:
Hello.
I have a remote dialog where clicking a certain button should make changes
in a few other dialogs. Not wanting to use global static variables, is there
a global message dispatch system in java which allows to communicate between
independent objects?

Java does not allow the use of any type global variable.
You might want to investigate the ResourceBundle class.

--
Tony Morris
(BInfTech, Cert 3 I.T.)
Software Engineer
(2003 VTR1000F)
Sun Certified Programmer for the Java 2 Platform (1.4)
Sun Certified Developer for the Java 2 Platform
 
W

William Brogden

This sounds like a job for java.util.Observable class and
java.util.Observer interface.

Bill
 
J

John C. Bollinger

loquak said:
Hello.
I have a remote dialog where clicking a certain button should make changes
in a few other dialogs. Not wanting to use global static variables, is there
a global message dispatch system in java which allows to communicate between
independent objects?

This is what the various listener interfaces of the GUI widgets are for.
Any object that wants to be notified when the button is clicked can
implement the ActionListener interface and register itself as an
ActionListener on that button. This leverages the AWT event dispatch
subsystem, which is as close to a "global message dispatch system" as
you can hope to get. You could find or construct a parallel system, but
I don't see why you would want to.


John Bollinger
(e-mail address removed)
 
T

Tony Morris

This sounds like a job for java.util.Observable class and
java.util.Observer interface.

Indeed it does.
Wonder what I was thinking when I suggested ResourceBundle ?
I must have skimmed it, saw the "message" part of the post, then falsely
suggested ResourceBundle.

Apologies for any confusion as a result.

--
Tony Morris
(BInfTech, Cert 3 I.T.)
Software Engineer
(2003 VTR1000F)
Sun Certified Programmer for the Java 2 Platform (1.4)
Sun Certified Developer for the Java 2 Platform
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top