How to make what is in textfeild be displayed

* File: CyberPet.java
* Author: Java, Java, Java
* Description: This class represents a CyberPet that can
*  eat and sleep on command. This version incorporates
*  a public getState() method to report the pet's state.
public class CyberPet
    private boolean isEating = true;    // CyberPet's state
    private boolean isSleeping = false;
    private boolean isThinking = false;
    private String name = "no name";    // CyberPet's name
    public CyberPet (String str)        // Constructor method
        name = str;
    public void setName (String str)    // Access method
        name = str;
    } // setName()
    public String getName()
        return name;           // Return CyberPet's name
    } // getName()
    public void eat()          // Start eating
        isEating = true;       // Change the state
        isSleeping = false;
        isThinking = false;
        return;
    } // eat()
    public void sleep()        // Start sleeping
        isSleeping = true;     // Change the state
        isEating = false;
        isThinking = false;
        return;
    } // sleep()
   public void think()
        isThinking = true;
        isSleeping = false;
        isEating = false;
        return;
    public String getState ()
        if (isEating)
            return "Eating";     // Exit the method
        if (isSleeping)
            return "Sleeping";   // Exit the method
        if (isThinking)
            return "Thinking";
        return "Error in State"; // Exit the method
    } // getState()
    public String toString()
        return name + " is " + getState();
} // CyberPet
* Description: This apply provides a graphical user
*  interface to the CyberPet class. The interface consists
*  of two Buttons that can be clicked to tell the CyberPet
*  to eat or drink, and a TextField which reports the
*  CyberPet's state.
*  The interface is initialized in the init() method and
*  user actions are handled in the actionPerformed() method.
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
//STARTING COMMENT LINE ENCLOSING CLASS
public class CyberPetApplet extends Applet implements ActionListener
   // Declare instance variables
   private CyberPet pet1;                   // The CyberPet
   private Label nameLabel;                 // A Label
   private TextField stateField;            // A TextField
   private TextField petNameField;
   private Button eatButton, sleepButton, thinkButton;   // Two Buttons
    //* The init() method instantiates the instance variables, including both the
    //* CyberPet (pet1) and the GUI elements that are displayed on the applet.
    public void init()
       petNameField = new TextField(20);
       petNameField.setText((" "));
       petNameField.addActionListener(this);
       petNameField.setEditable(true);
       pet1 = new CyberPet(petNameField.getText());   // CyberPet
        // Create the GUI components
       nameLabel = new Label("Hi! My name is " + pet1.getName() +
                              " and currently I am : "); 
       stateField = new TextField(12);
       eatButton = new Button("Eat!");     // Buttons
       eatButton.addActionListener(this);  // Assign the listener for Eat
       sleepButton = new Button("Sleep!");
       sleepButton.addActionListener(this);
       thinkButton = new Button ("Think!");
       thinkButton.addActionListener(this);
        // Initialize the TextField
      stateField.setText(pet1.getState());
      stateField.setEditable(false);
        // Add the components to the applet.
      add(nameLabel);
      add(stateField);
      add(petNameField);
      add(eatButton);
      add(sleepButton);
      add(thinkButton);
      setSize(300,150);          // Set the applet's size to 300 x 150 pixels
    } // init
     * The actionPerformed() method is called whenever
     * one of the buttons is pressed.
    public void actionPerformed( ActionEvent e)
        if (e.getSource() == eatButton)
            pet1.eat();
        else if (e.getSource() == sleepButton)
            pet1.sleep();
        else if (e.getSource() == thinkButton)
            pet1.think();
        stateField.setText(pet1.getState());
    }//actionPerformed
//ENDING COMMENT LINE ENCLOSING CLASS*/is there a way to make it auto refresh or to pause untill a name is entered into that 2nd text box
any help would be great
Thanks,
Tom

