Questions tagged [propertychangesupport]

19 questions
7
votes
4 answers

PropertyChangeSupport for SpinnerNumberModel

I want to listen to the changes of the value of the SpinnerNumberModel for a JSpinner. I create a PropertyChangeSupport and put the model into it. I need the propertyChangeListener, because it shows me the old and new value of the property. The…
5
votes
2 answers

@BeanProperty with PropertyChangeListener support?

@BeanProperty generates simple get/set methods. Is there a way to automatically generate such methods with support for firing property change events (e.g. I want to use it with JFace Databinding?)
Alexey Romanov
  • 167,066
  • 35
  • 309
  • 487
4
votes
1 answer

Java PropertyChangeSupport does not fire for different properties

I have developed an own javaBean for Swing. Now I'm trying to catch two properties on change, using a PropertyChangeListener. The problem is that the PropertyChangeSupport for one of my properties in the JavaBean works fine but it does not seem to…
Ham Vocke
  • 2,942
  • 22
  • 27
3
votes
1 answer

About Scala fields and property change events

As a followup to this question about Scala's @BeanProperty generating change events: What would it take to fully implement the behavior that annotating a var field with some custom annotation (@Property, for instance) would generate the code needed…
Jean-Philippe Pellet
  • 59,296
  • 21
  • 173
  • 234
2
votes
1 answer

Java: SwingPropertyChangeSupport

I am trying to make an MVC Java Swing program that makes use of SwingPropertyChangeSupport to notify the view whenever the model gets updated. The problem I am having is that the notifications do not seem to be happening. I have prepared an SSCCE…
user1002119
  • 3,692
  • 4
  • 27
  • 30
2
votes
2 answers

Design a PropertyChangeListener that listens only to some properties

I am looking for a design pattern / solution for the following problem, that is related to the Observer pattern, I have already studied. In my code I have a MyModel class. It has many properties. public class MyModel { private List
2
votes
2 answers

propertyChange Support vs EventListenerList differences and when to prefer each ones?

I have read the docs for PropertyChange support and EventListenerList. From my understanding, both serve similar purposes in holding a list of listeners and notifying them when event/propertyChange occurs. Is it only in case of GUI applications,…
brain storm
  • 30,124
  • 69
  • 225
  • 393
2
votes
1 answer

How to fire property change listener if old and new values are equal in swing Jcombo box

A combo box has two values: AND and OR. I written property change listener for the Combo,as this event fires, if and only of the currently selected value and previous values are different. But I need that this event should be fired even if the…
2
votes
0 answers

What are the pros and cons of using a PropertyChangeListener vs. using LocalBroadcastReceivers?

It seems like property change listeners are better than sending broadcasts because you can pass objects back to the property listeners whereas when you broadcast an Intent, it can only contain primitives or Parcelable objects. However, I'm not sure…
2
votes
1 answer

Cyclic Property Change Listeners

I have a cyclic property change listener set up. I have 2 objects of class A. I have made one object listen to changes of the other and vice versa. Here's the code: import java.beans.PropertyChangeEvent; import…
sethu
  • 8,181
  • 7
  • 39
  • 65
2
votes
3 answers

Update JLabel when custom object property changes

I have a Java class and I want one of its properties to be displayed by a JLabel in a Swing desktop application: class Item { private String name; private Integer quantity; // getters, setters... } class Frame { Item item = new…
user283155
1
vote
1 answer

PropertyChangeSupport with weak references to PropertyChangeListener?

Java does not seem to deliver an implementation of PropertyChangeSupport with weak references to registered PropertyChangeListeners. It would not be very hard to implement this, but before I re-invent the wheel, does anyone know whether such feature…
1
vote
2 answers

How to handle JTable data changed event

I have a JTable bound to a List property. I used NetBeans to add a property to my jpanel form, enabled/checked propertyChangeSupport, and bound my jTable to that property. Table is displaying the data perfectly. Please guide me how can I…
Khalid Amin
  • 872
  • 3
  • 12
  • 26
0
votes
1 answer

Adding a PropertyChangeListener leads to java.lang.NullPointerException

I'm new to working with Netbeans and PropertyChangeListeners and I got same (for me) strange behavior when implementing a PropertyChangeSupport in a Java bean. So I have one bean called TTTCell in which I initialize a PropertyChangeSupport variable.…
0
votes
1 answer

Property change event's old value for collections when element is added

I have a Java bean that has a collection property with a getter and also provides add methods for the collection. So when the collection is modified using the add method I must fire a PropertyChangeEvent. A PropertyChangeEvent has an old value and a…
René Link
  • 48,224
  • 13
  • 108
  • 140
1
2