How can I check for a boolean to change state over a given period of time, and if a change is made over that time period perform a method?
Can any help please be given in Java.
Thanks.
I changed the code to a much more detailed version so you can get a better idea of my problem.
I need to "watch" an integer value and immediately respond to when it changes. So far the best way I've found is using a thread in an infinite loop.
The following is a vastly simplified portion of my project. To summarize, notificationValue is set to 1 by a click of a button within my Bubble class. ...
How do you make a program execute a set of commands when something happens e.g. a variable changes
In my web app, during some change over the object, i need to send a mail about the changes happened in the object.
My question is how to write a listener for this.
Please give me some article regarding this.
Thanks
What would be the best practice for sharing localization object (in this case ResourceBundle, where I do save all translations) across many GUI objects in app? I have few ideas, but both have drawbacks:
1) passing ResourceBundle via each GUI class constructor, but then I need to save it inside every class (for later use) - means having the same code in each class over and over again
2) declar...
My program visually demonstrates a sequential version of the well known QuickSort algorithm, with two new visual demonstrations: (I) a parallel version of QuickSort, implemented using low level Thread API and SwingUtilities, and (II) a parallel version of QuickSort, implemented using SwingWorker API.
I am trying to have a facility to restart the program after a successful run. Currently, the b...
I've just moved into java (from AS3) and I understand the syntax and all the basics, but I can't find any tutorials or books on basic program architecture.
For example,
ObjectA has a property: ObjectB.
ObjectB has a property: x
ObjectB.x changes at some point.
How can I have Object A 'catch' or 'hook into' or 'listen for' the change in ObjectB.x?
In AS3, I would make ObjectB an event ...
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 has been implemented in any open source library? It does not seem so, but someone may know better on SO.
All I want to do is start a thread to listen for communication on a certain port.
I start this by having an 'ok' button on a jDialog. When 'ok' has been clicked, the jDialog should hide itself (HostClientDialog.setVisible(false);), which works when the thread start line isn't in there.
try {
HostClientDialog.setVisible(false);
// start a thread that listens for incom...
I've been trying to familiarize myself with the use of SwingWorkers in Java. Is it possible to trigger a dialogue box to display from the GUI within a SwingWorker's process method?
i have a list of event types
enum EventType {
ErrorEvent, StatusEvent, DataEvent
}
one listener can register to more than a event by calling
addListener (Listener listener,EventType eventType) {
// to do
}
can any one suggest, what data structure can i use to store all of these information
(listener and its associated event types)
or anyother java API classes already supports this...
I'm kind of new to java, so my apologies if you find this question senseless.
Just want to ask if it's possible to collect all the properties of an object, specifically those that are no longer the default value. For example, a bean where some properties have been set to new values, how will I be able to get those properties that were updated given only the object with the new values in it..
Or...
I have three classes serviceManager,serviceMasterHandler and WokerThread.serviceManager instantiate ServiceMasterHandler,ServiceMasterHandler instantiate and start workerThread.
I want to implements that each class started successfully it's send status to calling upper classes.
All ideas on how to implement is welcome.
Thanks
I've problem regarding GUI with one Menu and one Order Class.
I've created a variable to store how many items have been selected in the Menu Class.
private int totalSelected;
The var totalSelected is live updated. It can be changed anytime depending on actionPerformed() function.(Exp: totalSelected will add up all the selected items)
In the Order Class, how can I access to the live update ...
I have a data model model which has a boolean flag connected, and I have a view with several components that I want to enable if model.isConnected() is true and disable if it is not. What is the best way to implement this?