DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 5 of 5

Thread: VOid(Java)

  1. #1
    Join Date
    May 2006
    Posts
    3

    VOid(Java)

    Does anyone Knows how to void off Something??

    For example...

    using array i stored 10 item with ID
    Code:
    int [] item=new int [10] 
    item[1]=11000;
    item[2]=11001;
    ....
    when i key in the "11000" in a text field and press Enter button
    something will appear on my textArea
    Code:
    textarea.setText("the code which i preSet");
    BUT now My Question is .. How can i void off one item when i Press a void button... i dunno how to start off.. any one can help me??

  2. #2
    Join Date
    Mar 2005
    Location
    UK, London
    Posts
    150
    Hi, can u explain a little more plz.

  3. #3
    Join Date
    May 2006
    Posts
    3
    Quote Originally Posted by major
    Hi, can u explain a little more plz.
    ok.. no Problem... this is how my Program goes.. it reads an Xml and called out all the label buttons and function stored in it....
    i hard coded 4 item currently in item:
    Code:
    public int [] item=new int[100];
    
            item[0]=11000;
    	item[1]=11001;
    	item[2]=11002;
    	item[3]=11003;
    this items stored in Items ID which represent the Stuff i have in a store....
    when the ID is key into the textField....

    this will be seen on the textarea..

    Code:
    IF (textarea.getText()=11000)
    {
    toAppend="Coke"
    cost="0.60"          
    textarea.setText(toAppend+"\n"+"cost")
    }
    
    IF (textarea.getText()=11001)
    {
    toAppend="Sprite"
    cost="0.60"          
    textarea.setText(toAppend+"\n"+"cost")
    }

    IF my text area i display this 2 item and i wan to void off the last one(mean to delete one) how can i do it??

  4. #4
    Join Date
    Mar 2005
    Location
    UK, London
    Posts
    150
    okay is it a textarea where you will entere the number such as 10101 or a textfield, will you be entering the numbers in a row for example, if u wanted to add the following for coke in a textarea 010101 then for sprite 001110 will the textaraea look like this : 010101001110 or will the first number 010101 be deleted?

    You will need a keylistener to listen out for key events as you type.

  5. #5
    Join Date
    May 2006
    Posts
    3
    Quote Originally Posted by major
    okay is it a textarea where you will entere the number such as 10101 or a textfield, will you be entering the numbers in a row for example, if u wanted to add the following for coke in a textarea 010101 then for sprite 001110 will the textaraea look like this : 010101001110 or will the first number 010101 be deleted?

    You will need a keylistener to listen out for key events as you type.

    thanks i manage to do it... but what i was actually doin was having a numberpad on my program which i void button...



    the Problem i faced now is..

    Code:
    	String tex = text.getText();
    		int newlineIndex = tex.lastIndexOf('\n');
    		if (newlineIndex>=0) {
      		tex = tex.substring(0, newlineIndex);
    
    } else {
      		tex = "";
    }
    		text.setText(tex);
    by doin this.. it eats up my "\n" and i will have the next item keyed on the same line... is there any solution to this??

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links