How to use ActionListener and ItemListener in the same class

Why can't I use both ActionListener and ItemListener in the same Class?
I want to use a drop down list and an entry box on the same form.
How? I'm having trouble compling......
Thanks!
CODE:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class Disp extends Applet implements ActionListener, ItemListener
{ TextField entry=new TextField(7);
Button Enter=new Button("Enter");
public void init()
add(entry);
add(Enter);
entry.addActionListener(this);
entry.requestFocus();
Enter.addActionListener(this);
public void actionPerformed(ActionEvent thisEvent)
String answer=entry.getText();

Simply get your Applet to implement both ActionListener and ItemListener.
public class MyApplet extends Applet implements ActionListener, ItemListener
  public void init()
    itemWidget.addItemListener(this):
    actionWidget.addActionListener(this);
  public void actionPerformed(ActionEvent e)
    System.out.println("ACTION PERFORMED!");
  public void itemStateChanged(ItemEvent e)
    System.out.println("ITEM STATE CHANGED!");
}Hope this helps.

Similar Messages

  • Satellite M30X-122: How to use headphone and speaker at the same time?

    Hi,
    is there any possiblity to use the headphone and the speaker at the same time?
    When I plug the head phones in the socket, the speaker is swtiched off now.
    Thanks
    Peter

    Hi Peter,
    Unfortunately there is no way to use both the headphones and the speakers at the same time. This is because tghere is as physical disconnection of the current to the internal speakers when you plug in the headphones. It is not software controlled. The only way of bypassing this would be to dismantle the headphone socket and permanently solder the connections which are broken when you insert the headphone socket.
    regards,

  • How to use Spry and Jquery on the same page.

    I'm using both spry (dataset) and jquery (datepicker) on my page. When I load the jquery script my dataset doesn't work.
    I've done some research and found that I need to insert an observer that tells jquery when the spry dataset is finished loading. Found this information at: http://forums.adobe.com/message/2899897. I've tried implementing this into my script but just doesn't seem to work. Below is the script from my site, how would I insert an observer into this script?
    <script type="text/javascript">
    <!--
    var ds1 = new Spry.Data.HTMLDataSet("/test/fsasearch_results_dynamic.php", "search_results");
    var ds2 = new Spry.Data.HTMLDataSet("/test/countstable_dynamic.php", "table");
    $(function() { $( "#datepicker" ).datepicker({ dateFormat: 'yy-mm-dd', beforeShowDay: nonWorkingDates, numberOfMonths: 2, minDate: +5, maxDate: +30});
        function nonWorkingDates(date){
            var day = date.getDay(), Sunday = 0, Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6;
            var closedDates = [[7, 29, 2009], [8, 25, 2010]];
            var closedDays = [[Saturday], [Sunday]];
            for (var i = 0; i < closedDays.length; i++) {
                if (day == closedDays[i][0]) {
                    return [false];
            for (i = 0; i < closedDates.length; i++) {
                if (date.getMonth() == closedDates[i][0] - 1 &&
                date.getDate() == closedDates[i][1] &&
                date.getFullYear() == closedDates[i][2]) {
                    return [false];
            return [true];
    //-->
    </script>

    Please post any SPRY related question in the SPRY forum.

  • My Ipad mini does not see my printer. my wife's ipad2 does. We both use IOS8 and upgraded at the same time. How can I remedy this?

    My Ipad mini does not see my printer. my wife's ipad2 does. We both use IOS8 and upgraded at the same time. How can I remedy this?

    OK great info!
    I found 2 possible ethernet to USB adapters:
    By "Plugable":  USB 2.0 to ethernet LAN wired network adapter - seems this will work, but I'll contact Plugable.
    2. Apple USB Ethernet Adapter
    Easily connect your MacBook Air computer to an Ethernet network with the Apple USB Ethernet Adapter. Small and light, it connects to the USB 2.0 port of your MacBook Air and provides an RJ-45 connector that supports 10/100BASE-T performance.  BUT NOT SURE IF THIS WILL WORK ON ANYTHING BUT a MacBook Air…
    One person commented: 
    This little gem used to be the device of choice for adding a second Ethernet interface to a Mac Mini Server and I'd been using one that way for about a year. After doing a software update to 10.6.6 it stopped working. Forewarned is forearmed – it appears that Apple is finally enforcing the MacBook Air system requirement.
    Thanks for any additional comments.
    Best regards,
    Steve Schulte
    Sunday 6 January 2013

  • Use AO and AI in the same program

    Hello,
    I like write a program to use AO and AI in the same program.
    In this program write a timer a voltage to a AO port and after then it should read a voltage.
    I know how I write voltage to a AO port and read a voltage on a AI port, but not in a the same program.
    The read- and the write-Task, should work as soon as possible (<=1ms). 
    (My timer have 100us ticks) 
    what should I inilize for the PCI6229 card, to use AO and AI and in which order?
    Can I have a example or pseudocode?
    Best regards
    Heiko Mayer 

    Hi Heiko-
    There is very little overlap between the AO and AI examples, so you should be able to piece the code together pretty easily.  I would offer these suggestions:
    1.  These lines should only be executed once, and they should be done before any AI or AO specific initialization is done:
    configureTimebase (board);
    pllReset (board);
    analogTriggerReset (board); 2.  It does not matter which order you perform the AI or AO initialization, but I would recommend waiting to unground the AO reference (by   board->AO_Calibration.writeAO_RefGround (kFalse) until all of the AI and AO init is done.  This will help to avoid any glitching on the AO lines.  The only steps that should be saved until after ungrounding the reference are the Start operations for AI and AO (depending on the AO mode you use, there may not be a specific Start operation to call.  Consult the MHDDK examples for more info about the required steps).
    Hopefully this helps-
    Tom W
    National Instruments

  • How to stream Webcam and Desktop at the same time?

    Hey Guy,
    I just got a little Problem with  FMLE... I want to stream live during a Game, but I dont know how to stream Desktop and Webcam at the same time ^^. The streaming Platform i want to use is twitch.tv.. the most common Gamin Platform I think...
    I got an IMac i7.
    Pls help me   I dont get how all these ProGamer do it -.-
    Thanks in advance
    Kathi

    You're going to need additional software or hardware.  If you're running a Macintosh, try CamTwist.  It's free and allows you to create virtual "cameras" from just about anything you can see on your computer.  It's a bit clunky getting used to the interfact and how it works, however.
    Hardware solutions (like scanline converters and video switchers) can get pretty expensive.  So you may want to go with a piece of software that can handle on-the-fly video compositing/switching.  There are two applications that come to mind right off the bat -- and lucky for you, both of them can also output to a live streaming server. 
    Wirecast is a popular choice, although the pricing starts around $500.  It's Macintosh/Windows.
    A very popular choice among gamers is XSplit (Windows only) and is a subscription-based model (you pay a small fee by the month, quarter, or year).  XSplit has some very impressive compression happening under the hood, and was originally designed for gamers who wanted to share their desktop, XBOX, or PS3 adventures... all while also being able to lay over banners, PIP (picture-in-picture) of themselves, or anythhing else they wanted to clutter the screen with.
    If you're running on Windows, give XSplit at shot.  It can easily handle your desktop (or most anything else) as a "camera" as well as being able to lay your webcam on top of the desktop feed.

  • I cannot use data and voice at the same time.

    I cannot use data and voice at the same time.
    I am on Wifi (connected) and at the same time I am on a voice call. when I switch to my RSS feed reader it does not sync it comes out with a message cannot connect to internet, I thought it is a problem with the feed reader application, IE 10 behaves the same I cannot browse when I am on a voice call.
    This is a very basic issue, am I missing something? Please help.
    My Model is lumia 820 with the latest portico update.
    TIA
    Sandeep

    I am aware that packet data via EDGE and voice cannot happen at the same time, surprisingly when I am on voice call I cannot connect to internet via Wifi too

  • Can we use exceptions and conditions at the same time?

    can we use exceptions and conditions at the same time? Are there any dependencies between exceptions an conditions?

    Exceptions are used when there are some mistakes , or exceeds the supposed values, we can highligt that in different colours for enabling the validator to notice easily. In this we are giving conditions for considering the value as exceptions. suppose, if the values is out of the range -1 to +1 then exception.
    But conditions can be considered as the restrictions given in measure level also. So please elaborate what you meant by conditions

  • How to post aquisition and depriciation at the same time

    Hi Gurus,
    Could you please let me know how to post aquistion and depriciation at the same time.

    Hi
    What do you mean by postin at a time, is it uploading the balances to SAP
    if not there is no question of posting at a time
    Thanks
    Kameshwar Rao

  • My SB Audigy 2 card can't use headset and musicamplifier at the same time

    Hi, i just bought a SB Audigy 2 [D400] and i have downloaded drivers and programs. I run Windows XP SP2.
    The soundcard works fine but it is very very annoying that i physically have to change the jack in the green=line out jack from headset to musicamplifier when i want to use my musicamplifier and change back the jack in the green=line out from musicamplifier to headset when i just want to use the headset/headphones .
    In the shop they told my that i can connect both amplifier and headset at the same time and then with creative software control whether there is sound in the headset or in the amplifier. But i can't simple get it work.
    I tried to use the green to the amplifier and the headset/speakers in the black (line out 2) and then with creative speaker settings softeware choose headphones but still the ampliefier receive the sound and no sound in the headphones. Why? In fact no matter what configuration i try the headphones doesn't work.
    But if i change the jacks so headset is in the green line out then only headset is working and the amplifier doesn't work no matter i put it in sort=line out 2 jack or orange=line out 3 jack.
    Can somebody here tell me if it is possible or not to connect both headset and external amplifier and control by software which to play? and how?
    please help, thx.
    Michael

    If you can have an ASIO compatible music playing system, then it might be possible to have system like you wish when using Creative Audigy 2 card. Since ASIO bypasses Windows Audio System, you can use both 'drivers' (ASIO - WDM/MME/DS) side by side.
    Say you want to play a game (using headset /w mic) and someone other like to listen music at the same time. With ASIO capable system you can output your music for example to "center L/R (stereo) channels" and same time output sounds from other source (using MME/DS/WDM drivers) to normal output channel (Front L/R). Only thing is, you need to set your speakersystem to 4 or 6 (depending which other channel you're using) (and for better 'balance' to adjust "angle" on THX console. You get the THX console by installing Audigy 2 Zs software).
    Try for example http://img332.imageshack.us/img332/463/djs9mo.jpg[/img] width="406" alt="Image Hosted by ImageShack.us" >
    Another option:
    Say you want to play music through external amplifier and play game online with your headset + microphone (eg. others but you listen the music, you play games)
    --> try free http://img332.imageshack.us/img332/4589/tbp7rz.jpg[/img] width="406" alt="Image Hosted by ImageShack.us" >
    If you use ASIO on BeatPort Player you can select L/R individually from the list(s). Same rules as described earlier.
    = You can play from 2 different sources simultaoneusly (ASIO + WDM/MME/DS) to two different outputs without disturbance. The other (WDM/MME/DS) source is set 'automatically' output to (Audigy) "green" port, and the other (ASIO) to "black" or "orange" port (as set).
    .jtpMessage Edited by jutapa on 09-5-2005 05:30 AM

  • How to use 10 touch points at the same time ?

    I want to project game which use about 10 touch points? How can I use all of them at the same time ?
    Please give me a sample code.

    Firstly you must know how many touch points can accept your device. For example iPad and iPhone can't handle more than 5.
    1. Enable touch input mode by
    Multitouch.inputMode=MultitouchInputMode.TOUCH_POINT;
    2. Use same method as for mouse input but instead use TouchEvent API

  • How to put material and service in the same order

    I want to put the material and service in the same order. How do it input different taxes. and also migo for one material item and other service item.

    HI,
    In your scenario create material and service PO using T-code ME21N as follows.
    1) Select PO document type, vendor and PO date
    2) PO first line item account assignment 'N' if project and give input data material code,plant,storage location,qty,rate,delivery date and tax code.
    3) PO second line item account assignment 'K', item category 'D',material short text for service, plant,storage location,material group data's are input given and press enter it will open 'Service Tab' in Item Detail Menu.
    4) In item Detail Menu - Service tab you will give Service no.,qty,gross price for the above  service material activity and service tax code in Invoice TAB and then check PO and SAVE.
    5) After getting PO approved by top management.
    6) PO first line item, you will do MIGO and PO second line item you will do ML81N service entry sheet.
    7) On the vendor bill, you will mention material document number (GRN no.) & Service sheet number and given to accounts dept.. They will book vendor bill and give payment.
    Hope, it is useful for you and solve your requirement.
    Regards,
    K.Rajendran

  • How to record midi and audio at the same time?

    Hello,
    I have a Roland sh-201 synth and Logic 9. When I use patches from the sh-201, it will record it via audio. What if I wanted to record the audio but also have the midi information as well? How would I be able to accomplish this? My synth is connected via USB which carries both midi and audio. Sorry for my poor english, but any help would be greatly appreciated.
    Thank You.

    Hi
    Logic will record both audio and MIDI at the same time, but you *MUST* have the Software Instrument/MIDI track selected in the Arrange Track List.
    The audio track must be 'Record Ready':
    HTH
    CCT

  • How do I read and write on the same CAN Port

    I have a PXI chassis with a NI PXI 8464 CAN card.  I am learning to use this device.  I am trying to send messages back and forth between the two ports on the card.  I have four simple VIs:ReadWas; WriteWas;ReadSteering; and WriteSteering.  I have been starting the read VIs first then starting the write VIs.  When I start the write VIs I get an error from CAN init saying I am trying to change an object that is running. 
    Is it possible to send and receive on the same port of the CAN card without stopping then reinitializing the card?
     I have attached ReadWas, ReadSteering and WriteSteering to this post.  ReadWas and WriteSteering share a CAN port.
    Any help is greatly appreciated,
    Thanks,
    Phillip
    Attachments:
    ReadWAS.vi ‏112 KB
    ReadSteering.vi ‏143 KB
    WriteSteering.vi ‏114 KB

    have you looked at this example, (CAN Send & Receieve using NI-CAN Frames) it is in the example code section 
    http://sine.ni.com/apps/we/niepd_web_display.DISPLAY_EPD4?p_guid=E993D9B56C3D2BABE0340003BA230ECF&p_...
    http://sine.ni.com/apps/we/niepd_web_display.DISPLAY_EPD4?p_guid=E993D9B56C3D2BABE0340003BA230ECF&p_...
    Basically, you are getting the error because the second time you call CANconfig it realizes it is already open. Try consolidating the 2 pieces of code into 1 CAN VI.

  • Ipod nano (5th generation) - want to use headphones and charge at the same time

    I have an ipod nano (5th generation).  Do I need a special set of headphones to use the headphone jack and charge the ipod at the same time?

    The iPod nanos have a 30 pin dock connector and a headphone jack. When you charge the iPod you use the dock connector therefore you can use and charge at the same time. You cannot use and charge the iPod shuffle at the same time. You might have the two mixed up.

Maybe you are looking for

  • Parallel port under linux

    could anybody help a linux-labview beginner? i'm trying to write to my parallel port. but labview is obviousely not set up for this. does anywone happen to have a vi which can do that? best of regards michael h. fischer ==============================

  • How to migrate custom user attributes (UDF) from test environment to production when a sandbox is published

    Hi all, I like to migrate custom attributes from test environment to my production environment. I read OIM documentation and i tried to fallow these steps but I cannot export sandbox and import it because all sandboxes are published in the test envir

  • Can you add ram to a Macbook5,2

    Can I add ram to this macbook to be able to make it more compatible and be able to open applications that I can't without upgrading my software? Is It worth it? How much Ram would I have to add for Lion software? Is that possible? I am not in the pos

  • Acrobat Professional 8.1

    When I try to run Acrobat Professional Trial on a Vista Business X86 system it reports a fatal incompatibility with Adobe Reader!!! I have uninstalled Adobe Reader and tried to remove any scraps of files or registry entries connected with it but the

  • Currently when I click on "Open all tabs" the original site stays on the menu bar. Didn't before.

    Before, when I opened all tabs the site I was on closed, this doesn't happen now. The current site stays open. Also, when I use hotmail another firefox browser opens. Sometimes when I close the hotmail window the other window closes instead.