How to get my own EventHandler and EventListener working?
I´m trying to learn how to write my own EventListener.
I would do something like the ActionListener.
import java.util.EventListener;
import java.util.EventObject;
import javax.swing.JButton;
import javax.swing.JFrame;
public class Main extends JFrame {
public static void main(String[] args) {
new Main();
private MyButton button = new MyButton();
public Main() {
this.setSize(200,200);
this.setVisible(true);
button.addMyEventListener(new MyEventListener(){
public void action(MyEventHandler e) {
System.out.println("Changed");
this.add(button);
class MyButton extends JButton implements MyEventListener {
private MyEventListener list;
public void addMyEventListener(MyEventListener list){
this.list = list;
public void fireAction(MyEventHandler e){
list.action(e);
public void action(MyEventHandler e) {
fireAction(e);
interface MyEventListener extends EventListener{
public void action(MyEventHandler e);
class MyEventHandler extends EventObject{
private Object obj;
public MyEventHandler(Object obj){
super(obj);
this.obj = obj;
}But when I press the button, the action is not performed. What else do I have to do?
Follow the bouncing example
package mil.army.logsa.sandbox.thread;
import java.util.Observable;
import java.util.Observer;
public class RunnableExample implements Observer {
public static void main(String[] args){
RunnableExample e = new RunnableExample() ;
e.exec() ;
// This is here because you can't reference (this) in the static context of the main method
private void exec(){
System.out.println("Launching RunnableExample") ;
System.out.println("Creating Thing") ;
Thing t = new Thing(this) ;
t.start() ;
System.out.println("Shutting down RunnableExample") ;
@Override
public void update(Observable o, Object arg) {
System.out.println(arg) ;
class Thing extends Thread {
private ObservableThing obsThing ;
public Thing(Observer o){
super() ;
obsThing = new ObservableThing() ;
obsThing.addObserver(o) ;
public void run(){
System.out.println("Starting Thing") ;
for(int i=0; i<100; i++){
obsThing.notifyObservers(i + " is " + (i%2==0 ? "EVEN" : "ODD")) ;
System.out.println("Thing is finished") ;
class ObservableThing extends Observable{
public void notifyObservers(Object o){
setChanged() ;
super.notifyObservers(o) ;
}PS.
Similar Messages
-
How to get my own facebook/twitter wall status using CS5.5?
Hi,
i'm trying to learn how to get my own facebook & twitter wall status into flash so that I can export it out and install it in my iPhone.
After reading the facebook and twitter API documentation, I'm still very confussed on how to use them.
I'm very new to this and hope to get a suitable tutorial/sample code for some reference.
Help is appreciated. Thank you.Hi,
i'm trying to learn how to get my own facebook & twitter wall status into flash so that I can export it out and install it in my iPhone.
After reading the facebook and twitter API documentation, I'm still very confussed on how to use them.
I'm very new to this and hope to get a suitable tutorial/sample code for some reference.
Help is appreciated. Thank you. -
I've used iMessage for abit now and latly my step dad has got an ipad that is now joint to the same computer and on his ipad is my number and the email for imessage and i want to no how to get it of fully and not just untick it?
Hi barryfromwarrington,
Welcome to the Support Communities! There are two things I can think of to keep your Stepdad's information separate from yours on the computer and the iPad. On the computer, he should have his own administrative account, and on the iPad he needs his own Apple ID for iTunes and iCloud services. Here is some basic information to get started. I don't know if you have a Mac or Windows computer, so I'll include info for both.)
OS X Yosemite: Set up users on your Mac
http://support.apple.com/kb/PH18891
OS X Yosemite: Set up users on your Mac
If your Mac has multiple users, you should set up an account for each person so he or she can personalize settings and options without affecting other users.
Add a user
Choose Apple menu > System Preferences, then click Users & Groups.
Click the lock icon to unlock it, then enter an administrator name and password.
Click Add below the list of users.
Click the New Account pop-up menu, then choose a type of user.
administrator: An administrator can add and manage other users, install apps, and change settings.
Enter a full name for the new user. An account name is generated automatically. To use a different account name, enter it now—you can’t change it later.
Enter a password for the user, then enter it again to verify. Using a password hint is recommended to help the user remember his or her password.
Click Create User.
For an administrator, select “Allow user to administer this computer.”
Last Modified: Nov 18, 2014
iTunes for Windows Vista, Windows 7, or Windows 8: Fix unexpected quits or launch issues - Apple Support
http://support.apple.com/en-us/HT203206
Follow the steps below to create a new user account in Windows Vista or Windows 7:
Choose Start > Control Panel.
Open "Add or remove user accounts." (If you're using the Classic view in Windows Vista, open "User Accounts," and then open "Manage another account.")
Select "Create a new account" and follow the instructions to set up the account.
Once you create the new account, choose Start > Log Off.
Log in to the new user account.
Open iTunes and see if the issue you're experiencing persists in this new user account.
Frequently asked questions about Apple ID - Apple Support
http://support.apple.com/en-us/HT204161
iCloud: Set up iCloud
http://support.apple.com/kb/PH2609
Cheers,
- Judy -
I was using OS Snow Leopard and on 8/1/13 I downloaded Mountain Lion. Then I found out it was not compatible with my HP Printer (HP Photosmart C5580 all-in-one) so I called Apple support and the tech told me to erase the hard drive instead of going in the time machine. Well I did that and then it took about three hours three days a week for about three weeks on the phone with an apple tech to get all my stuff back on my computer. I have had trouble with my printer (won't do the scan anymore and wasn't printing on my DVDs. Also the computer keeps freezing up when it is in the sleep mode, etc.
When I tried to list my problem on this forum it lists your OS at the bottom and mine had Mountain Lion listed as what I was using so apparently it didn't erase it. Want to know how to get Mountain Lion off and put my Snow Leopard on so things start working right.Go to the menu/About This Mac - what OS version shows there?
Do a backup, preferably 2 separate ones on 2 separate drives.
Revert to a Previous OS X
Revert to Snow Leopard
If you do revert, I'd use Setup Assistant to restore your data. This process takes a while, so do it when you won't need the computer for several hours, based on my experience. -
I've got OSX/Genieo.A virus on my mac and don't know how to get rid of it and w I have it
There is no need to download anything to solve this problem.
You installed the "Genieo" malware. The product is a fraud, and the developer knowingly distributes an uninstaller that doesn't work. I suggest the procedure below to disable Genieo. This procedure may leave a few small files behind, but it will permanently deactivate the malware (as long as you never reinstall it.)
Malware is always changing to get around the defenses against it. These instructions are valid as of now, as far as I know. They won't necessarily be valid in the future. Anyone finding this comment a few days or more after it was posted should look for more recent discussions or start a new one.
Back up all data before proceeding.
Step 1
Triple-click anywhere in the line below on this page to select it:
/Library/Frameworks/GenieoExtra.framework
Right-click or control-click the line and select
Services ▹ Reveal in Finder (or just Reveal)
from the contextual menu.
If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combination command-C. In the Finder, select
Go ▹ Go to Folder...
from the menu bar and paste into the box that opens by pressing command-V. You won't see what you pasted because a line break is included. Press return.
A folder should open with an item named "GenieoExtra.framework" selected. Move that item to the Trash. You'll be prompted for your administrator password.
Move each of these items to the Trash in the same way:
/Applications/Genieo.app
/Applications/Reset Search.app
/Applications/Uninstall Genieo.app
/Library/LaunchAgents/com.genieo.completer.update.plist
/Library/LaunchAgents/com.genieo.engine.plist
/Library/LaunchAgents/com.genieoinnovation.macextension.plist
/Library/LaunchDaemons/com.genieoinnovation.macextension.client.plist
/Library/PrivilegedHelperTools/com.genieoinnovation.macextension.client
/usr/lib/libgenkit.dylib
/usr/lib/libgenkitsa.dylib
/usr/lib/libimckit.dylib
/usr/lib/libimckitsa.dylib
~/Library/Application Support/com.genieoinnovation.Installer
~/Library/LaunchAgents/com.genieo.completer.download.plist
~/Library/LaunchAgents/com.genieo.completer.update.plist
If there are other items with a name that includes "Genieo" or "genieo" alongside any of those listed above, move them as well. Some of these items will be absent, in which case you'll get a message that the file can't be found. Skip that item and go on to the next one.
Restart and empty the Trash. Don't try to empty the Trash until you have restarted.
Step 2
From the Safari menu bar, select
Safari ▹ Preferences... ▹ Extensions
Uninstall any extensions you don't know you need, including ones called "Genieo" or "Omnibar," and any that have the word "Spigot" or "InstallMac" in the description. If in doubt, uninstall all extensions. Do the equivalent for the Firefox and Chrome browsers, if you use either of those.
Your web browser(s) should now be working, and you should be able to reset the home page and search engine. If not, stop here and post your results.
Make sure you don't repeat the mistake that led you to install this trojan. Chances are you got it from an Internet cesspit such as "Softonic" or "CNET Download." Never visit either of those sites again. You might also have downloaded it from an ad in a page on some other site. The ad has a large green button labeled "Download" or "Download Now" in white letters. The button is designed to confuse people who intend to download something else on the same page. If youever download a file that isn't obviously what you expected, delete it immediately.
You may be wondering why you didn't get a warning from Gatekeeper about installing software from an unknown developer, as you should have. The reason is that this Internet criminal has a codesigning certificate issued by Apple, which causes Gatekeeper to give the installer a pass. Apple could revoke the certificate, but as of this writing, has not done so, even though it's aware of the problem. This failure of oversight has compromised both Gatekeeper and the Developer ID program. You can't rely on Gatekeeper alone to protect you from harmful software.
Finally, be forewarned that when Genieo is mentioned on this site, the attacker sometimes shows up under the name "Genieo support." He will tell you to run a fake "uninstaller." As he intends, the uninstaller does not completely remove the malware, and is in fact malware itself. -
I have an old ipod (it's the very thin oblong one in purple, the one before the one that does video) and want to know how to get everything off it and into my iTunes library. My old computer died and the original library was lost, so don't have any of the content saved anywhere else. I now have an iPhone 5S and listen to music on that, so want to be able to listen to things from the old ipod too.
Can anyone help please?
Thanks very much
JaneApple normally does not get involved in handling lost objects like this. Since a real name is not installed it will be much more difficult.
You can try contacting Apple support at the US number, assume you are US going to BWI from the listing: http://support.apple.com/kb/HE57 and explain the situation and see if they offer any suggestions. -
How to get LASTDAY for each and every month between given dates..
Hi Friend,
I have a doubt,How to get LASTDAY for each and every month between given dates..
for ex:
My Input will be look like this
from date = 12-01-2011
To date = 14-04-2011
And i need an output like
31-01-2011
28-02-2011
31-03-2011
is there any way to achieve through sql query in oracle
Advance thanks for all helping friendsHere's a 8i solution :
select add_months(
trunc(
to_date('12-01-2011','DD-MM-YYYY')
,'MM'
, rownum ) - 1 as results
from all_objects
where rownum <= ( months_between( trunc(to_date('14-04-2011','DD-MM-YYYY'), 'MM'),
trunc(to_date('12-01-2011','DD-MM-YYYY'), 'MM') ) );
The above two query is worked in oracle 11GActually the first query I posted is not correct.
It should work better with
months_between(
trunc(to_date(:dt_end,'DD-MM-YYYY'),'MM'),
trunc(to_date(:dt_start,'DD-MM-YYYY'),'MM')
)Edited by: odie_63 on 12 janv. 2011 13:53
Edited by: odie_63 on 12 janv. 2011 14:11 -
How to get purchase organization, PAYMENT_TERMS and INCO_TERMS for vendor?
Dear friends,
How to get purchase organization, PAYMENT_TERMS and INCO_TERMS for a vendor(LIFNR)? I couldn't fine these data in LFA1 table.
Thanks a lot!Hi,
You can find ZTERM(Terms of Payment) in LFB1 table for a particular vendor (LIFNR) and company code.
and Incoterms INCO1 in LFM1 table for a particular vendor (LIFNR) and purchase organisation.
Hope this answers your query.
Regards,
Brajvir -
Does anyone know how to get the vendor ID and product ID for NI-Visa? TIA
Does anyone know how to get the vendor ID and product ID for NI-Visa? TIA
This question has already been addressed in this thread:
Does anyone know how to get the vendor ID and product ID for a USB device in NI-Visa?
John M
National Instruments -
Does anyone know how to get the vendor ID and product ID for a USB device in NI-Visa? TIA
Does anyone know how to get the vendor ID and product ID for a USB device in NI-Visa? TIA
Hello,
Exactly which USB device are you referring to? Is the device a NI product?
The Product ID for National Instruments DAQPad-6020E is 0x12C0. The USB vendor ID is 0x3923. This is a 16-bit hexadecimal number(1093) (that is decimal 4243).
Also, here's a document on our website that will help you in configuring NI-VISA to control your USB device:
http://zone.ni.com/devzone/conceptd.nsf/webmain/6792BAB18242082786256DD7006B6416?opendocument
Swapnil P.
National Instruments Engineer -
How to get back deleted photos and contacts???
First time to sync iphone 4 to computer and I have accidently deleted all my photos and contacts! All the photos from my computer are now in albums on my iphone. Any help in how to get back deleted photos and contacts would be greatly appreciated.
Thanks,
SandraHi Allan,
Thanks for the reply. I restored from backup but now all photos from computer are gone, plus messages since yesterday etc.! -
How to get the kerning value and set it to back use script?
hi,guys
I come back again.
I encountered a kerning problem.
how to get the kerning value and set it to back use script?
Thanks very much!For both cases, the filename can be found on the FILE.ReceivedFileName Context Property. You can access this Property in a Pipeline Component or Orchestration and take any action you want, such as apply to a database.
The value is accessed by: MyReceivedMessage(FILE.ReceivedFileName)
In the case of a duplicate EDI Interchange, you would use the Failed Message Routing feature to capture the error message with either an Orchestration or Send Port. -
How to program my own UPI and OPI?
Hi,
I just want to know how to program my own UPI and OPI. I want to
add some features into the DBMS. Is there some one can answer my
questions, or tell me where to find information? Thanks!
nullFollow the bouncing example
package mil.army.logsa.sandbox.thread;
import java.util.Observable;
import java.util.Observer;
public class RunnableExample implements Observer {
public static void main(String[] args){
RunnableExample e = new RunnableExample() ;
e.exec() ;
// This is here because you can't reference (this) in the static context of the main method
private void exec(){
System.out.println("Launching RunnableExample") ;
System.out.println("Creating Thing") ;
Thing t = new Thing(this) ;
t.start() ;
System.out.println("Shutting down RunnableExample") ;
@Override
public void update(Observable o, Object arg) {
System.out.println(arg) ;
class Thing extends Thread {
private ObservableThing obsThing ;
public Thing(Observer o){
super() ;
obsThing = new ObservableThing() ;
obsThing.addObserver(o) ;
public void run(){
System.out.println("Starting Thing") ;
for(int i=0; i<100; i++){
obsThing.notifyObservers(i + " is " + (i%2==0 ? "EVEN" : "ODD")) ;
System.out.println("Thing is finished") ;
class ObservableThing extends Observable{
public void notifyObservers(Object o){
setChanged() ;
super.notifyObservers(o) ;
}PS. -
HT1483 Ipod froze. How to get over the problem and bring it back?
Ipod froze and not responding. How to get over this problem and bring back the Ipod ?
Go to the menu/About This Mac - what OS version shows there?
Do a backup, preferably 2 separate ones on 2 separate drives.
Revert to a Previous OS X
Revert to Snow Leopard
If you do revert, I'd use Setup Assistant to restore your data. This process takes a while, so do it when you won't need the computer for several hours, based on my experience. -
How to get both OTF data and spool at a time
Hi Experts,
My requirement is to get both OTF data and spool.
In 'OPEN_FORM' i tried passing itcpo-TDGETOTF = 'X'. itcpo- TDNEWID = 'X'.
I was able to get OTF data but spool is not getting generated.
IF i pass only itcpo- TDNEWID = 'X'. the spool is getting generated but not OTF data.
when both the fields are set i.e. itcpo-TDGETOTF = 'X'. itcpo- TDNEWID = 'X'.
the spool is generation is getting supressed.
Similarly when i tried to get OTF data by passing itcpo-TDGETOTF = 'X'. to 'OPEN_FORM' as i need to convert it to PDF and send it to vendors as email ,
The print preview in TCODE ME23n was not getting generated for 'MESSAGE' option 'External send'.
Please suggest me how to get both OTF data and spool at a time.Hi Kartik,
This one is similar to my question to print and email invoice at same time. I pass itcpo-tdgetotf = 'X' in order to get otfdata and send email with the attachment of otfdata.
Now I have data in otfdata, but when I call print_otf function, I clear out itcpo-tdgetotf, and passed
itcpo-tddest = device_type but I still get error message said 'Handler not valid for open spool request'.
Can you give me a working example that you have otfdata table and print data from that table. I also post my question on other thread
submit report and export to memory
thanks
Maybe you are looking for
-
OLE2 Excel File Save as password protected
Hi All, I would like to save an Excel File as Password protected. This File is created by OLE2. How can I do this? This is the Coding, how I save the File--> CALL METHOD OF ls_wbook 'SaveAs' EXPORTING #1 = p_file. Thanks for the Answers... Bye Besi
-
Smart playlists with video podcasts
I have a smart playlist on my iPod with one rule: Video Kind is Movie When I play videos from this list I hear the audio, but the video is frozen on a frame. All videos work fine when played from the main Videos menu. Is anybody able to play video po
-
Dear Experts, There are many threads regarding spool. But here I had given task by functional that I had to develop an object which show a some data list, in which i have to tick mark and send selected list as a mail to particular party. Also same th
-
Hi everyone! I wanted to know if there in the industry other devices from other manufacturers that do the same or similar functions as Cisco ISE, existing in the form of appliance? This is to compare their functionality, tech characteristics and so o
-
Hi, I need to be able to indicate certain things in a Spry table. For example, I have a list of invoices, which the user can click and see the details of. The invoices are in several different states, depending. If it's "outstanding", I'd like it to