Creating a Simple Number Field

I want to basically create a JTextField only instead of text, numbers including decimals. I tried putting number into a text field but java won't see them as double. I tried the tutorial example with a formatted text field, however, they explain abstract and listeners for validating which I could care less about. I also tried the following code from the tutorial which doesn't work.
JFormattedTextField ftf = new JFormattedTextField();
ftf.setValue(new Number(100));
The compiler says Number cannot be instantiated as it is abstract. How can the tutorial do it? I have had the same problem with other examples in the tutorial such as the Border examples for creating compound borders. The examples don't work because the compiler says Border is not instantiable. It is frustrating. Any help with a simple number field for setting and getting the int or double values as numbers. Thanks.

Read this section from the Swing tutorial. It does exactly what you want and provides code as well:
http://java.sun.com/docs/books/tutorial/uiswing/components/textfield.html

Similar Messages

  • Simple Number Counter

    Hi,
    I'm a newbie and looking to create a simple number counter (ie dates from 1900 to 2007 ticking over).
    It's to be used on a history peice showing the progress of a company.
    Doesn't need to be any special effects, just increasing numbers.
    Cheers!

    Welcome to the discussions. Search is your friend:
    http://discussions.apple.com/search.jspa?objID=f656&search=Go&q=counter
    Patrick

  • Phone number field

    I am trying to create a phone number field that will automatically create the dashes as they are typing in the numbers. For example: i type 222 and a dash follows after the last 2 automatically. I know about the regular expression validation you can set, but it is a little complicated for the end user.

    Add the JavaScript to the HTML Header field of the Page definition.
    Then add the following to the HTML Form Element Attributes of your field:
    onclick="javascript:getIt(this)"However, be aware that the Javascript function in the example expects a particular document structure - it is not written generically so you will have to spend some time updating the example OR find another one.

  • How to create a validation on number field.

    Hello Experts,
    My database table has a numeric column EMP_ID. I want to create a validation so that a user can only enter numeric value in this field on the Apex page.
    I have tried to create validation Item/Column specified is numeric for item P2_EMP_ID.
    But when I submit the page, I still get the error ORA-01722: invalid number.
    How can I create a validation so that the ORA error is hidden from the end user and instead a custom message is displayed.
    Thanks,
    Rahul

    Rah,
    Are you on 4.0? This functionality already exists inside of apex. In fact, thats the only difference between the number field and the textfield. Once you create a "Number Field" it automatically creates a numerical validation (but you have no access to it). Likewise for setting the "Require Value" setting on a textfield; the creation of a NOT NULL validation that you can not directly manipulate.
    If you are not on 3.2 maybe you can use javascript to restrict the user from entering anything but numerical inputs.
    Alternatively, (not sure of 3.2 support) you can install the MASKED INPUT PLUGIN, and make the mask "?9999999999999" (everything after ? is optional and 9 means only numerical)

  • Making PAN Number Field MANDATORY while creating a Vendor

    Dear Experts,
    I want to create a Vendor Master with PAN Number Field Mandatory.
    Is there any input for making PAN Number Field Mandatory at the time of creating a vendor.
    Regards - Manjunath

    Hi Trivedi,
    I tried the user exit. But it is pulling the values.
    Please find the coding here
    IF j_1imocust-j_1ipanno = ' '.
      MESSAGE e007(zmsg).
    ENDIF.
    We are not abe get the PAN vanue in  j_1ipanno  field.
    Looking for your help .
    Pleas guide.

  • Making PAN Number Field MANDATORY in Vendor Master while CREATING VENDOR

    Dear Experts,
    I want to create a Vendor Master with PAN Number Field Mandatory.
    Is there any input for making PAN Number Field Mandatory at the time of creating a vendor.
    Regards - Manjunath

    Please post in the right forum >

  • Add Prodcution order number field on the Create/ maintain inspection lot

    Hello,
    Can some one please guide me how to add production order  number field on the QA01/02/ and 03 transaction codes?
    Thank you!
    Khan

    What are you trying to do exactly?
    The production order number only becomes available in QA01 when you select 04 as the inspection type you are creating.  You can't populate this field using any other inspection types. 
    When using QA02 or QA03 you can use the drop down match codes to search for an inspection and I beleive you can use the production order number in one of the match code screens to select a lot.
    Craig

  • How to create a simple idoc in practice? can you provide an example?

    how to create a simple idoc in practice? can you provide an example with full source code?

    Try with the follwoing steps
    Sending System(Outbound ALE Process)
    Tcode SALE „³ for
    a) Define Logical System
    b) Assign Client to Logical System
    Tcode SM59-RFC Destination
    Tcode BD64 ¡V Create Model View
    Tcode BD82 ¡V Generate partner Profiles & Create Ports
    Tcode BD64 ¡V Distribute the Model view
    This is Receiving system Settings
    Receiving System(Inbound ALE )
    Tcode SALE „³ for
    a) Define Logical System
    b) Assign Client to Logical System
    Tcode SM59-RFC Destination
    Tcode BD64 ¡V Check for Model view whether it has distributed or not
    Tcode BD82 -- Generate partner Profiles & Create Ports
    Tcode BD11 Getting Material Data
    Tcode WE05 ¡V Idoc List for inbound status codes
    Message Type MATMAS
    Tcode BD10 ¡V Send Material Data
    Tcode WE05 ¡V Idoc List for watching any Errors
    1)a Goto Tcode SALE
    Click on Sending & Receiving Systems-->Select Logical Systems
    Here Define Logical Systems---> Click on Execute Button
    go for new entries
    1) System Name : ERP000
    Description : Sending System
    2) System Name : ERP800
    Description : Receiving System
    press Enter & Save
    it will ask Request
    if you want new request create new Request orpress continue for transfering the objects
    B) goto Tcode SALE
    Select Assign Client to Logical Systems-->Execute
    000--> Double click on this
    Give the following Information
    Client : ERP 000
    City :
    Logical System
    Currency
    Client role
    Save this Data
    Step 2) For RFC Creation
    Goto Tcode SM59-->Select R/3 Connects
    Click on Create Button
    RFC Destination Name should be same as partner's logical system name and case sensitive to create the ports automatically while generating the partner profiles
    give the information for required fields
    RFC Destination : ERP800
    Connection type: 3
    Description
    Target Host : ERP000
    System No:000
    lan : EN
    Client : 800
    User : Login User Name
    Password:
    save this & Test it & RemortLogin
    3)
    Goto Tcode BD64 -- click on Change mode button
    click on create moduleview
    short text : xxxxxxxxxxxxxx
    Technical Neme : MODEL_ALV
    save this & Press ok
    select your just created modelview Name :'MODEL_ALV'.
    goto add message type
    Model Name : MODEL_ALV
    sender : ERP000
    Receiver : ERP800
    Message type :MATMAS
    save & Press Enter
    4) Goto Tcode BD82
    Give Model View : MODEL_ALV
    Partner system : ERP800
    execute this by press F8 Button
    it will gives you sending system port No :A000000015(Like)
    5) Goto Tcode BD64
    seelct the modelview
    goto >edit>modelview-->distribute
    press ok & Press enter
    6)goto Tcode : BD10 for Material sending
    Material : mat_001
    Message Type : MATMAS
    Logical System : ERP800
    and Execute
    7)goto Tcode : BD11 for Material Receiving
    Material : mat_001
    Message Type : MATMAS
    and Execute --> 1 request idoc created for message type Matmas
    press enter
    Thanks & regards
    Sreenivas
    Here Master Idoc set for Messge type MATMAS-->press Enter
    1 Communication Idoc generated for Message Type
    this is your IDOC
    Take a look at this guide.
    http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc
    http://www.allsaplinks.com/idoc_sample.html
    http://www.sappoint.com/abap/ale.pdf
    http://www.sappoint.com/abap/ale2.pdf
    http://www.sapgenie.com/ale/configuration.htm
    http://www.sappoint.com/abap/ale.pdf
    http://www.sappoint.com/abap/ale2.pdf
    http://www.sapdevelopment.co.uk/training
    http://www.sappro.com/downloads/OneClientDistribution.pdf
    http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc
    Create The Extension Segment
    Transaction: WE31
    The first step in extending an IDoc is to create the new segments that will go into that IDoc. There are some rules that you need to follow when creating the segments:
    - The name of each segment type must start with ‘Z1’
    - For each field in the segment you need to define a field name and a
    data element.
    - The data element for the segment structure must be of data type ‘CHAR’.
    How to create new segments:
    Run the segment maintenance transaction WE31.
    Type your new segment name, and click on Create.
    Define the fields of your segment:
    Field name
    Data Element for the field (from the ABAP dictionary).
    Do not change the Export length!
    Save the segment
    Run Segment -->Check to check the segment for consistency.
    Release the segment for transport. Select Edit -->Set Release. Note that the “Release’ column now has a check mark.
    Create the Extension IDoc Type
    Transaction: WE30
    After you create the segments to be added to the extension type, you can create the extension type itself. Execute transaction WE30, enter the extension name, select Extension type, and click Create. You now have three options:
    Create new type: Does not refer to other extension types
    Create copy: Copies info from an extension type that already exists
    Create successor: Extends an extension type from a previous release
    of R/3. You can only have one version of an extension type for
    each release.
    Enter the Basic IDoc type that this extension type will extend.
    The screen now shows the structure of the IDoc type you used as
    a reference.
    Position the cursor on one of the segments and click Create. This will insert an extension segment as a child of the selected segment.
    NOTE: A segment cannot appear more than once in an IDoc type! You must control the use of duplicate segments with the segment attributes (the next screen).
    The segment attribute screen appears. Enter the information and save.
    Extension segments should not be mandatory (for future upgrades), and will need to have minimum and maximum number of instances defined. This answers the question, “for each instance of the parent segment, how many instances of the child segment may we have?”
    You can press the Segment Editor pushbutton to view or change the segment definition.
    Create the new Message Type
    You can only use an extension IDoc type by assigning it to a message type. You can create a new message type for this.
    First the message type itself needs to be created.
    Transaction: WE81
    Create a new entry and save. Use SAP established customer naming conventions (good form is to start with a Z and retain the rest of the related SAP message type, so, for example, MATMAS becomes ZMATMAS).
    After creating the message type, associate it with the corresponding Basic IDoc Type and Extension Type. This relationship is used when IDocs are sent to or received from a partner to determine what segments are valid and what the hierarchy for those segments is.
    Transaction: WE82
    Create a new entry and enter the Message type, Basic IDoc type, Extension type, and Release, and save your data. Note: the release assignment is not valid for prior SAP releases.
    One message type can be associated with many basic IDoc types; however, you need a one-to-one relationship for distribution via ALE.
    regards,
    srinivas
    *reward for useful answers*</b>

  • Creating a simple mail form

    Hi,
    I want to create a simple mail form using portal. The form must not use the HTML "mailto:", cause this requires a mail client to be installed at the customers computer. So I want to use the UTL_SMTP package. I managed to send mails with this package, but the problem is: how do I build my form with lets say 3 fields, so that i can pass the entered values to the SendMail-Funtion? I tried to create a form based on a table, then add new items and delete the table-based-items, but that doesnt work. I cant access the not table-based-items and found the reasons for that in the forums here. Then I tried to do it with a dynamic page, but I didnt succeed in calling my send-mail-function from the dynamic page. How can I do it?
    Bye,
    Pascal
    null

    Pascal,
    You can use something like this:
    Create two tables:
    1) Table1
    (id NUMBER PRIMARY KEY, sender varchar2(100),
    recipient varchar2(100) ,message varchar2(3000) ,subject varchar2(200))
    2) Table2
    (id NUMBER , sender varchar2(100),
    recipient varchar2(100) ,message varchar2(3000) ,subject varchar2(200))
    Here Table2 & Table1 are identical. You can use only one table if you do not want to maintain the history of the mails sent.
    Base your form on "Table1".
    Now pass whatever values you want to pass you can base it through this form to the table1(I mean INSERT).
    Calling utl_smtp directly from here won't be a good idea because your form will hang unless the mail is sent.
    So create a procedure for sending mails:
    it should be something like this:
    create or replace procedure send_email (sender IN varchar2, recipient IN varchar2,
    message IN varchar2, subject IN varchar2)
    is
    mailhost varchar2(30) := 'your mail host';
    mail_conn utl_smtp.connection;
    Vhelo utl_smtp.reply;
    Vvrfy utl_smtp.reply;
    Vmail utl_smtp.reply;
    Vrcpt utl_smtp.reply;
    Vdata utl_smtp.reply;
    Vquit utl_smtp.reply;
    Vtemp number;
    VMsg varchar2(4000);
    begin
    VMsg := 'Subject:'&#0124; &#0124;subject&#0124; &#0124;chr(10)&#0124; &#0124;message;
    mail_conn := utl_smtp.open_connection(mailhost,25);
    Vhelo := utl_smtp.helo(mail_conn, mailhost);
    Vvrfy := utl_smtp.vrfy(mail_conn, recipient);
    Vmail := utl_smtp.mail(mail_conn, sender);
    Vrcpt := utl_smtp.rcpt(mail_conn, recipient);
    vdata := utl_smtp.data(mail_conn, VMsg);
    Vquit := utl_smtp.quit(mail_conn);
    -- Handle the error
    end;
    create or replace procedure call_send_email
    cursor Cur1 is
    select * from table1;
    is
    for vcur1 in cur1
    loop
    send_email(vcur1.sender, cur1.recipient, vcur1.message, vcur1.subject);
    insert into table2 values(vcur1.id,vcur1.sender, vcur.recipient,
    vcur1.message, vcur1.subject);
    delete from table1 where id = vcur1.id;
    End Loop;
    commit;
    exception
    --handle exception
    end;
    now call this procedure (call_send_mail) from dbms_job
    Hope this helps,
    Chetan.

  • Basic help with Flash v10 (creating a simple calculator)

    I have Adobe CS4 Pro with Flash v10.  I'm trying to create a simple, basic calculator that adds 2 numbers.  I followed the tutorial at http://layersmagazine.com/flash-design-calculator.html.  At first, I was unable to assign variables to any objects, but got that cleared up by selecting ActionScript 2.0 (was set to 3.0).  At this point, the calculator accepts the two numbers, but when I select the "add" button with the associated code as shown in the tutorial, nothing happens.  Does anyone have a suggestion as to what I might be doing wrong?  Thanks.

    This is all the code there is:
    on(release) {
    total = Number(firstnumber)+Number(secondnumber);
    There's really not an error--I just don't get any output.  I've created two 'Input Text' boxes, and on the properties tab for each I have defined the "Variable:" field as either 'Number(firstnumber)' or 'Number(secondnumber)'.  I've also created a 'Dynamic Text' box and defined the "Variable:" field as 'Number(total)'.
    Note:  the example I was following did not specify to include the 'Number()' function in the "Variable:" fields.  However, when I don't, and I run 'Test Movie', the 3 boxes are automatically filled with "_level0.firstnumber", "_level0.secondnumber" and "_level0.total".  When I type 2 numbers in to the 2 'Input Text' boxes, and then select my button that has the above code associated with it, I get "NaN" in the output ('Dynamic Text') box.
    Thanks again for your help!

  • Dynamically Update a number field by summing of page item values.

    Hi,
    I'm trying to update a number field on an apex page by summing up the values of multiple page items. I've tried to follow this tutorial http://st-curriculum.oracle.com/obe/db/apex/r40/apexdynactions/apexdynactions_ll.htm , especially the "Create a Set Value Dynamic Action Using PL/SQL" part.
    In the tutorial example they return an page item value P3_SAL multiplied by a multiplier they've determined by another page item's case. What I want to do is much simpler in that I just want to add up multiple page item values and then display them in a number field at the bottom of the page.
    so the code I tried to use based on the tutorial is in the tab: Home >Application Builder>Application 103>Page 3>Edit Dynamic Action>Create / Edit Action
    Set Type: PL/SQL Function Body
    PL/SQL Function Body:
    BEGIN
    return :P3_ITEM1+P3_ITEM2+P3_ITEM3;
    END;
    Page Items to Submit: P3_ITEM1,P3_ITEM2,P3_ITEM3
    But it gives me an error that I need to declare the identifiers, yet it works if I only use one item and I can perform any arithmetic.
    ie.
    BEGIN
    return :P3_ITEM1+1000;
    END;
    Any help would be appreciated.

    PL/SQL Function Body:
    BEGIN
    return :P3_ITEM1+P3_ITEM2+P3_ITEM3;
    END;
    Page Items to Submit: P3_ITEM1,P3_ITEM2,P3_ITEM3
    But it gives me an error that I need to declare the identifiers, yet it works if I only use one item and I can perform any arithmetic.In your code is missing the ":" for the items P3_ITEM2 and P3_ITEM3.
    Try this:
    BEGIN
    return :P3_ITEM1+:P3_ITEM2+:P3_ITEM3;
    END;

  • Error while creating a simple trigger in Oracle8i Lite

    Hi,
    I have Oracle8i Lite release 4.0.
    I want to create a simple trigger on 8i Lite.
    first I created .java file and got the .class file after successful compilation.
    The .class file is sitting in my local C:\ drive.
    I have a table having only two columns in 8i Lite and the structure is
    TABLE : SP
    ACC_NO NUMBER,
    ACC_DESC VARCHAR2(20)
    Then I issued the command :
    SQL> ALTER TABLE SP ATTACH JAVA SOURCE "JournalInst" in '.';
    After that getting the following error :
    alter table sp attach java source "JournalInst" in '.'
    ERROR at line 1:
    OCA-30021: error preparing/executing SQL statement
    [POL-8028] error in calling a java method
    Following is the cause/action for the error code :
    POL-8028 Error in calling a Java method
    Cause: Most commonly refers to a problem when converting between Java and Oracle Lite datatypes.
    Action: Check the calling parameters.
    I can't understand where I am wrong ?
    Could anybody help me out ?
    Here is my source code of .java file
    import java.lang.*;
    import java.sql.*;
    class JournalInst {
    public void INSERT_JOURNAL(Connection conn, double AccNo, String AccDesc)
    System.out.println("Record Inserted for :"+AccNo +" "+AccDesc);
    Thanks in advance for solutions.
    Sarada
    null

    I just started with 8i Lite, but as far as I know 8i Lite does not support PL/SQL code.
    So you have to write your triggers and stored procedures in Java.
    Ciao

  • Error while creating a simple function, procedure or triger in Oracle8i Lite

    Hi,
    I have Oracle8i Lite release 4.0.
    While creating a simple proceudre/function/trigger on the database, it's throwing the following error:
    create or replace function test return number is
    ERROR at line 1:
    OCA-30021: error preparing/executing SQL statement
    [POL-5228] syntax error
    Here is my sample code.
    create or replace function test return number is
    begin
    return 0;
    end;
    Tried to create the same function in the user SYSTEM too but got the same error message.
    Thanks in advance for the soluton.
    null

    I just started with 8i Lite, but as far as I know 8i Lite does not support PL/SQL code.
    So you have to write your triggers and stored procedures in Java.
    Ciao

  • Serial number field and table

    Hi,
    I want Serial number field and table,
    Scenario like this,for returnable packging material we have assigned serial numbers,mtrl type is LEIH,so for tracking of RTP material now we are going to Develop one Report for this i need ur Help.
    Logic is:1)Matrl doc at the time of Delievery.
                Qty,Posting Date,Customer,Mvt type,Serial numbers for all.
                 Beacause at the time of Del we are mentioned all serial numbrs.
                2)Material Document at the time of GI.
                Same field as mentioned as above.
    After that,3)System is to Calculate How many Matrl are deliever to Custmer upto current  Period.Say  10.
    4)Calculte  How many Matrl are Recieved from the Custmer upto current  period.say 5
    5)Del - Issue=Total Number of Material is in Customer side.Say 5
    6)According to the Serial Number wise system has to calculate in which month delieverred matrl is in still customer side.
    (Ex PGI date 20.02.2007  3 qty
    Serial Number    1,2,3
    Issue date    20.03.2007   2 qty
    Serial Number    2,3
    Serial number  1 still is in Customer side.
    Age is 2 month)
    I am giving simple ex.
    so pls any body is having this idea pls Shared with me.
    Thanks
    Raghu

    Hi Raghu,
    Check table SER01(Document Header for Serial Numbers for Delivery).
    OBJK is the object table and you will have SERNR as serial number in this table.
    check table EQUI
                          EQUI -SERGE
                          EQUI-GERNR.
    EQUI-SERGE is Manufacturer serial number.chk if this is the one u r looking for.
    MARC-SERNP.
    key in plant and material in this table to fetch the Serial number profile of the material.
    Check in IKPF AND ISEG Tables... ( inventory )
    MSEG~EQUNR
    Hope it will hep u
    Regards
    Hareesha

  • How to prevent a number field from getting summed?

    I want to display the # of clients per a certain ID number. (In order to show the duplicate records by setting a filter in the # of clients field). However, this works if the ID number is a text field... but it doesn't work if the ID number is a metric of client... or number. It gets summed up, I get the total, and the % of clients turns to be 1.
    Any ideas?
    Thanks

    Example:
    I have 3 clients:
    Column A
    55
    55
    44
    21
    I want the following output:
    55 | 2
    I get the desired result by adding a second column (# of clients) and creating a filter to get results only if the value is > 2.
    The problem is when "Column A" is a number field. If it is a number field, I get total sum of the records (55+55+44+21) and a value of "1" if I add the # of clients column.
    Is it clearer now? ideas?

Maybe you are looking for

  • I cannot send mail. Been so for 2 days. Get the message: An error occurred while sending mail. The mail server responded: Access denied

    When I send message the reply is "Access Denied" and a bunch of gobbly-gook ending with please re-check message. What would I check for? The G-G is of absolutely no value to the human species. An error occurred while sending mail. The mail server res

  • Picture too Large for Screen

    Is there a way to adjust the cable box so that the picture adjusted properly to fit the screen?  Currently I have a Phillips 30 inch Widescreen HD tv and certain channels dont fit the screen.  (ESPN News QVC Fox Business) .   The Tv does not have a s

  • Add a function in the save process of a bid quotation

    Dear Experts, I like to add a function module into the save process of the quotation (bid_quot) I found the html template, but not the place where I can add my function. I also found the java comand where the save function is called. I'm really new t

  • CALL Transaction VK11

    Hi Friends, I am doing a BDC for VK11. i will be getting 3 condition types, based on that, i have to create 3 internal tables and have to call Transaction VK11 3 times. how to proceed this? when the program is calling second time its not showing the

  • Palm OS Upgrades

    I know there were Palm OS Upgrades for the Palm 3, Palm V, among other older devices why are these unavailable now, and if they are unavailable from Palm where can they be obtained. Because some people actually need them, myself included, and general