ItemListemer and ActionListener...and others...how can they live together?

Hi,
I want to have a couple of DropDown Menus, some Buttons and some Checkboxes in the same class....How can I do that knowing that my class needs to implement ItemListener and ActionListener ?
I've tried something like:
"public class extends Applet implements ItemListener implements ActionListener"
but not surprisingly it doesn't work....
and what if on top of that I want a MouseListener, a WindowListener or God knows what else...?
Thanks in advance for your help...
Tom

You need to read the basics about Swing events.
For starters, you do not implement listeners in your Applet class. Instead, you add new listeners to specific components that you want to listen on. For example, if you need to perform certain actions when a JComboBox's selection changes, you would do something like:
my_combo.addActionListener(  new ActionListener() {
    public void actionPerformed(ActionEvent e) {
        System.out.println("selection changed to: " + my_combo.getSelectedItem());
});And for buttons:
my_button.addActionListener( new ActionListener() {
    public void actionPerformed(ActionEvent e) {
        System.out.println("You clicked " + ((JButton) e.getSource()).getText() " button);
}MoustListener and other listeners can be similarily added. See JDK Documentation or Tutorials

Similar Messages

  • Imported MP3 sound and image CD Bird pics and sounds but each song is an album, so cluttering my album and artist lists. How can I keep together as one album please?

    I Imported a MP3 sound and image CD Bird - Birds of Sri Lanka - via itunes on my mac, then synched content to my Iphone as a Playlist to get all the songs/pics in alpha order. BUT each of the 329 birdsongs are listing/appearing as a separate album, so cluttering my album and artist lists :0(
    How can I get all the Birds of Sri Lanka songs/albums to come together as just one album please?
    Do I need to delete what i have, and download again in another way? :0(
    Can I move them all the songs somehow so they become ONE ALBUM :0)
    Thank you
    BW

    OOOOhhhhhh no worries, sorted it.
    In playlist Selected all songs, went into Get info and updated COMPILATION field from NO to YES.
    :0)

  • (updated)UIScrollBar and my own class. Can they works together?

    Hi Eone,
    i'm implementing a uiscrollbar in a class of mine that extends textfield. Unluckly it gives to me  a lot of 1120 error, undefined property, in each row i use a property of this component (except the constructor).
    I read somewhere that As2 not allow to use uisbar in other type of class that extends movieclip or textfiled or you know what...
    It's the same in As3?
    EDIT:
    I found a solution. Some method an properties of UISB can be used in the cvlass (like, contructor, update, target). Some otherelse not. So the other can be used only when i do an instance of my own class, like properties of the instance. Ex:
    textfield.UISB.x = 100;
    textfield: instance of my class
    UISB: scrollbar declared within my class
    x= properties defined only instancing my class

    You need to read the basics about Swing events.
    For starters, you do not implement listeners in your Applet class. Instead, you add new listeners to specific components that you want to listen on. For example, if you need to perform certain actions when a JComboBox's selection changes, you would do something like:
    my_combo.addActionListener(  new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            System.out.println("selection changed to: " + my_combo.getSelectedItem());
    });And for buttons:
    my_button.addActionListener( new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            System.out.println("You clicked " + ((JButton) e.getSource()).getText() " button);
    }MoustListener and other listeners can be similarily added. See JDK Documentation or Tutorials

  • HT201342 When I delete mail on my Apple Mac, it does not delete those mail itemson my IPAD and I phone.  How can they all be coordinated so I do not have delete mail on all three devices.

    When I delete mail items on my Mac Pro it does not delete the same deleted items on my IPAD and I phone.  I have to delete all items from each device.  there must be a way to coordinate all three so that I can remove items on only one device and ICloud should coordinate them.  Please help!

    With iCloud emails (those of type me.com, mac.com or icloud.com), they should be deleted on all devices and computers when deleted on one - this assumes all devices/computers are logged into icloud using the same account.
    For other email accounts that are not part of icloud, like Yahoo and personal domains, this will not work if the account is a POP account.  In that case you must delete from all devices if the account is set up to not delete from the server.
    It sounds like your account is a POP account.

  • I have purchased songs from itunes on my ipad but now they are not there anymore. How can they get them back? Dont come up in songs not on this ipad and in itunes it asks to buy again

    I have purchased songs from itunes on my ipad but now they are not there anymore. How can they get them back? Dont come up in songs not on this ipad and in itunes it asks to buy again

    If you are now in the US then you can only use the US store, so you should update the address on your account
    Changing country : Change the country of your iTunes Store, App Store, iBooks Store, and Mac App Store account.
    Had you copied the songs over to your computer's iTunes library, do they show in the Music section on it ? You can copy purchases that you still have on your iPad over to your computer's iTunes library via the File > Devices > Transfer Purchases menu option

  • HT201269 Hi. I have shared an Apple ID with my children for some time.  As they are getting older they do not wnat me seeing all their messages, photos etc so want their own accounts.  How can they access their purchased music and apps on the new account

    Hi. I have shared an Apple ID with my children for some time.  As they are getting older they do not wnat me seeing all their messages, photos etc so want their own accounts.  How can they access their purchased music and apps on the new account please?

    Yes.
    On their iOS devices, under Settings>iTunes & App Store, they should use your Apple ID. When they log into iCloud, iMessage and Facetime, they should use their personal Apple IDs.

  • HT201269 Can apple fix my ipod , only the bottom keyboard wont work and it takes me forever to slide it & my screen is cracked and i dont have insurance can they replace mine & how much ?

    can Can apple fix my ipod , only the bottom keyboard wont work and it takes me forever to slide it & my screen is cracked and i dont have insurance can they replace mine & how much ?

    Apple will exchange your iPod for a refurbished one for this price. They do not fix yours.
    Apple - iPod Repair price              
    A third-party place like the following maybe less. Google for more.
    iPhone Repair, Service & Parts: iPod Touch, iPad, MacBook Pro Screens
    Replace the screen yourself if you are up to it
    iPod Touch Repair – iFixit

  • I want to download an app in App Store with money than they ask me my security question and I forgot it how can I do?

    I want to dowloade an apps with a money but they ask me my security question and I forgot it how can I do

    You need to ask Apple to reset your security questions; this can be done by clicking here and picking a method, or if your country isn't listed, filling out and submitting this form.
    They wouldn't be security questions if they could be bypassed without Apple verifying your identity.
    (108399)

  • If my iphone require a passcode and i am in accident how can they find my contact

    if my iphone require a passcode and i am in accident how can they find my contact

    Print it out and keep it in your wallet?  Seriously, I would not depend on any electronic device for such vital information.  I keep a hard copy in my wallet with my license and other ID.
    Or, make your own custom lock screen wallpaper with an emergency contact information - that way they can see it without knowing the lockcode.

  • HT204053 Good Morning, I have 2 Apple Account, will be possible to integrate each other in one account ? And if is possible, How can I do that ? Thanks, Fabio.

    Good Morning, I have 2 Apple Account, will be possible to integrate each other in one account ? And if is possible, How can I do that ? Thanks, Fabio.

    You don't have to do anything with the first iPod that you don't use anymore. If you are planning on keeping it, put in a drawer in your house and forget about it.
    You don't need a second account to use with the new iPod. I use one Appl e ID and iTunes library for two iPods, and two iPad. I have different content on all four devices. You can select exactly what you want to sync to each device and it can be different content on all devices.

  • HT4279 I have a Macbook Pro (late 2012) and I would like to connect it to 2 screens simultaneously (1 screen is a TV and can only take HDMI, the other is a larger computer screen and has both VGA and HDMI connections). How can I do this?

    I have a Macbook Pro (late 2012) and I would like to connect it to 2 screens simultaneously (1 screen is a TV and can only take HDMI, the other is a larger computer screen and has both VGA and HDMI connections). How can I do this?

    The article you cited refers to The Mac Pro, a 50lb silver tower -- not a notebook computer.
    Everymac.com says:
    2nd Display Support:
    Dual/Mirroring*
    2nd Max. Resolution:
    2560x1600 (x2*)
    Details:
    *This model supports a simultaneous maximum resolution up to 2560x1600 on two external displays via Thunderbolt. Alternately, it can support a single display up to 2560x1600 via Thunderbolt and a single display up to 1920x1200 via HDMI. Although it can theoretically power all three external displays, as confirmed by a helpful reader, it runs too hot with three displays connected.
    Also see: How many external displays can the Retina Display MacBook Pro models support? What is the maximum supported resolution of each? Are adapters required?
    When using other than ThunderBolt displays, the ThunderBolt port is directly compatible with Mini DisplayPort, and can be forced into compatibility (with Single-Link DVI or HDMI up to 1920 wide) with a simple adapter.
    To adapt to wider displays, an ACTIVE Dual-Link adapter is needed, about US$100.

  • I have a macbook prob and I'm trying to clean it up. but its says i have 71GB used of "OTHER". how can i get a break down of this "OTHER"??

    I have a macbook prob and I'm trying to clean it up. but its says i have 71GB used of "OTHER". how can i get a break down of this "OTHER"??
    Thank You!

    The info from the below linked article may be of help.
    You have to download the app OmniDiskSweeper to do the job.
    http://pondini.org/OSX/DiskSpace.html
    Best.

  • N my house we have 2 iphone 4, and everytime we get the same contact list freom each other, how can we unsync the contacts so each user keeps thir own contact list?

    n my house we have 2 iphone 4, and everytime we get the same contact list freom each other, how can we unsync the contacts so each user keeps thir own contact list?

    Hi user 1724, before icloud, we had the same issue.... 
    so yes,  the solution was to  each log  into the mac separately.
    i kept the main itunes library and apple id, and my son made his own itunes library (which linked to the main itunes/apple id)   - so we were able to maintain separate contacts lists.
    but then w/ the cloud i guess we assumed the cloud would know we each have different contact lists on diff. phones, but it seems the cloud just lumped it all together -

  • In the storage there is " others" how can i find it and erase it

    in the storage there is " others" how can i find it and erase it

    abufadwa,
    something categorized as Other is not necessarily something that should be erased — for example, most components of OS X would be categorized as Other. If you would like to make more room on your internal disk, it would probably be better to choose from some of the other categories (viz Audio, Movies, Photos), and to move such files from your internal disk to an external disk.

Maybe you are looking for