How to display integer in the JtextField?

Dear All
I need your guidance and your advise on the following.
I am creating an applet and I don't know how to display the integer which I have.
Basically, i need to disply the following into a JtextField.
int d1 = (int) (Math.random() * 6) + 1;
int d2 = (int) (Math.random() * 6) + 1;
I have two textfield which i name them textField1 and textField2.
But how can I generate my random value obtained from the above and display it inside the text field?

SummerCool wrote:
Dear All
I need your guidance and your advise on the following.
I am creating an applet and I don't know how to display the integer which I have.
Basically, i need to disply the following into a JtextField.
int d1 = (int) (Math.random() * 6) + 1;
int d2 = (int) (Math.random() * 6) + 1;
I have two textfield which i name them textField1 and textField2.
But how can I generate my random value obtained from the above and display it inside the text field?
textField1 .setText(""+d1);
textField2 .setText(""+d2);

Similar Messages

  • Does anyone know how to display (in LabVIEW) the memory use during execution of an image and data acquisition VI to predict when it is time to cease the acquisition to prevent the program crashing?

    Does anyone know how to display (in LabVIEW) the memory use during execution of an image and data acquisition VI to predict when it is time to cease the acquisition to prevent the program crashing?
    I am acquiring images and data to a buffer on the edge of the while loop, and am finding that the crashing of the program is unpredictable, but almost always due to a memory saturation when the buffers gets too big.
    I have attached the VI.
    Thanks for the help
    Attachments:
    new_control_and_acquisition_program.vi ‏946 KB

    Take a look at this document that discusses how to monitor IMAQ memory usage:
    http://digital.ni.com/public.nsf/websearch/8C6E405861C60DE786256DB400755957
    Hope this helps -
    Julie

  • Does anyone know how to display (in LabVIEW) the memory use during execution of an image and data acquisitio​n VI to predict when it is time to cease the acquisitio​n to prevent the program crashing?

    Does anyone know how to display (in LabVIEW) the memory use during execution of an image and data acquisition VI to predict when it is time to cease the acquisition to prevent the program crashing?
    I am acquiring images and data to a buffer on the edge of the while loop, and am finding that the crashing of the program is unpredictable, but almost always due to a memory saturation when the buffers gets too big.
    I have attached the VI.
    Thanks for the help
    Attachments:
    new_control_and_acquisition_program.vi ‏946 KB

    got these vi's off ni site a while ago - see if they help
    Attachments:
    Memory_Monitor.zip ‏132 KB

  • I'm wondering how to display "bullets" from the bottom to the top (last to first) in a slideshow.  Can anyone help?

    I'm wondering how to display "bullets" from the bottom to the top (last to first) in a slideshow.  Can anyone help?

    Select the set of bullets. Go to the "Build" panel of the Inspector. Choose "Build In". Choose your effect. Select "By Bullet Group" under delivery.
    Be sure to experiment with the various options.

  • How to display and edit the clob datatype column from Data base

    Hi ,
    I have a requiremsnt as below
    1) One Table having some columns with CLOB data type along with varchar columns
    2) need to display the data from DB in search screen and need to be edited clob column in edit screen
    I created EO and VO with that Table and how to display the clob value into the input box for editing.
    using Jdev 11.1.1.5.0 version.
    Can you please help on this.
    THanks & REgards,
    Madhu

    Hi,
    If you are using an inputText component to display a Character Large Object (CLOB), then you will need to create a custom converter that converts the CLOB to a String.
    For custom convertor refer below link,
    http://docs.oracle.com/cd/E2438201/web.1112/e16181/af_validate.htm#BABGIEDH
    (section7.4 Creating Custom JSF Converters)
    Thanks,
    Santosh M E

  • How to display name of the table and the description and the table type

    Hi,
    Can you people tell me how to display the name of the table and the description and the table type (View, structure, etc...) used in the program.
    I want to display in a list.
    Kind Regards

    use this program
    TABLES : TSTC, tstct.
    TABLES : DD03l, DD02l.
    DATA : Program like sy-repid.
    DATA : BEGIN OF I_FINAL OCCURS 0,
    tabname LIKE dd02l-tabname,
    TABCLASS LIKE dd02l-tabCLASS,
    TEXT LIKE DD02T-DDTEXT,
    END OF I_FINAL.
    DATA : BEGIN of ITAB Occurs 0,
    name like dd02l-tabname,
    END OF ITAB.
    DATA : TCD(100) TYPE C.
    DATA : var1 LIKE dd02l-tabname.
    DATA : DESC LIKE TSTCT-TTEXT.
    selection-screen skip.
    SELECTION-SCREEN : BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS : r1 RADIOBUTTON GROUP r DEFAULT 'X'.
    Parameters : Tcode like sy-tcode.
    selection-screen skip.
    PARAMETERS : r2 RADIOBUTTON GROUP r.
    Parameters : Prog like sy-repid.
    SELECTION-SCREEN END OF BLOCK b2.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE text-001.
    select-options : Type for dd02l-tabclass .
    SELECTION-SCREEN END OF BLOCK B1 .
    at selection-screen.
    if r1 = 'X' and Tcode is initial.
    message e001(00) with 'Enter Transaction Code' .
    elseif r2 = 'X' and Prog is initial.
    message e001(00) with 'Enter Program Name' .
    endif.
    START-OF-SELECTION.
    if r1 = 'X'.
    Prog = ' '.
    select single * from TSTC where tcode = tcode.
    if sy-subrc = 0.
    program = TSTC-PGMNA.
    select single TTEXT from tstct into desc where tcode = tcode and SPRSL = 'E'.
    else.
    Write :/ 'Invalid Transaction Code'.
    exit.
    endif.
    elseif r2 = 'X'.
    Tcode = ' '.
    program = Prog.
    endif.
    CALL FUNCTION 'GET_TABLES'
    EXPORTING
    PROGNAME = Program
    TABLES
    TABLES_TAB = itab.
    if itab is initial.
    skip.
    skip.
    skip.
    skip.
    skip.
    WRITE :/40 'No Data Found' color 6 INTENSIFIED OFF.
    ELSE.
    PERFORM : categorize.
    endif.
    END-OF-SELECTION.
    LOOP AT I_FINAL.
    WRITE :/4 I_FINAL-tabname COLOR 2 INTENSIFIED OFF NO-GAP HOTSPOT ON, 35 I_FINAL-TABCLASS COLOR 2 INTENSIFIED OFF NO-GAP,
    50 I_FINAL-TEXT COLOR 2 INTENSIFIED OFF NO-GAP.
    ENDLOOP.
    AT LINE-SELECTION.
    TCD = SY-LISEL.
    var1 = TCD+3(30).
    set parameter id 'DTB' FIELD VAR1.
    call transaction 'SE11' and skip first screen.
    TOP-OF-PAGE.
    WRITE :/45 'TABLE DETAILS RELATED TO THE TRANSACTION CODE' COLOR 7 .
    WRITE :/2 'DATE : ' COLOR 1, SY-DATUM COLOR 1 INTENSIFIED OFF NO-GAP.
    WRITE :/2 'TRANSACTION CODE : ' COLOR 1, Tcode COLOR 1 INTENSIFIED OFF NO-GAP.
    WRITE :/2 'TCODE DESCRIPTION : ' COLOR 1, desc COLOR 1 INTENSIFIED OFF NO-GAP.
    WRITE :/2 'PROGRAM NAME : ' COLOR 1, PROGRAM COLOR 1 INTENSIFIED OFF NO-GAP.
    SKIP 1.
    WRITE :/1(140) SY-ULINE.
    WRITE :/4 'TABLE NAME' COLOR 5 INTENSIFIED OFF NO-GAP,35 'TABLE TYPE' COLOR 5 INTENSIFIED OFF NO-GAP,
    55 'DESCRIPTION' COLOR 5 INTENSIFIED OFF NO-GAP.
    WRITE :/1(140) SY-ULINE.
    *& Form categorize
    text
    --> p1 text
    <-- p2 text
    FORM categorize .
    SELECT dd02ltabname dd02ltabCLASS DD02T~DDTEXT
    FROM dd02l INNER JOIN DD02T ON dd02ltabname = dd02Ttabname
    INTO TABLE I_FINAL
    FOR ALL ENTRIES IN itab
    WHERE DD02L~TABNAME = ITAB-NAME AND TABCLASS IN TYPE AND DDLANGUAGE = 'E'.
    if sy-subrc <> 0.
    skip.
    skip.
    skip.
    skip.
    skip.
    WRITE :/40 'No Data Found' color 6 INTENSIFIED OFF.
    endif.

  • How to display data with the same text and key in the drop down list?

    Hi All,
    Would like so to seek for you advice on the above mention topic. How to display the data with the same text and key using function module 'VRM_SET_VALUES'. From my testing by writing a program, this function module will only show the text and key if both have different data. Please find the coding as below. Is the normal behaviour of this function module? How to overcome this problem? Thanks in advance.
    REPORT ZTESTING.
    TYPE-POOLS: VRM.
    DATA: NAME  TYPE VRM_ID,
          LIST  TYPE VRM_VALUES,
          VALUE LIKE LINE OF LIST,
          c(20) type c.
    *      c = 'select any'.
    data:begin of itab occurs 0,
          kunnr like kna1-kunnr,
          name1 like kna1-name1,
         end of itab.
    data:begin of jtab occurs 0,
          kunnr like kna1-kunnr,
          land1 like kna1-land1,
         end of jtab.
    PARAMETERS: p_list(20) AS LISTBOX VISIBLE LENGTH 20
                              default 'SELECT'.
    AT SELECTION-SCREEN OUTPUT.
    NAME = 'p_list'.
    VALUE-KEY = 'Name'.     "---> Data for key is the same with text
    VALUE-TEXT = 'Name'.    "--> Data for text is the same with key
    APPEND VALUE TO LIST.
    VALUE-KEY = '2'.
    VALUE-TEXT = 'Country'.
    APPEND VALUE TO LIST.
    CALL FUNCTION 'VRM_SET_VALUES' EXPORTING ID = NAME VALUES = LIST.
    start-of-selection.
    select kunnr name1 up to 20 rows from kna1 into table itab.
    select kunnr land1 up to 20 rows from kna1 into table jtab.
    case p_list.
    when '1'.
    loop at itab.
    write:/ itab-kunnr,itab-name1.
    endloop.
    when '2'.
    loop at jtab.
    write:/ jtab-kunnr,jtab-land1.
    endloop.
    endcase.
    <Added code tags>
    Moderator Message: Please use the "code" tags to format your code snippet.
    Edited by: Suhas Saha on Nov 17, 2011 11:19 AM

    shawnTan wrote:
    Hi All,
    >
    > Would like so to seek for you advice on the above mention topic. How to display the data with the same text and key using function module 'VRM_SET_VALUES'. From my testing by writing a program, this function module will only show the text and key if both have different data. Please find the coding as below. Is the normal behaviour of this function module? How to overcome this problem? Thanks in advance.
    >
    >
    REPORT ZTESTING.
    >
    > TYPE-POOLS: VRM.
    >
    > DATA: NAME  TYPE VRM_ID,
    >       LIST  TYPE VRM_VALUES,
    >       VALUE LIKE LINE OF LIST,
    >       c(20) type c.
    >
    > *      c = 'select any'.
    >
    > data:begin of itab occurs 0,
    >       kunnr like kna1-kunnr,
    >       name1 like kna1-name1,
    >      end of itab.
    >
    > data:begin of jtab occurs 0,
    >       kunnr like kna1-kunnr,
    >       land1 like kna1-land1,
    >      end of jtab.
    >
    > PARAMETERS: p_list(20) AS LISTBOX VISIBLE LENGTH 20
    >                           default 'SELECT'.
    >
    > AT SELECTION-SCREEN OUTPUT.
    >
    > NAME = 'p_list'.
    >
    > VALUE-KEY = 'Name'.     "---> Data for key is the same with text
    > VALUE-TEXT = 'Name'.    "--> Data for text is the same with key
    > APPEND VALUE TO LIST.
    >
    > VALUE-KEY = '2'.
    > VALUE-TEXT = 'Country'.
    > APPEND VALUE TO LIST.
    >
    > CALL FUNCTION 'VRM_SET_VALUES' EXPORTING ID = NAME VALUES = LIST.
    >
    > start-of-selection.
    > select kunnr name1 up to 20 rows from kna1 into table itab.
    > select kunnr land1 up to 20 rows from kna1 into table jtab.
    >
    > case p_list.
    > when '1'.
    > loop at itab.
    > write:/ itab-kunnr,itab-name1.
    > endloop.
    >
    > when '2'.
    > loop at jtab.
    > write:/ jtab-kunnr,jtab-land1.
    > endloop.
    > endcase.
    >
    > <Added code tags>
    >
    > Moderator Message: Please use the "code" tags to format your code snippet.
    >
    > Edited by: Suhas Saha on Nov 17, 2011 11:19 AM
    This surely seems to be a bug to me(if not by design),  did you check for any SAP notes? Perhaps a front end trace can help(Note 407743) !
    -Rajesh.

  • How to display Help for the message in our program

    Hi Experts,
    Do any one know how to display the HELP for the Message in our ABAP program? Just like the user click the Long Text button in SE91.Do we have any function modules or Class method to do that? Thanks in advance.
    Joe

    Hi Joe,
    While creating a message class in se93, theres a button (documentation) on the application tool bar. Click on that and you will be lead to a text editor where you can fill in the necessary documentation for the message you have created.

  • How to display image in the smartforms

    Hi All,
    I have image conent in the Binary formate.I want to dispaly that image in the smartforms.
    Please tell me how to display that image in the smartforms dynamically.
    Normally wa uploaded in SE78.And that is used in smartforms.But this is static way.
    I want to display tha images dynamically.
    Please Please
    Thanks,
    Saritha

    Hi,
          The image is in the DB ,right..Its in Binary format..
    See first we want the picture to be get uploaded inside the SAP.It is done by se78..
    If possible we can retrieve the picture outside in a place means we can get tht into sap by using
    Call Transaction 'SE78'.
    Reward if useful ...........

  • How to display rectangles with the following code in a JPanel?

    I am trying to make a bunch of random rectangles appear inside a JPanel on a GUI form. Im not sire how to display the form and panel with random rectangles. I have in my package the MyRectangle class, a blank JForm class called RectGUI and the class for the panel RectGUIPanel. The following code is from my panel and it should create random rectangles okay but how do I display them inside of a Panel on my RectGUI form? Thanks for the assistance.
    //Declare variables
        private int x;
        private int y;
        private int width;
        private int height;
        private Color color;
        Random rand = new Random();
        public class RectanglePanel extends JPanel
            public void displayRectangles()
                // Declare an arraylist of MyRectangles
                ArrayList<MyRectangle> myArray = new ArrayList<MyRectangle>();
                int maxNumber = 300;
               // Declare Frame and Panel
                JFrame frame = new JFrame();
                Container pane = frame.getContentPane();
                RectanglePanel rect = new RectanglePanel();
                // Set Frame attributes
                frame.setSize(700, 500);
                frame.setLocation(100,100);
                frame.setAlwaysOnTop(true);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.setTitle(" Rectangle Program");
                frame.setVisible(true);
                for (int i = 0; i < maxNumber; i++)
                    MyRectangle rec = createRandomRec();
                    myArray.add(rec);
                    rect.repaint();
            public MyRectangle createRandomRec()  
                   x = rand.nextInt();
                   y = rand.nextInt();
                   width = rand.nextInt();
                   height = rand.nextInt();
                   color = new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256));
                   return new MyRectangle(x, y , width, height, color);
        }

    I am trying to make a bunch of random rectangles appear inside a JPanel on a GUI form. Im not sire how to display the form and panel with random rectangles. I have in my package the MyRectangle class, a blank JForm class called RectGUI and the class for the panel RectGUIPanel. The following code is from my panel and it should create random rectangles okay but how do I display them inside of a Panel on my RectGUI form? Thanks for the assistance.
    //Declare variables
        private int x;
        private int y;
        private int width;
        private int height;
        private Color color;
        Random rand = new Random();
        public class RectanglePanel extends JPanel
            public void displayRectangles()
                // Declare an arraylist of MyRectangles
                ArrayList<MyRectangle> myArray = new ArrayList<MyRectangle>();
                int maxNumber = 300;
               // Declare Frame and Panel
                JFrame frame = new JFrame();
                Container pane = frame.getContentPane();
                RectanglePanel rect = new RectanglePanel();
                // Set Frame attributes
                frame.setSize(700, 500);
                frame.setLocation(100,100);
                frame.setAlwaysOnTop(true);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.setTitle(" Rectangle Program");
                frame.setVisible(true);
                for (int i = 0; i < maxNumber; i++)
                    MyRectangle rec = createRandomRec();
                    myArray.add(rec);
                    rect.repaint();
            public MyRectangle createRandomRec()  
                   x = rand.nextInt();
                   y = rand.nextInt();
                   width = rand.nextInt();
                   height = rand.nextInt();
                   color = new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256));
                   return new MyRectangle(x, y , width, height, color);
        }

  • How to display values inside the Pie chart?

    Hi Expert,
    How to display the values inside the Pie chart, instead of Mouse over values. Can u pls help me to do this one.
    Is it possible can we use mentioned below kind of pie charts in Xcelsius 2008.
    Thanks & Regards,
    Tamil
    Edited by: Rajesh Kumar Thoppe on Dec 13, 2010 10:41 AM

    Hi A G,
    Thank You for quick response!!!
    in this Text tab I am able to see below check box only
    1) Chart Title
    2) Sub Title
    3) Legend
    4) Mouse-Over
    Kindly advise me if i am wrong and let me know how to achieve this.
    Note: We have Xcelsius 2008 environment
    Thanks & Regards,
    Tamil
    Edited by: Rajesh Kumar Thoppe on Dec 13, 2010 1:58 PM

  • While hiring, how to display subtype to the employees

    Hi,
    can any one help me out.....
    how to display the subtype 002 (temporary addresses )  to the infotype 0006 while hiring employees?
    Thanks & Regards
    Padmasree

    Hi,
    You might have defined your action type (Table T529A)). For that action, you might have defined an infogroup. Go to that infogroup (Table V_T588D) and select your User group. For example, if your Infogroup is 10 and User group is 01, entry should be in the following manner:
    User Group              No            Operation   Infotype                   Infotype Text    Subtype
    01                 03     INS     0006            Addresses           002
    This should work.
    Regards,
    Suhasini

  • How to display attributes in the query

    Hi frnds,
    I want to show the attributes of material ( mat group , mat type ), vendor ( Sort field ) in the report.
    We loaded master data for material and vendor.
    I dragged the char and the relevant attributes in the query designer and executed the query. But in the output the attributes values are not displayed.
    What could the reason ?
    Regards,
    V N.

    Hi all,
    Thanks for the reply.
    "Display attributes will also get displayed if you include the infoobject for which they are attributes."
    Suppose for 0vendor the attr is 0sortl. By defualt it is display attr. I dragged in the query the 0vendor and its attr 0sortl  and executed. It didnot displayed any values for this 0sortl
    I changed it to Nav Attr. And rerun the query, it is displaying values.
    In the first case i included Display attr and the infoobject for which it is attr in the query. Please explain me why it didnot displayed the values.
    And after changing it to Nav attr it displayed the values.
    Please explain me what happened actually.
    Regards,
    V N.

  • How to display name of the employees start with any letter?

    Hi Developer,
    Please guide me in solving the issues, that i need to display names of the employee starting with any letter.
    example:
    if i provide name of the employee starting letter 'A' it should display only those name in the database table with starting letter.
    parameters:  a*
    it should display name with starting letter a.
    example:
    abdi
    akbar
    akash
    akilesh
    thanks,
    ravi.

    Hi Ravinder,
    You can use Ranges for this purpose:
    RANGES: r_name FOR type_name.
    r_name-sign = 'I'.
    r_name-option = 'CP'.
    r_name-low = 'a*'.
    INSERT r_name.
    SELECT name FROM table_name INTO TABLE it_name WHERE name IN r_name.
    Regards.

  • How to display message in the alert box

    hi every  one,
    i am inserting some data into the fields and selecting the button to insert.
    but it is inserting even fields are empty..
    i want to display "so and so field is empty.. please enter"
    it should display  a box and return if u press ok.
    how to do this

    Hi,
    I think this code will help you.
    public void onActionAddressSelected(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionAddressSelected(ServerEvent)
              String dialogText = "Would you like to fetch this EmaiId ?";
             IWDConfirmationDialog dialog = wdThis.wdGetLoginController().wdGetAPI().getWindowManager().createConfirmationWindow(dialogText,wdThis.wdGetAPI().getViewInfo().getViewController().findInEventHandlers("Yes"),"Yes");
              dialog.addChoice(wdThis.wdGetAPI().getViewInfo().getViewController().findInEventHandlers("Cancel"),"Cancel");
              //dialog.addChoice(eventHandler,"OK");
              dialog.setWindowPosition(WDWindowPos.CENTER);
              dialog.open();
              //wdThis.wdGetLoginComponentController().fireAddressSelectedEvent();
        //@@end
    Regards,
    Karthick

Maybe you are looking for

  • How can I get a list of all items (clips/stills) I've used in a project?

    I am creating a sequence that contains lots of items (both short clips and stills) and it's getting difficult to remember if I've already used an item already. Is there a way to get a list of items I've already used or to mark an item once I've used

  • Can I use the SDK on a PC to develop applications for the iPad, iPhone, etc

    I was thinking about paying the $99 a year to join the developer program because I want to download the SDK and try creating applications for the iPhone and iPad; however, can you download the SDK and use it on a PC or does it require that you have a

  • Embedding audio

    I have a cd, I need to post some audio clips on a website. Probably 3 or 4 separate ones. I would like to have it play on the page, not open in a separate window. Not when the page OPENS, but have a player that is built into the page..click on the pl

  • AIR Application Launching problem

    Hi All, I created one AIR application using Flash CS3. The air file size is 350+ MB. This air file included swf and flvs. I installed successfully but the problem is when i try to launch the application It takes time. How can i solve this? Any one he

  • Extraction Issue

    Hi All I have activated the HR Cube - 0PAPD_C02 ( Appraisal) . All the master data was loaded. For the relevant datasource 0HR_PA_PD_2 in RSA3  - 358 records were selected. Yet when the infopackage was scheduled no data was loaded ? error message was