Java PropertyChangeListener
I'm trying to figure out how to listen to a property change in another class. Below is my code:
ClassWithProperty has the property I want to listen to:
public class ClassWithProperty {
private PropertyChangeSupport changes = new PropertyChangeSupport(this);
private int usersOnline;
public int getUsersOnline() {
return usersOnline;
}
public ClassWithProperty() {
usersOnline = 0;
while (usersOnline<10) {
changes.firePropertyChange("usersOnline", usersOnline, usersOnline++);
}
}
public void addPropertyChangeListener(
PropertyChangeListener l) {
changes.addPropertyChangeListener(l);
}
public void removePropertyChangeListener(
PropertyChangeListener l) {
changes.removePropertyChangeListener(l);
}
}
Main is where i need to know about the property change:
public class Main {
private static ClassWithProperty test;
public static void main(String args) {
test = new ClassWithProperty();
test.addPropertyChangeListener(listen());
}
private static PropertyChangeListener listen() {
System.out.println(test.getUsersOnline());
return null;
}
}
I have the event fired only the last time (usersOnline=10).
I'm new to Java and tried to find a solution, but to no avail.
java
add a comment |
I'm trying to figure out how to listen to a property change in another class. Below is my code:
ClassWithProperty has the property I want to listen to:
public class ClassWithProperty {
private PropertyChangeSupport changes = new PropertyChangeSupport(this);
private int usersOnline;
public int getUsersOnline() {
return usersOnline;
}
public ClassWithProperty() {
usersOnline = 0;
while (usersOnline<10) {
changes.firePropertyChange("usersOnline", usersOnline, usersOnline++);
}
}
public void addPropertyChangeListener(
PropertyChangeListener l) {
changes.addPropertyChangeListener(l);
}
public void removePropertyChangeListener(
PropertyChangeListener l) {
changes.removePropertyChangeListener(l);
}
}
Main is where i need to know about the property change:
public class Main {
private static ClassWithProperty test;
public static void main(String args) {
test = new ClassWithProperty();
test.addPropertyChangeListener(listen());
}
private static PropertyChangeListener listen() {
System.out.println(test.getUsersOnline());
return null;
}
}
I have the event fired only the last time (usersOnline=10).
I'm new to Java and tried to find a solution, but to no avail.
java
Probably unrelated to your question, but one problem in your code is that you increase usersOnline twice each iteration of the loop. Use ++ only once.
– Markus Johnsson
Feb 13 '11 at 22:56
Yes, my mistake,but the problem persists. Thank you ;)
– Laphroaig
Feb 13 '11 at 23:07
edited the mistake.
– Laphroaig
Feb 13 '11 at 23:23
add a comment |
I'm trying to figure out how to listen to a property change in another class. Below is my code:
ClassWithProperty has the property I want to listen to:
public class ClassWithProperty {
private PropertyChangeSupport changes = new PropertyChangeSupport(this);
private int usersOnline;
public int getUsersOnline() {
return usersOnline;
}
public ClassWithProperty() {
usersOnline = 0;
while (usersOnline<10) {
changes.firePropertyChange("usersOnline", usersOnline, usersOnline++);
}
}
public void addPropertyChangeListener(
PropertyChangeListener l) {
changes.addPropertyChangeListener(l);
}
public void removePropertyChangeListener(
PropertyChangeListener l) {
changes.removePropertyChangeListener(l);
}
}
Main is where i need to know about the property change:
public class Main {
private static ClassWithProperty test;
public static void main(String args) {
test = new ClassWithProperty();
test.addPropertyChangeListener(listen());
}
private static PropertyChangeListener listen() {
System.out.println(test.getUsersOnline());
return null;
}
}
I have the event fired only the last time (usersOnline=10).
I'm new to Java and tried to find a solution, but to no avail.
java
I'm trying to figure out how to listen to a property change in another class. Below is my code:
ClassWithProperty has the property I want to listen to:
public class ClassWithProperty {
private PropertyChangeSupport changes = new PropertyChangeSupport(this);
private int usersOnline;
public int getUsersOnline() {
return usersOnline;
}
public ClassWithProperty() {
usersOnline = 0;
while (usersOnline<10) {
changes.firePropertyChange("usersOnline", usersOnline, usersOnline++);
}
}
public void addPropertyChangeListener(
PropertyChangeListener l) {
changes.addPropertyChangeListener(l);
}
public void removePropertyChangeListener(
PropertyChangeListener l) {
changes.removePropertyChangeListener(l);
}
}
Main is where i need to know about the property change:
public class Main {
private static ClassWithProperty test;
public static void main(String args) {
test = new ClassWithProperty();
test.addPropertyChangeListener(listen());
}
private static PropertyChangeListener listen() {
System.out.println(test.getUsersOnline());
return null;
}
}
I have the event fired only the last time (usersOnline=10).
I'm new to Java and tried to find a solution, but to no avail.
java
java
edited Apr 4 '17 at 14:26
gEdringer
6,3663923
6,3663923
asked Feb 13 '11 at 22:51
Laphroaig
25941025
25941025
Probably unrelated to your question, but one problem in your code is that you increase usersOnline twice each iteration of the loop. Use ++ only once.
– Markus Johnsson
Feb 13 '11 at 22:56
Yes, my mistake,but the problem persists. Thank you ;)
– Laphroaig
Feb 13 '11 at 23:07
edited the mistake.
– Laphroaig
Feb 13 '11 at 23:23
add a comment |
Probably unrelated to your question, but one problem in your code is that you increase usersOnline twice each iteration of the loop. Use ++ only once.
– Markus Johnsson
Feb 13 '11 at 22:56
Yes, my mistake,but the problem persists. Thank you ;)
– Laphroaig
Feb 13 '11 at 23:07
edited the mistake.
– Laphroaig
Feb 13 '11 at 23:23
Probably unrelated to your question, but one problem in your code is that you increase usersOnline twice each iteration of the loop. Use ++ only once.
– Markus Johnsson
Feb 13 '11 at 22:56
Probably unrelated to your question, but one problem in your code is that you increase usersOnline twice each iteration of the loop. Use ++ only once.
– Markus Johnsson
Feb 13 '11 at 22:56
Yes, my mistake,but the problem persists. Thank you ;)
– Laphroaig
Feb 13 '11 at 23:07
Yes, my mistake,but the problem persists. Thank you ;)
– Laphroaig
Feb 13 '11 at 23:07
edited the mistake.
– Laphroaig
Feb 13 '11 at 23:23
edited the mistake.
– Laphroaig
Feb 13 '11 at 23:23
add a comment |
2 Answers
2
active
oldest
votes
The code:
private static PropertyChangeListener listen() {
System.out.println(test.getUsersOnline());
return null;
}
returns null
which means "no object", which in turn means that test.addPropertyChangeListener(listen())
is effectively test.addPropertyChangeListener(null)
, which won't register anything.
You must pass a valid instance of a PropertyChangeListener
to the addPropertyChangeListener()
method.
Edit
I suggest you read the Java tutorial's chapter about PropertyChangeListeners:
http://download.oracle.com/javase/tutorial/uiswing/events/propertychangelistener.html
Another problem of your code is that you call firePropertyChange()
in the constructor of ClassWithProperty
. But at that time, no listener can possibly be registered, so it does not have any effect. Any call to addPropertyChangeListener()
happens after you have fired the events.
Here is your code modified so that it should work (haven't tested it though...):
public class ClassWithProperty {
private PropertyChangeSupport changes = new PropertyChangeSupport(this);
private int usersOnline = 0;
public ClassWithProperty() {
}
public void setupOnlineUsers()
{
while (usersOnline < 10) {
changes.firePropertyChange("usersOnline", usersOnline, ++usersOnline);
}
}
public int getUsersOnline() {
return usersOnline;
}
public void addPropertyChangeListener(PropertyChangeListener l) {
changes.addPropertyChangeListener(l);
}
public void removePropertyChangeListener(PropertyChangeListener l) {
changes.removePropertyChangeListener(l);
}
}
public class MainListener implements PropertyChangeListener {
private ClassWithProperty test;
public MainListener() {
test = new ClassWithProperty();
test.addPropertyChangeListener(this);
test.setupOnlineUsers();
}
public void propertyChange(PropertyChangeEvent evt) {
System.out.println(test.getUsersOnline());
}
public static void main(String args) {
new MainListener(); // do everything in the constructor
}
}
Can you please integrate my code with an example? sorry but i'm a javabeginner and can't understand it. For me it's to hard to understand due to my poor english too (i'm from Italy). Thank you very much.
– Laphroaig
Feb 13 '11 at 23:45
Yes!! It work and now i can understand why!!! Thank you very much! ++++
– Laphroaig
Feb 14 '11 at 0:40
add a comment |
Your method here:
public ClassWithProperty() {
usersOnline = 0;
while (usersOnline<10) {
changes.firePropertyChange("usersOnline", usersOnline, usersOnline++);
usersOnline++;
}
}
has a while loop that will continuously loop and block the thread. My limited knowledge of property change listeners is that they listen for changes to a bound property, here the usersOnLine
variable, meaning the property change should only fire if this number changes (likely within in any setUserOnLine
, addUserOnLine
, removeUserOnLine
and similar methods). For more on bound properties, please look here: Bound Properties
ok thank you again :) i have to learn about it.
– Laphroaig
Feb 13 '11 at 23:12
Your link to bound properties died, try this
– Noumenon
May 23 '13 at 11:45
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f4987476%2fjava-propertychangelistener%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The code:
private static PropertyChangeListener listen() {
System.out.println(test.getUsersOnline());
return null;
}
returns null
which means "no object", which in turn means that test.addPropertyChangeListener(listen())
is effectively test.addPropertyChangeListener(null)
, which won't register anything.
You must pass a valid instance of a PropertyChangeListener
to the addPropertyChangeListener()
method.
Edit
I suggest you read the Java tutorial's chapter about PropertyChangeListeners:
http://download.oracle.com/javase/tutorial/uiswing/events/propertychangelistener.html
Another problem of your code is that you call firePropertyChange()
in the constructor of ClassWithProperty
. But at that time, no listener can possibly be registered, so it does not have any effect. Any call to addPropertyChangeListener()
happens after you have fired the events.
Here is your code modified so that it should work (haven't tested it though...):
public class ClassWithProperty {
private PropertyChangeSupport changes = new PropertyChangeSupport(this);
private int usersOnline = 0;
public ClassWithProperty() {
}
public void setupOnlineUsers()
{
while (usersOnline < 10) {
changes.firePropertyChange("usersOnline", usersOnline, ++usersOnline);
}
}
public int getUsersOnline() {
return usersOnline;
}
public void addPropertyChangeListener(PropertyChangeListener l) {
changes.addPropertyChangeListener(l);
}
public void removePropertyChangeListener(PropertyChangeListener l) {
changes.removePropertyChangeListener(l);
}
}
public class MainListener implements PropertyChangeListener {
private ClassWithProperty test;
public MainListener() {
test = new ClassWithProperty();
test.addPropertyChangeListener(this);
test.setupOnlineUsers();
}
public void propertyChange(PropertyChangeEvent evt) {
System.out.println(test.getUsersOnline());
}
public static void main(String args) {
new MainListener(); // do everything in the constructor
}
}
Can you please integrate my code with an example? sorry but i'm a javabeginner and can't understand it. For me it's to hard to understand due to my poor english too (i'm from Italy). Thank you very much.
– Laphroaig
Feb 13 '11 at 23:45
Yes!! It work and now i can understand why!!! Thank you very much! ++++
– Laphroaig
Feb 14 '11 at 0:40
add a comment |
The code:
private static PropertyChangeListener listen() {
System.out.println(test.getUsersOnline());
return null;
}
returns null
which means "no object", which in turn means that test.addPropertyChangeListener(listen())
is effectively test.addPropertyChangeListener(null)
, which won't register anything.
You must pass a valid instance of a PropertyChangeListener
to the addPropertyChangeListener()
method.
Edit
I suggest you read the Java tutorial's chapter about PropertyChangeListeners:
http://download.oracle.com/javase/tutorial/uiswing/events/propertychangelistener.html
Another problem of your code is that you call firePropertyChange()
in the constructor of ClassWithProperty
. But at that time, no listener can possibly be registered, so it does not have any effect. Any call to addPropertyChangeListener()
happens after you have fired the events.
Here is your code modified so that it should work (haven't tested it though...):
public class ClassWithProperty {
private PropertyChangeSupport changes = new PropertyChangeSupport(this);
private int usersOnline = 0;
public ClassWithProperty() {
}
public void setupOnlineUsers()
{
while (usersOnline < 10) {
changes.firePropertyChange("usersOnline", usersOnline, ++usersOnline);
}
}
public int getUsersOnline() {
return usersOnline;
}
public void addPropertyChangeListener(PropertyChangeListener l) {
changes.addPropertyChangeListener(l);
}
public void removePropertyChangeListener(PropertyChangeListener l) {
changes.removePropertyChangeListener(l);
}
}
public class MainListener implements PropertyChangeListener {
private ClassWithProperty test;
public MainListener() {
test = new ClassWithProperty();
test.addPropertyChangeListener(this);
test.setupOnlineUsers();
}
public void propertyChange(PropertyChangeEvent evt) {
System.out.println(test.getUsersOnline());
}
public static void main(String args) {
new MainListener(); // do everything in the constructor
}
}
Can you please integrate my code with an example? sorry but i'm a javabeginner and can't understand it. For me it's to hard to understand due to my poor english too (i'm from Italy). Thank you very much.
– Laphroaig
Feb 13 '11 at 23:45
Yes!! It work and now i can understand why!!! Thank you very much! ++++
– Laphroaig
Feb 14 '11 at 0:40
add a comment |
The code:
private static PropertyChangeListener listen() {
System.out.println(test.getUsersOnline());
return null;
}
returns null
which means "no object", which in turn means that test.addPropertyChangeListener(listen())
is effectively test.addPropertyChangeListener(null)
, which won't register anything.
You must pass a valid instance of a PropertyChangeListener
to the addPropertyChangeListener()
method.
Edit
I suggest you read the Java tutorial's chapter about PropertyChangeListeners:
http://download.oracle.com/javase/tutorial/uiswing/events/propertychangelistener.html
Another problem of your code is that you call firePropertyChange()
in the constructor of ClassWithProperty
. But at that time, no listener can possibly be registered, so it does not have any effect. Any call to addPropertyChangeListener()
happens after you have fired the events.
Here is your code modified so that it should work (haven't tested it though...):
public class ClassWithProperty {
private PropertyChangeSupport changes = new PropertyChangeSupport(this);
private int usersOnline = 0;
public ClassWithProperty() {
}
public void setupOnlineUsers()
{
while (usersOnline < 10) {
changes.firePropertyChange("usersOnline", usersOnline, ++usersOnline);
}
}
public int getUsersOnline() {
return usersOnline;
}
public void addPropertyChangeListener(PropertyChangeListener l) {
changes.addPropertyChangeListener(l);
}
public void removePropertyChangeListener(PropertyChangeListener l) {
changes.removePropertyChangeListener(l);
}
}
public class MainListener implements PropertyChangeListener {
private ClassWithProperty test;
public MainListener() {
test = new ClassWithProperty();
test.addPropertyChangeListener(this);
test.setupOnlineUsers();
}
public void propertyChange(PropertyChangeEvent evt) {
System.out.println(test.getUsersOnline());
}
public static void main(String args) {
new MainListener(); // do everything in the constructor
}
}
The code:
private static PropertyChangeListener listen() {
System.out.println(test.getUsersOnline());
return null;
}
returns null
which means "no object", which in turn means that test.addPropertyChangeListener(listen())
is effectively test.addPropertyChangeListener(null)
, which won't register anything.
You must pass a valid instance of a PropertyChangeListener
to the addPropertyChangeListener()
method.
Edit
I suggest you read the Java tutorial's chapter about PropertyChangeListeners:
http://download.oracle.com/javase/tutorial/uiswing/events/propertychangelistener.html
Another problem of your code is that you call firePropertyChange()
in the constructor of ClassWithProperty
. But at that time, no listener can possibly be registered, so it does not have any effect. Any call to addPropertyChangeListener()
happens after you have fired the events.
Here is your code modified so that it should work (haven't tested it though...):
public class ClassWithProperty {
private PropertyChangeSupport changes = new PropertyChangeSupport(this);
private int usersOnline = 0;
public ClassWithProperty() {
}
public void setupOnlineUsers()
{
while (usersOnline < 10) {
changes.firePropertyChange("usersOnline", usersOnline, ++usersOnline);
}
}
public int getUsersOnline() {
return usersOnline;
}
public void addPropertyChangeListener(PropertyChangeListener l) {
changes.addPropertyChangeListener(l);
}
public void removePropertyChangeListener(PropertyChangeListener l) {
changes.removePropertyChangeListener(l);
}
}
public class MainListener implements PropertyChangeListener {
private ClassWithProperty test;
public MainListener() {
test = new ClassWithProperty();
test.addPropertyChangeListener(this);
test.setupOnlineUsers();
}
public void propertyChange(PropertyChangeEvent evt) {
System.out.println(test.getUsersOnline());
}
public static void main(String args) {
new MainListener(); // do everything in the constructor
}
}
edited Nov 11 at 22:09
LAD
1,8731720
1,8731720
answered Feb 13 '11 at 23:30
a_horse_with_no_name
291k46445539
291k46445539
Can you please integrate my code with an example? sorry but i'm a javabeginner and can't understand it. For me it's to hard to understand due to my poor english too (i'm from Italy). Thank you very much.
– Laphroaig
Feb 13 '11 at 23:45
Yes!! It work and now i can understand why!!! Thank you very much! ++++
– Laphroaig
Feb 14 '11 at 0:40
add a comment |
Can you please integrate my code with an example? sorry but i'm a javabeginner and can't understand it. For me it's to hard to understand due to my poor english too (i'm from Italy). Thank you very much.
– Laphroaig
Feb 13 '11 at 23:45
Yes!! It work and now i can understand why!!! Thank you very much! ++++
– Laphroaig
Feb 14 '11 at 0:40
Can you please integrate my code with an example? sorry but i'm a javabeginner and can't understand it. For me it's to hard to understand due to my poor english too (i'm from Italy). Thank you very much.
– Laphroaig
Feb 13 '11 at 23:45
Can you please integrate my code with an example? sorry but i'm a javabeginner and can't understand it. For me it's to hard to understand due to my poor english too (i'm from Italy). Thank you very much.
– Laphroaig
Feb 13 '11 at 23:45
Yes!! It work and now i can understand why!!! Thank you very much! ++++
– Laphroaig
Feb 14 '11 at 0:40
Yes!! It work and now i can understand why!!! Thank you very much! ++++
– Laphroaig
Feb 14 '11 at 0:40
add a comment |
Your method here:
public ClassWithProperty() {
usersOnline = 0;
while (usersOnline<10) {
changes.firePropertyChange("usersOnline", usersOnline, usersOnline++);
usersOnline++;
}
}
has a while loop that will continuously loop and block the thread. My limited knowledge of property change listeners is that they listen for changes to a bound property, here the usersOnLine
variable, meaning the property change should only fire if this number changes (likely within in any setUserOnLine
, addUserOnLine
, removeUserOnLine
and similar methods). For more on bound properties, please look here: Bound Properties
ok thank you again :) i have to learn about it.
– Laphroaig
Feb 13 '11 at 23:12
Your link to bound properties died, try this
– Noumenon
May 23 '13 at 11:45
add a comment |
Your method here:
public ClassWithProperty() {
usersOnline = 0;
while (usersOnline<10) {
changes.firePropertyChange("usersOnline", usersOnline, usersOnline++);
usersOnline++;
}
}
has a while loop that will continuously loop and block the thread. My limited knowledge of property change listeners is that they listen for changes to a bound property, here the usersOnLine
variable, meaning the property change should only fire if this number changes (likely within in any setUserOnLine
, addUserOnLine
, removeUserOnLine
and similar methods). For more on bound properties, please look here: Bound Properties
ok thank you again :) i have to learn about it.
– Laphroaig
Feb 13 '11 at 23:12
Your link to bound properties died, try this
– Noumenon
May 23 '13 at 11:45
add a comment |
Your method here:
public ClassWithProperty() {
usersOnline = 0;
while (usersOnline<10) {
changes.firePropertyChange("usersOnline", usersOnline, usersOnline++);
usersOnline++;
}
}
has a while loop that will continuously loop and block the thread. My limited knowledge of property change listeners is that they listen for changes to a bound property, here the usersOnLine
variable, meaning the property change should only fire if this number changes (likely within in any setUserOnLine
, addUserOnLine
, removeUserOnLine
and similar methods). For more on bound properties, please look here: Bound Properties
Your method here:
public ClassWithProperty() {
usersOnline = 0;
while (usersOnline<10) {
changes.firePropertyChange("usersOnline", usersOnline, usersOnline++);
usersOnline++;
}
}
has a while loop that will continuously loop and block the thread. My limited knowledge of property change listeners is that they listen for changes to a bound property, here the usersOnLine
variable, meaning the property change should only fire if this number changes (likely within in any setUserOnLine
, addUserOnLine
, removeUserOnLine
and similar methods). For more on bound properties, please look here: Bound Properties
edited Aug 29 '17 at 6:45
J Woodchuck
815922
815922
answered Feb 13 '11 at 22:58
Hovercraft Full Of Eels
261k20211317
261k20211317
ok thank you again :) i have to learn about it.
– Laphroaig
Feb 13 '11 at 23:12
Your link to bound properties died, try this
– Noumenon
May 23 '13 at 11:45
add a comment |
ok thank you again :) i have to learn about it.
– Laphroaig
Feb 13 '11 at 23:12
Your link to bound properties died, try this
– Noumenon
May 23 '13 at 11:45
ok thank you again :) i have to learn about it.
– Laphroaig
Feb 13 '11 at 23:12
ok thank you again :) i have to learn about it.
– Laphroaig
Feb 13 '11 at 23:12
Your link to bound properties died, try this
– Noumenon
May 23 '13 at 11:45
Your link to bound properties died, try this
– Noumenon
May 23 '13 at 11:45
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f4987476%2fjava-propertychangelistener%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Probably unrelated to your question, but one problem in your code is that you increase usersOnline twice each iteration of the loop. Use ++ only once.
– Markus Johnsson
Feb 13 '11 at 22:56
Yes, my mistake,but the problem persists. Thank you ;)
– Laphroaig
Feb 13 '11 at 23:07
edited the mistake.
– Laphroaig
Feb 13 '11 at 23:23