event-dispatching

Whats the appropriate form when dispatching events in AS3?

佐手、 提交于 2019-12-06 11:28:17
I was wondering what the appropriate form was when creating custom events? Should one create a CustomEvent class, and then create a temporary dispatcher in the function, and dispatch the CustomEvent. or is it better to attempt to create a CustomEventDispatcher class, and create the CustomEvent class as an internal class of that class, eg: package { public class CustomEventDispatcher extends EventDispatcher { public function CustomEventDispatcher() { super(new CustomEvent()); } } } class CustomEvent { public function CustomEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false) {

In Java how do I repaint a panel from an actionPerformed thread while it is currently running?

岁酱吖の 提交于 2019-12-05 12:44:47
I have a class (called Class_GUI) which has a panel with lots of buttons on it. Class_GUI has some methods that change the text and colour of the buttons. I have also have a program with the actionPerformed method. When this is called it creates an instance of Class_GUI and repeatedly calls Class_GUI methods, changing the buttons etc. The issue I'm having is that the buttons only display properly once the actionPerformed method has finished entirely whereas I want it to change after each Class_GUI method is called. My attempt so far is in each Class_GUI method I do this at the end of the

Threads and jtable

橙三吉。 提交于 2019-12-02 16:30:58
问题 I have a problem with jtable. I have a number of threads and each of them have to add a row to the jTable, but the table remains empty. I'm working with netbeans, the graphics are totally separate from the logic. Can someone help me, please? this is the code that i use for adding a row MainGui.java public void addToTable(String from, String to, int request, int response, String timeElapsed) { Object [][] temp = new Object [data.length + 1][5]; for (int i = 0; i < data.length; i++) { for (int

Threads and jtable

会有一股神秘感。 提交于 2019-12-02 08:27:33
I have a problem with jtable. I have a number of threads and each of them have to add a row to the jTable, but the table remains empty. I'm working with netbeans, the graphics are totally separate from the logic. Can someone help me, please? this is the code that i use for adding a row MainGui.java public void addToTable(String from, String to, int request, int response, String timeElapsed) { Object [][] temp = new Object [data.length + 1][5]; for (int i = 0; i < data.length; i++) { for (int j = 0; j < 5; j++) { temp[i][j] = data[i][j]; } } temp[data.length][0] = from; temp[data.length][1] =

Cell: how to activate a contextMenu by keyboard?

末鹿安然 提交于 2019-12-01 20:11:56
问题 A cell contextMenu can't be activated by keyboard: it's underlying reason being that the contextMenuEvent is dispatched to the focused node - which is the containing table, not the cell. The bug evaluation by Jonathan has an outline of how solve it: The 'proper' way to do this is to probably override the buildEventDispatchChain in TableView and include the TableViewSkin (if it implements EventDispatcher), and to keep forwarding this down to the cells in the table row. Tried to follow that

Cell: how to activate a contextMenu by keyboard?

前提是你 提交于 2019-12-01 19:26:24
A cell contextMenu can't be activated by keyboard : it's underlying reason being that the contextMenuEvent is dispatched to the focused node - which is the containing table, not the cell. The bug evaluation by Jonathan has an outline of how solve it: The 'proper' way to do this is to probably override the buildEventDispatchChain in TableView and include the TableViewSkin (if it implements EventDispatcher), and to keep forwarding this down to the cells in the table row. Tried to follow that path (below is an example for ListView, simply because there's only one level of skins to implement vs.

How to temporarily disable event listeners in Swing?

自作多情 提交于 2019-11-27 16:01:06
I've got a Swing application with a model and a view. In the view (GUI) there are a lot of components, each of them mapping to some property of a model object and displaying it's value. Now there are some UI components that automatically trigger the updating of some model properties when their value changes in the UI. This requires me to reload the complete model in the UI. This way I'm entering an infinite update loop, as every model reload in the UI triggers another model reload. I have a flag indicating the load process, which I'd like to use to temporarily suppress the listener

How to temporarily disable event listeners in Swing?

元气小坏坏 提交于 2019-11-26 18:33:54
问题 I've got a Swing application with a model and a view. In the view (GUI) there are a lot of components, each of them mapping to some property of a model object and displaying it's value. Now there are some UI components that automatically trigger the updating of some model properties when their value changes in the UI. This requires me to reload the complete model in the UI. This way I'm entering an infinite update loop, as every model reload in the UI triggers another model reload. I have a

How to dispatch events in C#

淺唱寂寞╮ 提交于 2019-11-26 14:37:58
I wish to create own events and dispatch them. I never done this before in C#, only in Flex.. I guess there must be a lot of differencies. Can anyone provide me a good example? There is a pattern that is used in all library classes. It is recommended for your own classes too, especially for framework/library code. But nobody will stop you when you deviate or skip a few steps. Here is a schematic based on the simplest event-delegate, System.Eventhandler . // The delegate type. This one is already defined in the library, in the System namespace // the `void (object, EventArgs)` signature is also

How to dispatch events in C#

时光毁灭记忆、已成空白 提交于 2019-11-26 05:58:33
问题 I wish to create own events and dispatch them. I never done this before in C#, only in Flex.. I guess there must be a lot of differencies. Can anyone provide me a good example? 回答1: There is a pattern that is used in all library classes. It is recommended for your own classes too, especially for framework/library code. But nobody will stop you when you deviate or skip a few steps. Here is a schematic based on the simplest event-delegate, System.Eventhandler . // The delegate type. This one is