How do I limit the size of a TextField and do an auto advance of that field

Attached is a copy of my program. It reads a bar code and enters that bar code into a textfield and 2 text areas. everything is working fine except I want the bar code read to trigger a print to the 2 text areas automatically instead of the user having to hit the enter key. Any suggestions on where I should start researching or any snippets of code that I could use would be appreciated.
//-------------------Buffalo Offline Scan Program------------
//This program will allow the Buffalo user to continue scanning cases on pallets
//when the AS\400 is down. The scans will be sent to a flat file that will be
//FTPed to the AS\400 when it is back up and update the proper files.
//Program Author: Susan Riggin
package javalab;
import javabook.*;
import javalab.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.applet.*;
import java.io.*;
import java.io.File.*;
import java.util.*;
public class BuffOff extends Applet implements ActionListener
//               Data Members
     //Variables
     private int scanCount = 0;
     private int sessionCount = 0;
     //Labels
     private Label buffaloLabel = new Label();
     private Label scanLabel = new Label();
     private Label cPalletLabel = new Label();
     private Label cCountLabel = new Label();
     private Label tPalletLabel = new Label();
     private Label tCountLabel = new Label();
     private Label rButtonLabel = new Label();
     private Label eButtonLabel = new Label();
     //TextFields
     private TextField scanTextField = new TextField(6);
     //Buttons
     private Button rButton = new Button("Reset");
     private Button eButton = new Button("Exit");
     //Text Areas
     private TextArea cTextArea = new TextArea( 10, 40);
     private TextArea tTextArea = new TextArea(10, 40);
     public void paint(Graphics g){
     Toolkit kit = Toolkit.getDefaultToolkit();
     Image imageA = kit.getImage("d:\\\\javaproj\\javalab\\abbott.gif");
     g.drawImage(imageA, 555, 5, 50, 50, this);
//               Constructor
public BuffOff()
     //Attach the GUI objects so they will appear on the screen.
     setLayout (null);
     buffaloLabel.setBounds(203, 5, 200, 27);
     buffaloLabel.setFont(new Font ("dialog",Font.BOLD, 18));
     buffaloLabel.setAlignment(Label.CENTER);
     buffaloLabel.setText("Buffalo OffLine Scan");
     cPalletLabel.setBounds(18, 60, 291, 23);
     cPalletLabel.setFont(new Font ("dialog", Font.BOLD, 14));
     cPalletLabel.setAlignment(Label.CENTER);
     cPalletLabel.setText("Current Pallet");
     cPalletLabel.setBackground(Color.cyan);
     tPalletLabel.setBounds(322, 62, 291, 23);
     tPalletLabel.setFont(new Font ("dialog", Font.BOLD, 14));
     tPalletLabel.setAlignment(Label.CENTER);
     tPalletLabel.setText("Total Pallets");
     tPalletLabel.setBackground(Color.pink);
     rButton.setBounds(129, 485, 56, 23);
     rButton.setBackground(Color.cyan);
     rButton.setLabel("Reset");
     eButton.setBounds(459, 485, 56, 23);
     eButton.setBackground(Color.pink);
     eButton.setLabel("Exit");
     cCountLabel.setBounds(18, 88, 291, 23);
     cCountLabel.setFont(new Font("dialog", Font.BOLD, 12));
     cCountLabel.setAlignment(Label.CENTER);
     cCountLabel.setText("Current Pallet Case Count = " + scanCount);
     cCountLabel.setBackground(Color.lightGray);
     tCountLabel.setBounds(322, 88, 291, 23);
     tCountLabel.setFont(new Font("dialog", Font.BOLD, 12));
     tCountLabel.setAlignment(Label.CENTER);
     tCountLabel.setText("Total Pallet Case Count = " + sessionCount);
     tCountLabel.setBackground(Color.lightGray);
     scanLabel.setBounds(120, 33, 160, 23);
     scanLabel.setFont(new Font("dialog", Font.BOLD, 14));
     scanLabel.setAlignment(Label.CENTER);
     scanLabel.setText(" Current Barcode Scan: ");
     scanTextField.setBounds(300, 34, 58, 23);
     scanTextField.setBackground(Color.white);
     eButtonLabel.setBounds(322, 460, 291, 23);
     eButtonLabel.setAlignment(Label.CENTER);
     eButtonLabel.setBackground(Color.pink);
     eButtonLabel.setText("Press Exit to end Program.");
     rButtonLabel.setBounds(18, 460, 291, 23);
     rButtonLabel.setAlignment(Label.CENTER);
     rButtonLabel.setBackground(Color.cyan);
     rButtonLabel.setText("Press Reset for next pallet scan.");
     cTextArea.setBounds(18, 118, 291, 333);
     cTextArea.setBackground(Color.cyan);
     tTextArea.setBounds(322, 118, 291, 333);
     tTextArea.setBackground(Color.pink);
     //Place the GUI objects on the applet.
     add(buffaloLabel);
     add(scanLabel);
     add(cPalletLabel);
     add(cCountLabel);
     add(tCountLabel);
     add(tPalletLabel);
     add(cCountLabel);
     add(rButtonLabel);
     add(eButtonLabel);
     add(scanTextField);
     add(rButton);
     add(eButton);
     add(cTextArea);
     add(tTextArea);
     //Add applet as an action listener.
     scanTextField.addActionListener(this);
     rButton.addActionListener(this);
     eButton.addActionListener(this);
//               Methods that make the program work
//---------method for action performed and action event---------
     public void actionPerformed(ActionEvent e)
     if (e.getSource() == eButton) exit();
     if (e.getSource() == scanTextField) {
          try {     
               scan();
          catch(IOException f){}
     if (e.getSource() == rButton) reset();
//-------------method for pressing the exit button---------------
     private void exit()
     System.exit(0);
//------------method for pressing the reset button---------------
     private void reset()
     scanCount = 0;
     scanTextField.setText("");
     cTextArea.setText("");
     cCountLabel.setText("Current Pallet Case Count = " + scanCount);
     scanTextField.requestFocus();
//------------method for scanning barcode------------------------
     private void scan() throws FileNotFoundException
     String scanText = scanTextField.getText();
     if (scanText.equals("999999")) reset();
     else{
     String cTime, cDate;
     File scan = new File("d:\\\\javaproj\\javalab", "scan.txt");
     //adds the date and time to entries
     Clock myClock = new Clock();
     cTime = myClock.getCurrentTime();
     cDate = myClock.getCurrentDate();
     //Add to counts
     ++scanCount;
     ++sessionCount;     
     //Append scanned data to text areas
     cTextArea.append(scanCount + "->" + scanText + " " + " " + cDate + " " + cTime );
     cCountLabel.setText("Current Pallet Case Count = " + scanCount);
     cTextArea.append("\r\n");
     tTextArea.append(sessionCount + "->" + scanText + " " + " " + cDate + " " + cTime);
     tCountLabel.setText("Total Pallet Case Count = " + sessionCount);
     tTextArea.append("\r\n");
     //Append scanned data directly to flat file.
     try
     FileWriter outputFile = new FileWriter("d:\\\\javaproj\\javalab\\scan.txt", true);
     outputFile.write(scanTextField.getText());
     outputFile.write(myClock.getCurrentDate());
     outputFile.write(myClock.getCurrentTime());
     outputFile.write("\r\n");
     outputFile.close();
catch (IOException e)
     //clear the scan field
     scanTextField.setText("");
     // position the cursor
     scanTextField.requestFocus();
Thanking you in advance for your assistance!!!!!!!!!
     

Sorry that you're still having trouble :-( The title of your post seems a little different to your description of the problem, but I'm assuming you want the textfields to auto-scroll so they always show the last entry?
Try this://Append scanned data to text areas
cTextArea.append(scanCount + "->" + scanText + " " + " " + cDate + " " + cTime );
cCountLabel.setText("Current Pallet Case Count = " + scanCount);
cTextArea.append("\r\n");
//ADD CALL TO AUTO-SCROLL METHOD:
autoScroll(cTextArea);
tTextArea.append(sessionCount + "->" + scanText + " " + " " + cDate + " " + cTime);
tCountLabel.setText("Total Pallet Case Count = " + sessionCount);
tTextArea.append("\r\n");
//ADD CALL TO AUTO-SCROLL METHOD:
autoScroll(tTextArea);Then you need to add this method to your class:private void autoScroll(TextArea textArea){
    //get the length of the text in the text area:
    int endOfText = (textArea.getText()).length();
    //...then set the caret position to the end:
    textArea.setCaretPosition(endOfText);

Similar Messages

  • HT204264 How do I limit the amount of space used by photos on my phone - now that I turned iCloud on it is taking over my phone

    How do I limit the amount of space used by photos on my phone - now that I turned iCloud on it is taking over my phone

    Hello Maahk,
    Welcome to the Apple Support Communities!
    I understand that you would like to optimize your Photos storage. If you are using iCloud Photo Library on your iPhone, please read over the information in the attached article. 
    iCloud Photo Library FAQ - Apple Support
    Can I use iCloud Photo Library to save space on my device?
    iCloud Photo Library automatically keeps all your photos and videos in the original, high-resolution version. Follow these steps to choose how you store your photos and videos on your device:
    In iOS, tap Settings > iCloud > Photos or Settings > Photos & Camera, then select a storage setting.
    In OS X, click Photos > Preferences > iCloud, then select a storage setting. 
    If you turn on Optimize [device] Storage, iCloud Photo Library will automatically manage the size of your library on your device, so you can make the most of your device's storage and access more photos than ever. All of your original, full-resolution photos and videos are stored in iCloud while device-size versions are kept on your device. You can download the original photos and videos over Wi-Fi or cellular when you need them. 
    If you turn on Download Originals, iCloud Photo Library will keep your original, full-resolution photos and videos in iCloud and on your device. Download Originals is the default setting for iOS devices with the free 5 GB storage plan and for all Mac devices.
    Have a great day,
    Joe

  • I want to be able to paste a bunch of text into the subject line buit to only keep the first maybe 50 characters. How can I limit the size of the subject line?

    I need the ability to paste a bunch of text into the subject line but for it only to capture the first 50 or x number of characters. Can I limit the size of the subject line characters somehow in an ini or profile setting?

    If your problem is with Mozilla Thunderbird, see this forum for support.
    [https://support.mozillamessaging.com/en-US/home] <br />
    or this one <br />
    [http://forums.mozillazine.org/viewforum.php?f=39]

  • How can I reduce the size of stardard css and js of BSP?

    Hi all,
    I have problem with the js and css standard of sap.
    When I enter the first each in the portal, this css are loaded (after cache):
         - sapUrMapi_ie6.js with 333331 bytes
         - ur_ie6.css with 174256 bytes
         - popup_ie6.js with 22690 bytes
         - events.js 22886 bytes
    Total: more of less 1MB of datas.
    How can I reduce the size of these files?
    Can i not use this files and see the tabscripts or others object htmlb?
    thanks

    Hi Benito,
    these files contain all "stuff" that the BSP Extensions need to work. If you decide to code your own HTML content you don't need them.
    The other thing to consider is that these files should really be cached b your browser so this overhead only happens once.
    Cheers
    Graham

  • How can I limit the size of a file upload?

    I am uploading a file using a file reference using the code below.  I want to  limit the file size (bytes) of the uploaded file to 100k, so that a huge file won't crash the browser or my SWF.
    What's the best place in the following process to test this, and actually prevent the large file from being loaded?  Is that even possible?
    private function uploadImageBtn_clickHandler() : void {
         var arr:Array = [];
         arr.push(new FileFilter("Images", "*.gif;*.jpeg;*.jpg;*.png"));
         fileRef.browse(arr);
    private function fileReference_select(evt:Event):void {
         fileRef.load();
    private function fileReference_complete(event:Event):void {
         var loader:Loader = new Loader();
         loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loader_complete);
         loader.loadBytes(fileRef.data);
    public function loader_complete (event:Event) : void {
         trace("Loader info = "+event.currentTarget.bytesLoaded); // file size in bytes
         var sourceBMP:Bitmap = event.currentTarget.loader.content as Bitmap;
         bgImage.source = sourceBMP; 

    Thank you. I just needed to be pointed in the right direction. After looking over this stuff, including FilePermission, I think this may give me what I was looking for. It will be a while before I get to implementing it or testing something like this, I'm just trying to get a grasp on all of the things I need to do and how to approach it.
    By doing this I can control how much filespace it can use.
    I can control CPU usage by monitoring for extra threads that don't belong and killing or settings the priority on it.
    Now I just need to think of something to monitor how much memory the plugin uses. I suppose I could gc, then store the current memory usage, then execute the plugin, gc again, and measure the size again. Does that sound like a reasonable way to estimate it's memory usage? I'm not looking for tiny changes, I just want to see large, substantial increases.

  • How can I limit the size of a file generated by 3rd party code?

    I have a program that loads plugins from a directory and executes code in those plugins. These plugins are classes that implement a standard interface within my API. I want to be able to monitor for files generated by these plugins. Usually there are no more than 2 plugins running at once, so I could end up with 2 plugins writing files. An example would be a plugin creating an SQLite database on the filesystem.
    I could monitor the current directory and guess who's file it is, but what if the files get written elsewhere? Can I do something in Java that limits what directories the Java process can write to?
    I wouldn't mind being able to track their memory and CPU usage, but I don't think I can do much about that.

    Thank you. I just needed to be pointed in the right direction. After looking over this stuff, including FilePermission, I think this may give me what I was looking for. It will be a while before I get to implementing it or testing something like this, I'm just trying to get a grasp on all of the things I need to do and how to approach it.
    By doing this I can control how much filespace it can use.
    I can control CPU usage by monitoring for extra threads that don't belong and killing or settings the priority on it.
    Now I just need to think of something to monitor how much memory the plugin uses. I suppose I could gc, then store the current memory usage, then execute the plugin, gc again, and measure the size again. Does that sound like a reasonable way to estimate it's memory usage? I'm not looking for tiny changes, I just want to see large, substantial increases.

  • How can I limit the size of emails that are downloaded in Mail 6.2

    I currently have limited bandwith.  How can I set up Mail 6.2 to only download email headers for messages greater than 50 kb in size

    Thank you. I just needed to be pointed in the right direction. After looking over this stuff, including FilePermission, I think this may give me what I was looking for. It will be a while before I get to implementing it or testing something like this, I'm just trying to get a grasp on all of the things I need to do and how to approach it.
    By doing this I can control how much filespace it can use.
    I can control CPU usage by monitoring for extra threads that don't belong and killing or settings the priority on it.
    Now I just need to think of something to monitor how much memory the plugin uses. I suppose I could gc, then store the current memory usage, then execute the plugin, gc again, and measure the size again. Does that sound like a reasonable way to estimate it's memory usage? I'm not looking for tiny changes, I just want to see large, substantial increases.

  • How do I limit the number of Operator Interface and Execution instances to one?

    We have a problem in MFG.  The operator launches to instances of the operator interface and executes the same sequence.  A second scenario is where the operator is executing the sequence and then changes from the execution window back to the Sequence Display window and launches a second execution window.  We need to understand how to limit the number of executions within an instance of the Operator Interface to one.  We also need to understand how to limit the number of instances of the Operator Interface to one.
    Regards,
    Steve Easthope

    Steve,
    This is a duplicate post.  Please reference your first thread. 
    Derrick S.
    Product Manager
    NI DIAdem
    National Instruments

  • How do I change the size of my icons and text

    I just purchased a new iMac 21.5   The display font and text are too small to read comfortably. How do I adjust the display, icons and text?

    Hi there.
    Just do a 'Right Click' on the desktop and a menu will appear.
    Choose 'Show View Options' at the bottom of the list and all the options are there for you to alter as you wish.
    Cheers

  • How can I change the number in iMessage send and receive on my iPhone 5c that is gray?

    I recently bought a iphone 5c and when I activate it, the imessage automatically set the number in send and receive, but the funny thing is the number that is registered is my number in another network and is grayed out, How can I change the number to the sim that I'm using in the phone?

    HI,
    As far as I can tell you cannot delete the ID when Only one is listed.
    This would suggest that you have to add the second (Correct) one and then delete the first (wrong) one.
    I can't say I have tried this yet.
    10:43 PM      Thursday; April 5, 2012
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
      iMac 2.5Ghz 5i 2011 (Lion 10.7.3)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • How can I reduce the size of my DB and my nightly backups?

    One of my SQL databases is growing out of control and its required nightly backups (FULL) are sucking disk space at a rapid rate.  The backups are now at 120GB a pop and the DB itself is somewhere at 119GBs in size.  We've tried shrinking/truncating
    the transaction logs but it doesn't seem to do anything.  Being that I'm not the one who performs the transaction log shrinking when we need to, I'm not sure if doing this shrink operation is the same as having a Shrink Database task in a maintenance
    plan (is it the same?).  I'm aware it's not usually recommended but we've been trying pretty much everything without success.
    Short of cleaning the actual database of unused content, etc., is there anything else we can do via SQL Server?
    Thanks!
    Rob

    Hello,
    Please configure backup compression, if the instance is using Enterprise Edition, BI edition or Standard Edition.
    http://msdn.microsoft.com/en-us/library/hh231019.aspx
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • How to limit the size of bounced messages

    Hi,
    how can i limit the size of bounced messages?
    In most cases, we have users which accounts are over quota, the mail bounces and is returned.
    How can i limit the size of the returned message to a maximum size of 1MB?
    We're using
    iPlanet Messaging Server 5.2 HotFix 2.02 (built Oct 21 2004)
    libimta.so 5.2 HotFix 2.02 (built 13:42:55, Oct 21 2004)
    thx,
    ghfg

    Ah. found it. It is indeed in 5.2
    http://docs.sun.com/source/816-6009-10/mta.htm#24585
    look down the page, and find:
    CONTENT_RETURN_BLOCK_LIMIT
    this when put in the option.dat file will limit your response to the
    CONTENT_RETURN_BLOCK_LIMIT=
    number of 1k blocks.

  • How do I reduce the size of a graphic in Preview and maintain resolution?

    Preview 6.0.1
    Hi,
    I have a graphic in Preview. The largest file is a .jpg at 77 KB. Information about the graphic is in the attached "Adjust Size ScreenPreview Galleon 77.
    I find that when I reduce the size of the file using Previews menu bar functions that I usually use — Screenshot>Zoom reduce>Select the smaller picture>Screenshot — that the result is an image that has lost the focus, the resolution of the original graphic.
    How do I reduce the size of a graphic and maintain resolution? I've never used the Adjust Size Screen functions.
    I'm not stuck on having to use Preview to accomplish this, but I do use Preview a lot.
    Thanks,
    Rafael
    KB.jpg".

    Choose a smaller width, the height will adjust appropriately, and the resolution will stay the same.

  • How can I change to size of a book and keep all the layouts I have created?

    How can I change the size of a book and use the layout that I have already chosen (I accidently laid the book out for a larger size book than what I acctually wanted)?

    Just in case of problems duplicate the book (select it and edit ==> duplicate or Command=D) and then click on themes and select the same theme in theprper size - verify that everything worked (sometime different sized text blocks cause minor problems that require attention) and preview it -
    Before ordering your book preview it using this method - http://support.apple.com/kb/HT1040 - and save the resulting PDF for reference - the delivered book will match it.
    then order
    LN

  • How do I check/limit the size of a file

    I am logging data to a file periodically. Since the PC is at a remote site, and I download the data file via modem, I want to limit the size of the file by automatically starting a new file once the current file reaches a certain size (in kB) limit. This way I minimize download time as well as avoid downloading the same data over and over again if I keep the same filename.
    How can I do this? Thanks.

    There is a function on the File I/O>Advanced File Functions called File/Directory Info. The functions returns the file size in bytes.

Maybe you are looking for

  • APEX 3.0 Web Service OWS-04052 unrecognized operation SOAP Envelop

    Hey, I run into a problem with WebServices. Short, I implemented a WebService with JDeveloper and now I would like to create ws references in APEX. The ws is working 100% correct so the problem is, that APEX creates a soap envelop which is not 100% c

  • PLEASE X3 TO THE POINT OF DESPERATION!!

    2 questions... 1.) I'm not sure what happened! This morning before I left the house, I unplugged my iPod mini from my computer (that was off) and put it into my backpack. Once I turn it on, I usually put it on shuffle. After doing so, I tried to go t

  • Adding background image to Spry Menu Bar?

    Hi Everyone, I have a question concerning adding a background image to a horizontal spry menu. 1) I am using Dreamweaver CS4. 2) I am inserting this menu bar on a HTML document. 3) I have created and am using an external style sheet (CSS) I am not su

  • One sytem rollback segment though AUM

    Hello guys, i know from oracle documentation and experience that there exists one rollback segment in system until the initial installation... but why? Why can oracle not use the undo tablespace for this rollback segment if i use AUM? Can i delete th

  • Scom - web console limitations?

    Hi All, We allow access to the scom console for our support teams via the web console. When support teams access their dashboards, they are restricted and are unable to view "alert properties" when right clicking their alerts, is there a way to enabl