listeners

JPanel.addComponentListener does not work when the listener is a class variable

I have a public class which has the following method and instance variable: public void setImagePanel(JPanel value) { imagePanel = value; if (imagePanel != null) { //method 1 : works imagePanel.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent evt) { System.out....

API For Flex Apps To Interact

I have a large flex application (the app) running on one server, and many small flex applications (widgets) running on another server, which are to be included in the app so that visually the user see's one continuous application. Due to proprietary third party software, this structure cannot be changed. I am looking for some way to al...

Java. Correct pattern for implementing listeners.

Very typically I have a situation where a given object will need to have many listeners. For instance, I might have class Elephant { public void addListener( ElephantListener listener ) { ... } } but I'll have many such situations. That is, I'll also have a Tiger object that'll have TigerListeners. Now, TigerListeners and Elephan...

Event notifications between iframe and parent

Hello - I am trying to send an event to iframes which have been opened by the application based on few events which should be prior registered by iframes. I cannot figure out how. I use jquery but I don't expect the iframes to be nice citizens to implement listeners in jQuery. Though I can mandate it - I am still looking for normal java...

how to trigger an event whenever a tweet is updated

I wanted to know how to trigger an event (say. storing a tweet from a particular user in a text file or mailing it etc.) when a particular user updates his tweets. Do we need to poll for the updates every few seconds or is there any other way out. ...

How to detect database events with, for example, java

Is there a way to detect database events, e.g. insert, update and delete, comparable to file access monitors like JNotify (can detect read, create, modify of files and directories)? Looking for something like database event listeners because I don't want to do polling. Thanks! ...

Java Swing programming structure: are listeners supposed to be the source of almost all Swing components?

Hi folks, My question boils down to this: is it standard structure in Swing programming to give listeners control over new components (e.g a new JPanel) for display and input, and to give that new component's listeners control over new components for display and input, and so on to infinity? Or does Java need to revert back to some sort...

Persisting Event Listener Pattern

I have implemented the event listener pattern in PHP, and setup a test case to validate that it is working within a single call to a URL. I'd like to be able to persist this state between calls while avoiding setup/teardown of all of the events within the application. I'm hoping that by persisting the state, when an event is fired, the ...

Using static factory classes to generate GUI components - How and where to add the required listeners?

I would like to use factory classes and methods to generate GUI components, but I don't know how and in which class the various listeners should be declared and added to the components. If I have a simple factory class such as that listed below should I add an ActionListener to the button before it is returned to the calling class. If t...

What is the best method for an object to send a message to another for Android?

For example, say the main Activity has an custom object foo with a method called bar. When foo.bar() is called via the activity, it does a bunch of things on a thread and when it is finished it would somehow alert the main ui thread, the activity, it's parent that it is finished. I imagine this working the same way an event like a On...

Maintaining OO while using listeners in Java

I have code similar to the following: public class myButton extends JButton() { public int data; public myButton(){ super("asdf"); data = 2; } } public class myPanel extends MouseListener() { myButton myButtonVar1; myButton myButtonVar2; public myPanel() { myButtonVar1 = new myButton(...

EJB module initialization listener

It's posible to define a listener for EJB 3.0 .jar that is called in the module/context initialization? Similar to the ServerContextListener for web project? ...