Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 1,000 results for
event-listener
- Page 1
Event Listener for a Vector or for an array
Programming
Software Development
14 Years Ago
by niranga
Hi All, Is it possible to bind an array or a Vector with a
event
listener
? For an example if we add an element to the Vector or remove from the Vector, can I use an
event
listener
to track the changes? Thanks a lot in advance. Cheers..!!
Event Listener on ArrayList
Programming
Software Development
14 Years Ago
by SCass2010
Hi everyone, I have an ArrayList containing 40 or so JPanels for a board game developed in Netbeans with java - is it possible to have an
event
listener
or something similar that will "monitor" the ArrayList for any of the JPanels being clicked, rather than having to create an
event
for every JPanel there? Many thanks in advance! :)
Jpanel event listener
Programming
Software Development
15 Years Ago
by adam291086
…, i am trying to add a keyboard
event
listener
to my Jpanel. But i am having no…java.applet.Applet; import java.awt.*; import java.awt.
event
.*; import java.awt.geom.*; import java.awt.image.…import java.awt.
event
.ActionEvent; import java.awt.
event
.ActionListener; import java.awt.
event
.KeyAdapter; import java.awt.
event
.KeyEvent; public …
As3IsoLib Event Listener for Boxes
Programming
Game Development
12 Years Ago
by 3.5.0-17
… unit (where you can move to). I've added an
event
listener
for all the boxes to call to, passing which box… the four boxes the 'TileClicked' function gets executed by the
event
handeler and it moves the player. I tried adding the…
event
handler when I was defining all the boxes at the …
How to create event listener function (charts) -- javascript
Programming
Web Development
11 Years Ago
by missy786
I am trying to create a
event
listener
function, which can render table from drawVisualisation(), when the page ….events.addOneTimeListener(dashboard, 'ready', function () { // create a "ready"
event
handler for the dummy // this fires whenever the user interacts…
Re: Event Listener for a Vector or for an array
Programming
Software Development
14 Years Ago
by hfx642
How do you add/remove elements from the Vector? Don't you have to do that programatically? So... You know WHEN it is happening, why would you need a
listener
? A
listener
"listens" for events that you don't know when they will occur. (Like a user; pushing a button, checking a box, or selecting a radio button)
Re: Event Listener for a Vector or for an array
Programming
Software Development
14 Years Ago
by JamesCherrill
Yes, that explanation clarifies it. DefaultListModel sounds ideal - it supports a Vector-like data model and was designed for the JList GUI component to track its changes, but the
Listener
design pattern it uses will work for any other class that wants to know about changes. I doubt you will find a (much) better solution.
Re: Event Listener for a Vector or for an array
Programming
Software Development
14 Years Ago
by JamesCherrill
… addListener(...) method and overrides add() etc to broadcast the change
event
forwarding the change to the the Vector. This is basically…
Re: Event Listener on ArrayList
Programming
Software Development
14 Years Ago
by mKorbel
…/tutorial/uiswing/events/mouselistener.html[/url] for storing/identify clicked
event
please reads this thread [url]http://www.daniweb.com/software…
Re: Event handlers: which event class and which event listener interface
Programming
Software Development
11 Years Ago
by JamesCherrill
… Ps with Java 8 lambdas allow you to define a
listener
in a single concise expression http://docs.oracle.com/javase…
Event handlers: which event class and which event listener interface
Programming
Software Development
11 Years Ago
by Violet_82
… down to 1)which interface the class that represents the
event
handler implements (ActionListener,ItemListener etc) and 2) what type… so far I know that if I want to implement
event
handling for, say, a textField, the inner class (or… as yet) implements the ActionListener interface and that the
event
passed on to the class method is and ActionEvent. …
Re: Event handlers: which event class and which event listener interface
Programming
Software Development
10 Years Ago
by Violet_82
…'t for the table in the tutorial telling me which
event
is supported, I would be completely lost
Re: Jpanel event listener
Programming
Software Development
15 Years Ago
by adam291086
…; import java.applet.Applet; import java.awt.*; import java.awt.
event
.*; import java.awt.geom.*; import java.awt.image.ImageObserver; import….JPanel; import java.awt.
event
.ActionEvent; import java.awt.
event
.ActionListener; import java.awt.
event
.KeyAdapter; import java.awt.
event
.KeyEvent; public class board…
Re: Event Listener for a Vector or for an array
Programming
Software Development
14 Years Ago
by niranga
Hi all, @hfx642 Actually I am using 2 classes who shares the Vector object. When the second class updates the Vector. I need to track the updates of the Vector from the first class. [CODE] // Has a Vector instance variable called vFirstClass; FirstClass c1 = new FirstClass(); // This instantiation will be done in a method of FirstClass…
Re: Event Listener for a Vector or for an array
Programming
Software Development
14 Years Ago
by niranga
Hi JamesCherrill, Thanks a lot for the knowledge :) I will try it as soon as possible and get back to you Thanks again :) :) Cheers..!!
Re: Event Listener on ArrayList
Programming
Software Development
14 Years Ago
by SCass2010
So basically I could have something like [CODE] for (int i = 0; i < ArrayListOfJPanels.size(); i++) { if (e.getSource() == myButton[i]) { // code here } } [/CODE] and it would pick any mouse clicks on the JPanels within the ArrayList?
Re: Event Listener on ArrayList
Programming
Software Development
14 Years Ago
by mKorbel
yes myPanel[i] = new JPanel myPanel.addMouseListener(myMouaeListener) myPanel...... . . . MouseListener myMouseListener extends MouseAdapter { for (int i = 0; i < myPanel.size(); i++) { please check that, cos I write that from "memory by born instaled in my head"
Re: Event Listener on ArrayList
Programming
Software Development
14 Years Ago
by SCass2010
Yeah starting to get an idea of what I need to do now thanks... Still a bit confused but I'll give it a shot!! :S
Re: Event Listener on ArrayList
Programming
Software Development
14 Years Ago
by SCass2010
OK one last, if slightly crazy, question... I have an ArrayList containing up to 6 players. To display the details of the 6 players I have a set of textboxes and labels set up like this [CODE]this.jLabel1.setText(players.get(0).getName()); this.jTextField1.setText("£" + players.get(0).getBalance()); this.…
Re: Event Listener on ArrayList
Programming
Software Development
14 Years Ago
by Ezzaral
[B]> or am I trying to do something that is either impossible or close to impossible[/B] Not at all. You should definitely use a loop to create all of those components. They only differ by the player index. You could also use a for-each style loop[CODE]for(Player p : players){...}[/CODE]
Re: Event Listener on ArrayList
Programming
Software Development
14 Years Ago
by mKorbel
hmmm and for numeric value look for (for numeric allows only NUmber Instance) [url]http://download.oracle.com/javase/tutorial/uiswing/components/formattedtextfield.html[/url] maybe you need add new 4 lines for that hmmm stop what's [CODE]playerDisplay pd = new playerDisplay();[/CODE]
Re: Event Listener on ArrayList
Programming
Software Development
14 Years Ago
by SCass2010
Hi, Sorry again but a bit stuck.... I have my Game now creating a JPanel containing the player details for each player in the game when it first starts [CODE] private void createPlayerDetails() { // For each player, create a PlayerDetails JPanel and add it to the ArrayList; // Then add the current PlayerDetails JPanel to the …
Re: Event Listener on ArrayList
Programming
Software Development
14 Years Ago
by Ezzaral
Doesn't your PlayerDetails panel keeping a reference to the Player object that it is displaying? There isn't any reason to remove the panel. Just update the info that it is showing by getting the values from the player object.
Re: Event Listener on ArrayList
Programming
Software Development
14 Years Ago
by SCass2010
Yeah thats the thing I don't really understand but :S the PlayerDetails Panel has a variable Player that I set to the Player that is passed to it, but does that not just store a sort of screen shot of that Player objects details when it was passed? Or is it just sending an address reference, so if i create an update method within the PlayerDetails…
Re: Event Listener on ArrayList
Programming
Software Development
14 Years Ago
by Ezzaral
It is a "live" reference to the Player object itself - not a snapshot. Any data that your panel gets from the object will be current.
Re: Event Listener on ArrayList
Programming
Software Development
14 Years Ago
by SCass2010
Ah yes, I get it now thanks finally got it working! Think I was just over complicating things in my head :P
How can an Action event cause a property change in the parent?
Programming
Software Development
15 Years Ago
by eggmatters
… method in my Main Form class. There is an action
event
listener
associated with the button on the datatable form. Provided is… to main now. I figure I need some type of
event
listener
in the function that instantiated this object that is invoked…
How Do I find out who fired the Event?
Programming
Software Development
15 Years Ago
by eggmatters
… by setting setCellSelectionEnabled(true) and adding the following to the
event
listener
: [CODE]private class selectionListener implements ListSelectionListener { public void valueChanged(ListSelectionEvent… me. So, I think that the
listener
just knows that it is a cell selection
event
and is not concerned about the…
A doubt in SWING event handling
Programming
Software Development
17 Years Ago
by parthiban
… if we want to handle an
event
for a
event
source(say JButton) we should implement corresponding
Event
Listener
(say ActionListener) . I also understood… that we should register the
Listener
with that
event
source. With that knowledge…
What listener to use for my Program
Programming
Software Development
12 Years Ago
by arcticman452
… don'T know if I should use an action
listener
or an
event
listener
for my JComboBox. I have 4 JComboBoxes and only… far: import java.io.*; import java.awt.*; import java.awt.
event
.*; import javax.swing.*; import java.text.*; import java.util.*; public…
1
2
3
17
Next
Last
Search
Search
Forums
Forum Index
Hardware/Software
Recommended Topics
Programming
Recommended Topics
Digital Media
Recommended Topics
Community Center
Recommended Topics
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Top Members
Meet People
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
Backlink Auditor
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2025 DaniWeb® LLC