I'm still not sure if I understand your initial question.
// Here's an example of adding an action listener
nameTextField.addActionListener(
   new ActionListener() {
      public void actionPerformed(ActionEvent e) {
         // Code goes here
         // if nameTextField is validated then ...
);

Similar Messages

  • HT203254 how to make whats on my computer show on my t.v.

    how to make whats on my computer show on my t.v.

    I'm presuming that you've already made the connection with a suitable cable.  What are you getting on the TV?  Are you getting a completely blank screen?  Are you getting a message similar to 'no input detected'? Or are you getting the spiral galaxy desktop?
    If the last of these then what you have is an extended desktop.  If you move the mouse cursor off the edge of the MBP's screen you will see it appear on the TV.  Similarly you can drag windows from the MBP's screen to the TV.  At present the MBP's screen is the primary display and shows the menu bar and dock, and the TV is the secondary display.  To change this go into System Preferences -> Displays -> Arrangement.  You will see an image of two screens, a smaller one representing the MBP's display and a larger one representing the external display.  At the top of the smaller screen in the image is a bar, this represents the menu bar at the top of the screen.  Drag it from the smaller screen to the larger screen.  The external display will become the primary display and the menu bar and dock will appear there and any new windows or applications that you open subsequently will appear there too.
    silvergc's suggestion to use mirroring will work, but you won't be using the native resolution of the TV which could result in fuzziness or bluriness of the image on the TV.

  • How to make products AVL in marketing planner display only?

    Hi,
    Does anybody know how to make products tab or more specifically produts table display only?
    I've tried using Define Field Selection for Campaigns in IMG, but that doesn't work for products table.
    Thanks,
    Michael

    FYI - I'm moving this message to the "CRM - General & Framework Forum" where technical questions such as these are more likely to get answered/searched.
    The Marketing forum is intended for marketing process-related queries.
    Warm Regards,
    Anik Roy
    Moderator

  • How to make a field editable again after displaying error msg (validation)

    Dear All,
    In dialog programming, I have written a validation on a text field that it should not be left blank by the user, but after displaying the message the field becomes gray (non-editable). How can I make it editable once again after displaying the error message.
    My code is as following:
    ***INCLUDE MZFBPS1_SAVE_DATAF01 .
    *&      Form  save_data
          text
    -->  p1        text
    <--  p2        text
    FORM save_data .
    ****************Check For Empty Fields Start
    if ZFBPS_GATE_IN-truck_code is INITIAL
    or ZFBPS_GATE_IN-truck_no is INITIAL
    or ZFBPS_GATE_IN-transporter_code is INITIAL.
    MESSAGE e020(zmatlist).
    endif.
    ****************Check For Empty Fields Start
    Regards,
    Alok.

    hi,
    u can do it in chanin end chain.
    For example if there are 10 fields in the screen and for 5 fields whenever the user enters wrong values u like to give some error message. You can declare that fields in the chain enchain so that only those fields will be input enabled and all other fields will disabled.
    CHAIN.
    FIELD chk_connobj.
    FIELD chk_inst.
    FIELD chk_devloc.
    FIELD ehaud-haus.
    FIELD eanl-anlage.
    MODULE modify_screenfields.
    ENDCHAIN.
    *& Module modify_screenfields INPUT
    * text
    MODULE modify_screenfields INPUT.
    CLEAR okcode.
    okcode = sy-ucomm.
    CASE okcode.
    WHEN 'ENTER' OR 'EXECUTE'.
    IF chk_connobj IS INITIAL AND chk_inst EQ c_x AND
    chk_devloc EQ c_x.      -----------> ur condition
    IF ehaud-haus IS INITIAL.
    SET CURSOR FIELD 'EHAUD-HAUS'.
    MESSAGE e000(zo_spa) WITH text-017. " message obj
    ELSE
    loop at screen.
    if screen-name = 'FIELD_NAME'.
    field-name-input = 1. -----------> chnges to non-edit mod
    modify screen.
    endloop.
    ENDIF.
    ENDIF.
    ENDMODULE.
    Rgds
    Anver
    if hlped pls mark points

  • How to make a T-code to be displayed after starting SAP

    Hi all, plz let me know how to make our own t-code to be displayed after starting SAP screen.

    Hi,
    It is shown at the bottom right corner of your screen.
    Regards,
    Atish

  • How to make the commitment item field as display in PR and PO

    Hi,
    Our user want the 'Commitment Item' filed should only be diplayed while making PR and PO. Please suggest what to do.
    Shall, I make the field surpass for that FSG and it will show as surpass in all the enjoy transactions or there is something else I should do..
    Thanks in advance
    Regards
    Nitin

    Thanks for your reply ELI!!!
    Actually, users are changing the commitment items and that's why finance people are facing the problems so they have requested to mark the Commitment item field in a display mode.
    Please telll me the t. code or the path where to do this as I am not an MM consultant and he has left recently I have been asked to do it.
    Thanks in advance...
    Regards
    Nitin

  • How to make a report in RME to display all POE capable devices

    Hello,
    I need to create a report that will list switches in my network that support POE. Most of our switches are 3750 stack and I know most of them have POE capabilities but whenever I generate the report under RME POE Port Level Report or POE Report it gives me an error that says none of the devices are POE capabled/enabled.
    Does anyone know how to generate this kind of report? I tried making a template but I still couldn't produce the result that I need.
    Thanks in advance.

    HI ,
    CSCsx15486            Bug Details
    RME cannot create Inventory PoE Report for certain switches
    Currently, RME is only able to create PoE Inventory reports for Cat3750 and 3560 switches:
    WS-C3560-24PS - 1.3.6.1.4.1.9.1.563
    WS-C3560-48PS - 1.3.6.1.4.1.9.1.564
    WS-C3560G-24PS - 1.3.6.1.4.1.9.1.614
    WS-C3560G-48PS - 1.3.6.1.4.1.9.1.616
    WS-C3750E-24PD - 1.3.6.1.4.1.9.1.792
    WS-C3750E-48PD - 1.3.6.1.4.1.9.1.791
    WS-C3560E-24PD - 1.3.6.1.4.1.9.1.795
    WS-C3560E-48PD - 1.3.6.1.4.1.9.1.796
    It does not work for other switches.
    Even the 3750G switches are not currently supported. The sysObjectID is:
    .1.3.6.1.4.1.9.1.516
    Thanks--
    Afroj

  • How to make the pricing condition to be displayed in print

    Hi all,
    Please let me know how to print the pricing element in the print of the purchase orders
    Thanks in Advance
    Kumar

    Hi
    For this you have to mark "X" for the print field of the specific condition type in the pricing procedure.
    warm regards
    sairam

  • How to make computer run in closed clamshell (display closed) mode without having an external display

    i want to listen song closing my display how to do it any idea???????????

    You can run a MacBook Pro with its display closed with the aid of any of several third-party hacks that prevent sleep, InsomniaX being one. If you put your closed and still-running Mac into a padded sleeve, backpack or carrying case that prevents it from ventilating itself, it will overheat and cook itself and/or cause a fire. Therefore, I strongly recommend against using any of the anti-sleep hacks, and if you do so, you do it at your own risk.
    A MBP is not an iPod. If you want an iPod, get an iPod.

  • How to make the CRM activity and task display in Portal UWL task iview ?

    Hello experts,
    I want that activity ,task and document in CRM inbox(t-code:sbwp) can be display in UWL task iview, and can pop-up to deal with when be clicked .
    The workflow type item in ERP can be display and open to deal with by default.
    But I need to the same function of CRM inbox content.
    I had done some configuration according to "Configuring the Business
    Package for SAP CRM 5.0 SP01.pdf".
    But it can't realized my requirement.
    How to do it ?
    BR,
    Jianguo Chen

    Go to View .. Bars... and enable the bar for Level of Effort activities. If it's not there, create one.

  • How to make a robot roam and simultaneously display its coordinate using other vi

    Hi i am using Cricket to find the coordinates of moving robot as my receiver is attached to the robot.I made a vi which can extract the exact coordinates using my CRICKET sensor data.How to move a robot and simultaneously display its coordinates.In turn moving the robot usin roaming Vi as well as same time my VI display its coordinate.

    Hi,
    Is this an NXT robot and are you deploying your code on the robot?  Are you running the robot from a VI on you PC using blue tooth, etc... ?
    If you are running both VI's in LabVIEW you can use parallel loops.  If they have to communicate with each other, then you have to decide which approach to use with parallel loop communication.  Like simple variables or more complex choices like queue, etc...
    Can you provide more information about your system and version of LabVIEW?
    Mark Ramsdale

  • How I make the Web Browser Control to display a PDF in Windows 8

    I have an application that run ok in previous version of windows,  Where I can load a PDF file and the web browser control automatically use the Reader OCX of Adobe,, After Install windows 8 and download the reader for windows 8 still get and (X) where the document should be displayed.  I use the following command in my program to force the windows 8 to use the same web browser (10) in my web browser control.
    WebBrowser1.Navigate(DocumentName,"",Nothing,"User-Agent:Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)")
    But still get an  (X). IF I use the URL that is in the property of the (X) and paste in my regular IE10, it open the PDF file.

    Adobe Reader Touch is a Windows Store app and does not install a browser add-on/plug-in for "in-browser" PDF viewing.
    You can either
    Install Adobe Reader XI (desktop app) which installs browser plug-ins for Microsoft IE and Mozilla Firefox
    Use Google Chrome, which has a built-in PDF viewer (enabled by default)

  • How to make format for macBook pro retina display 13 inch Yosemite

    Hi ,
    I want to format and erase everything in my mac because I want to sell it.
    - MacBook Pro Retina Display 13 inch
    - OS X Yosemite
    thanks

    Click here and follow the instructions.
    (122411)

  • How to make fields editable in an custom enhancement

    Hi Experts,
    My requirement is to perform some custom validations against a field FKONT(BSEG) at the line item level of FB60 and display appropriate message and make the incorrect field editable.
    I have implemented an implicit enhancement point in include MF05AFGENJ.
    The error messages are coming but I am unable to make the GL account, cost center and profit center fields editable.
    Please let me know how to make the above fields editable after displaying the error message.
    For reference, I have done the coding like this:
    IF sy-tcode = 'FB60' .
    CHECK GL_ITEMS IS NOT INITIAL.
    DATA: L_COUNT TYPE I,
          L_STRING TYPE STRING,
          L_FKONT TYPE FIPLS,
          L_TABIX TYPE SY-TABIX,
          G_FLAG TYPE C.
    DATA: WA_ZZFSTP LIKE ZZFSTP.          "Work area for ZZFSTP table
    CONSTANTS:C_MK TYPE TXJCD VALUE 'MK0000000'.
    *-- Validating the Financial budget item field
    IF GL_ITEMS-FKONT IS NOT INITIAL.
    SELECT SINGLE FKONT
                        INTO L_FKONT
                        FROM ZFSTP
                        WHERE FKONT = GL_ITEMS-FKONT.  "cost center
    IF SY-SUBRC NE 0.
       CLEAR: G_FLAG.
       G_FLAG = 'X'.
       MESSAGE W003(ZZFI) WITH 'Please enter 'Financial' 'Budget Item Field' DISPLAY LIKE 'E'.
       EXIT.
    ENDIF.
    *-- Copying the first line item financial budget item field to all the line items in the internal table
    DESCRIBE TABLE GL_ITEMS LINES L_COUNT.
    IF L_COUNT > 1.
      READ TABLE GL_ITEMS INDEX 1.
      IF SY-SUBRC = 0.
            CLEAR: L_FKONT.
            L_FKONT = GL_ITEMS-FKONT.
    *-- Assign the tax jurisdiction codes in all the line items
             LOOP AT GL_ITEMS.
               CLEAR: L_TABIX.
               L_TABIX = SY-TABIX.
               GL_ITEMS-FKONT = L_FKONT.
               GL_ITEMS-TXJCD = C_MK.
    *-- Copy the first financial budget item number and tax jurisdiction code MK0000000 in all line items
               MODIFY GL_ITEMS INDEX L_TABIX TRANSPORTING FKONT TXJCD.
    *-- Populate tax jurisdiction and FKONT financial budget item number in XBSEG table
               L_TABIX = L_TABIX + 1.  "top record in XBSEG is for header
               READ TABLE XBSEG INDEX L_TABIX.
               IF SY-SUBRC = 0.
                 XBSEG-FKONT = L_FKONT.
                 XBSEG-TXJCD = C_MK.
                 MODIFY XBSEG INDEX L_TABIX.
               ENDIF.
             ENDLOOP.
      ENDIF.
    ENDIF. "describe statement
    CLEAR: WA_ZZSTP.
    *-- Validate the amount and GL account against the FKONT(financial budget item) number
    SELECT SINGLE FKONT
                  ZZWRBTR
                  ZZHKONT
                  ZZKOSTL
                  ZZPRCTR
           INTO CORRESPONDING FIELDS OF WA_ZZFSTP
           FROM ZFSTP
           WHERE FKONT EQ GL_ITEMS-FKONT.
    IF sy-subrc EQ 0.
    IF BSEG-WRBTR > WA_ZZFSTP-ZWRBTR.
           CLEAR: G_FLAG.
           G_FLAG = 'X'.
           MESSAGE W003(ZZFI) WITH 'Amount entered' 'cannot be' 'greater than ' WA_ZFSTP-ZZWRBTR DISPLAY LIKE 'E'.
           EXIT.
    ELSE.
             CLEAR: G_FLAG.
            G_FLAG = 'X'.
            SET CURSOR FIELD 'GL_ITEMS-HKONT'.
            MESSAGE W003(ZZFI) WITH 'Incorrect GL account' 'number entered for' 'given financial' 'budget item number'.
            EXIT.
           ELSE.
    *-- Check for cost center and profit center at line item level
             LOOP AT GL_ITEMS.
    *-- Both cost center and profit center is initial.
                IF GL_ITEMS-KOSTL IS INITIAL AND GL_ITEMS-PRCTR IS INITIAL.
                    CLEAR: G_FLAG.
                    G_FLAG = 'X'.
                    SET CURSOR FIELD 'GL_ITEMS-PRCTR' LINE SY-STEPL.
                    SET CURSOR FIELD 'GL_ITEMS-KOSTL' LINE SY-STEPL.
                    MESSAGE W003(ZZFI) WITH 'Please enter' 'cost center' 'or' 'profit center'.
                    EXIT.
    *-- Either cost center or profit center is initial
                ELSEIF GL_ITEMS-KOSTL IS INITIAL AND GL_ITEMS-PRCTR IS NOT INITIAL.
                    CHECK GL_ITEMS-PRCTR NE WA_ZZFSTP-ZPRCTR.
                      CLEAR: G_FLAG.
                      G_FLAG = 'X'.
                      SET CURSOR FIELD 'GL_ITEMS-PRCTR' LINE SY-STEPL.
                      MESSAGE W003(ZZFI) WITH 'Incorrect profit' 'center entered' 'for given' 'financial budget item' DISPLAY LIKE 'E'.
                      EXIT.
                ELSEIF GL_ITEMS-KOSTL IS NOT INITIAL AND GL_ITEMS-PRCTR IS INITIAL.
                   CHECK GL_ITEMS-KOSTL NE WA_ZFSTP-ZKOSTL.
                      CLEAR: G_FLAG.
                      G_FLAG = 'X'.
                      SET CURSOR FIELD 'GL_ITEMS-KOSTL' LINE SY-STEPL.
                      MESSAGE W003(ZZFI) WITH 'Incorrect cost' 'center entered' 'for given' 'financial budget item' DISPLAY LIKE 'E'.
                      EXIT.
                ENDIF.
             ENDLOOP.
           ENDIF. "GL Account
    ENDIF. "Amount check
    ENDIF. "SY-SUBRC check
    ENDIF.
    EXPORT G_FLAG FROM G_FLAG TO MEMORY ID 'ZER'.
    Please let me know how to make GLaccount,cost center and profit center fields editable.
    Regards,
    Sangeeta.

    Hi.. chaek the below links. may be useful to u.
    Making Table control records Editable / Non-editable
    Table control with both Editable and non Editable fields
    Regards,
    KP.

  • Something keeps trying to download on my mac and I don't know what it is. It is not in the apple store and just comes out nowhere and request for my password to download something and I don't know what it is. How to make this stop?

    Something keeps trying to download on my mac and I don't know what it is. It is not in the apple store and just comes out nowhere and request for my password to download something and I don't know what it is. How to make this stop? It pops up every single day.

    Erica,
         I can, with 99.99% certainty, tell you that you are absolutely right in not wanting to download or install this "Helper," whatever it is (but we can be equally certain it would not "help" anything).
         I cannot comment as to Oglethorpe's recommendation of 'adwaremedic'; I am unfamiliar with it.  His links to the Apple discussion and support pages warrant your time and attention.
         It might be really simple -- Trying looking in your Downloads folder, trash anything that you don't know with certainty is something you want to keep, and then Secure Empty your Trash. Then remove the AdBlock extension, LastPass, and Web of Trust extensions to Safari and re-boot. If the issue goes away, still be extraordinarily careful in the future.
         Unfortunately, it's probably not going to be that simple to get rid of, in which case I'd then try the line by line editing in HT203987. 
         I have no further suggestions (other than a complete wipe and re-install...but that's a pain because trying to restore from Time Machine would simply ... restore the Mal).
       For the rest of us, please post when you find a solution.
         Best.
         BPW
      (Also, try to edit your second post -- black out your last name on the screenshot and re-post it for others)

Maybe you are looking for

  • Error in reciever JDBC Adapater

    I have a select query as SELECT * FROM ULIDTA2.F5631505 where QSINTF ='Y' update query is Update  ULIDTA2.F5631505 set QSINTF='Y' where QSINTF ='N' if there are no rows to update , i am getting a error. wht could be the issue .

  • How can I make my iPad appear on iTunes?

    I've been trying to sync the music from my iTunes to my iPad for ages now, I don't know what else to do... It worked once but the music didn't sync. I've switched off my computer and iPad, I've take out the plug, I don't know what else to do.... Help

  • Target groups and marketting compaigns

    Hello all, I am seeking for information about target groups and campaigns, Where target group ID and compaign ID are stored? Where can I find function modules that returns all bp's belongs to target group, and all target groups belongs to campaing? A

  • Oracle Performance(Talent) Management

    Hi all Can anyone please help me with a documentation link of Oracle Performance(Talent) Management? I am totally new to this module. Thanks in advance

  • View log file via third party tool

    Hi All, Using Oracle EBS 11.5.10.2 Database 10g How can I show the oracle log file through third party tool like Java. PS Edited by: PS on May 28, 2012 9:21 AM