No more than 4 characters and the first char will be C

with this method
public void keyTyped(KeyEvent e) {
          if (e.getSource() == txtCode ) {
               char c = e.getKeyChar();
               if (!((Character.isDigit(c) || (c == KeyEvent.VK_BACK_SPACE)
                         || (c == '.') || (c == KeyEvent.VK_DELETE)))) {
                    getToolkit().beep();
                    e.consume();
          }

My standard answer (which is darn handy since there is no proper question)
is that this code is wrong. How do I know? How does BDLH do it? It's
actually quite simple, there's really nothing to it! A KeyListener is an awkward
and error-prone approach to almost any problem involving text components.
Instead, check out (depending on your problem):
DocumentFilter:
http://java.sun.com/javase/6/docs/api/javax/swing/text/DocumentFilter.html
A custom document:
http://java.sun.com/javase/6/docs/api/javax/swing/text/Document.html
In particular, check out the sample code at the start of the documentation
for JTextField:
http://java.sun.com/javase/6/docs/api/javax/swing/JTextField.html
Be sure to study the tutorial as well:
http://java.sun.com/docs/books/tutorial/uiswing/components/text.html

Similar Messages

  • SharePoint 2010, Visual Studio 2010, Packaging a solution - The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

    Hi,
    I have a solution that used to contain one SharePoint 2010 project. The project is named along the following lines:
    <Company>.<Product>.SharePoint - let's call it Project1 for future reference. It contains a number of features which have been named according
    to their purpose, some are reasonably long and the paths fairly deep. As far as I am concerned we are using sensible namespaces and these reflect our company policy of "doing things properly".
    I first encountered the following error message when packaging the aforementioned SharePoint project into a wsp:
    "The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters."
    I went through a great deal of pain in trying to rename the project, shorten feature names and namespaces etc... until I got it working. I then went about gradually
    renaming everything until eventually I had what I started with, and it all worked. So I was none the wiser...not ideal, but I needed to get on and had tight delivery timelines.
    Recently we wanted to add another SharePoint project so that we could move some of our core functinality out into a separate SharePoint solution - e.g. custom workflow
    error logging. So we created another project in Visual Studio called:
    <Company>.<Product>.SharePoint.<Subsystem> - let's call it Project2 for future reference
    And this is when the error has come back and bitten me! The scenario is now as follows:
    1. project1 packages and deploys successfully with long feature names and deep paths.
    2. project2 does not package and has no features in it at all. The project2 name is 13 characters longer than project1
    I am convinced this is a bug with Visual Studio and/or the Package MSBuild target. Why? Let me explain my findings so far:
    1. By doing the following I can get project2 to package
    In Visual Studio 2010 show all files of project2, delete the obj, bin, pkg, pkgobj folders.
    Clean the solution
    Shut down Visual Studio 2010
    Open Visual Studio 2010
    Rebuild the solution
    Package the project2
    et voila the package is generated!
    This demonstrates that the package error message is in fact inaccurate and that it can create the package, it just needs a little help, since Visual Studio seems to
    no longer be hanging onto something.
    Clearly this is fine for a small time project, but try doing this in an environment where we use Continuous Integration, Unit Testing and automatic deployment of SharePoint
    solutions on a Build Server using automated builds.
    2. I have created another project3 which has a ludicrously long name, this packages fine and also has no features contained within it.
    3. I have looked at the length of the path under the pkg folder for project1 and it is large in comparison to the one that is generated for project2, that is when it
    does successfully package using the method outlined in 1. above. This is strange since project1 packages and project2 does not.
    4. If I attempt to add project2 to my command line build using MSBuild then it fails to package and when I then open up Visual Studio and attempt to package project2
    from the Visual Studio UI then it fails with the path too long error message, until I go through the steps outlined in 1. above to get it to package.
    5. DebugView shows nothing useful during the build and packaging of the project.
    6. The error seems to occur in
    CreateSharePointProjectService target called at line 365 of
    Microsoft.VisualStudio.SharePoint.targetsCurrently I am at a loss to work out why this is happening? My next task is to delete
    project2 completely and recreate it and introduce it into my Visual Studio solution.
    Microsoft, can you confirm whether this is a known issue and whether others have encountered this issue? Is it resolved in a hotfix?
    Anybody else, can you confirm whether you have come up with a solution to this issue? When I mean a solution I mean one that does not mean that I have to rename my namespaces,
    project etc... and is actually workable in a meaningful Visual Studio solution.

    Hi
    Yes, I thought I had fixed this my moving my solution from the usual documents  to
    c:\v2010\projectsOverflow\DetailedProjectTimeline
    This builds ok, but when I come to package I get the lovely error:
    Error 2 The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. C:\VS2010\ProjectsOverflow\DetailedProjectTimeline\VisualDetailedProjectTimelineWebPart\Features\Feature1\Feature1.feature VisualDetailedProjectTimeline
    Now, the error seems to be related to 
    Can anyone suggest what might be causing this. Probably some path in an XML file somewhere. Here is my prime suspect!
    <metaData>
    <type name="VisualDetailedProjectTimelineWebPart.VisualProjectTimelineWebPart.VisualProjectTimeline, $SharePoint.Project.AssemblyFullName$" />
    <importErrorMessage>$Resources:core,ImportErrorMessage;</importErrorMessage>
    </metaData>
    <data>
    <properties>
    <property name="Title" type="string">VisualProjectTimelineWebPart</property>
    <property name="Description" type="string">My Visual WebPart</property>
    </properties>
    </data>
    </webPart>
    </webParts>
    .... Unless I can solve this I will have to remove the project and recreate but with simple paths. Tho I will be none the wiser if I come across this again.
    Daniel

  • ABAP Programming to display more than 255 characters in the screen

    Hi
       I want to display more than 255 characters in the screen after executing a report but i cant able to do that.
    Please help me to find out the solution.
    Thanks
      Mrutyunjaya Trpathy

    Hai tripathy,
    when the output of a report contains columns extending more than 255 characters in length.  In such cases, this set of ALV functions can help choose selected columns and arrange the different columns from a report output and also save different variants for report display. This is a very efficient tool for dynamically sorting and arranging the columns from a report output. The report output can contain upto 90 columns in the display with the wide array of display options.
    The commonly used ALV functions used for this purpose are;
    1.REUSE_ALV_VARIANT_DEFAULT_GET
    2.REUSE_ALV_VARIANT_F4
    3.REUSE_ALV_VARIANT_EXISTENCE
    4.REUSE_ALV_EVENTS_GET
    5.REUSE_ALV_COMMENTARY_WRITE
    6.REUSE_ALV_FIELDCATALOG_MERGE
    7.REUSE_ALV_LIST_DISPLAY
    8.REUSE_ALV_GRID_DISPLAY
    9.REUSE_ALV_POPUP_TO_SELECT
      hope u can try in this way.
    REGARDS,
    PRABA.

  • Get-ChildItem : The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

    Hi, Im trying to get the whole path in my server, so i tried that with this following code
    Get-ChildItem $sourceFolder  -Recurse | ?{$_.PsIsContainer} |Get-Acl
    But then, it showed me somtehing like this :
    Get-ChildItem : The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
     I tried to find the solver everywhere and mostly they propose to change the path name, which is impossible, since I am working with my company server, and those folder have already there before i start to work here, then the other ask me to use robocopy,
    but all of the trick just dont work
    is there any way to solve this problem? thanks

    There is no simple solution to this. And it is not a limitation of powershell itself, but of the underlying NTFS file system.
    If the problem is that a folder with a name longer than 248 exists anywhere within your directory structure, you are hooped.
    If the problem is that some fully qualified path names exceed 260 characters, then, in those cases, the solution already given is to create a psdrive partway up the path from the drive letter or server/share root of the path. Unfortunately, the output produced
    will be relative to that psdrive and not to what is specified as the $sourcefolder.
    unless you already know where those problematic paths are, you might consider trying to trap those errors and have your script figure out where it needs to create psdrives. You might then be able to calculate the equivalent path for each file or folder and
    output that. the programming effort would be simpler to just created a psdrive for each folder encountered, however I expect that would be very inefficient.
    Al Dunbar -- remember to 'mark or propose as answer' or 'vote as helpful' as appropriate.

  • How long does it take for the IOS 7.1 to finish updating? My phone has been plugged in to my computer for more than one hour and the status bar only shows about less than 1/4 completed. I have an iphone 5s btw.

    My phone has been plugged in to my computer for more than one hour and the status bar only shows about less than 1/4 completed. I have an iphone 5s btw.

    Depends on how strong your wifi connection is.
    you can try a reset hold down the home/sleep button together until you see the apple logo and then release.

  • Send excel attachment with more than 255 characters in the internal table

    Hi,
    I need to send an attachment in the form of spreadsheet.
    But the internal table that is being used for sending attachment in mails can have only 255 characters in one row.
    Whereas my spreadsheet requires a greater width than 255 characters .

    Hi,
    I need to send an attachment in the form of spreadsheet.
    But the internal table that is being used for sending attachment in mails can have only 255 characters in one row.
    Whereas my spreadsheet requires a greater width than 255 characters .

  • The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

    I've followed
    this blog post, but it didn't work for me. I truly don't want to change my solution path as this is not acceptable. What else can I do?
    I can't believe we still have limits on path length.

    Note that the solution described in the blog post does not change your solution path. The _CSRUN_STATE_DIRECTORY environment variable sets the location of the temporary folders used by the compute emulator. Your solution does not need to move.
    Though, you may still have problems related to path length inside your solution. To resolve these, I have sometimes used symbolic links (using MKLINK /D link target) or substed drives (SUBST X: path) to create shorter paths and then opened the
    solution from there. If I recall correctly, with the first method, you need to be careful how you navigate to the solution in the Open Project dialog. I think that if you browsed to the path, it would still use the long path, so you need to paste the short
    path into the file name text box to go directly to the location of your .sln file. I may be misremembering the details though.
    BTW, I can't believe we still have limits on path length either.

  • How to display more than 255 characters in the report

    Hi all,
    In my program, i try to output a variable type c length 500 in the report. But this report still keep on display 255 characters only although i had set the line-size to 500.
    Is there any method output all characters?
    thanks,
    Janice

    Hi Janice Yeoh,
      I am assuming this is classical report......And just need to do is increase the line-size in report statement. Find below for small example which i ve tried..
    REPORT  ytest1 LINE-SIZE 500.
    DATA :  BEGIN OF it OCCURS 500,
            v TYPE c,
            END OF it.
    DO 503 TIMES.
      IF sy-index = 500.
        WRITE '500'.
      ELSE.
        WRITE : 'X' NO-GAP.
      ENDIF.
    ENDDO.
    Dont forgot to Reward me points .....All the very best....
    Regards,
    Sreenivasa sarma K.

  • Mac Book Pro with more than 6 years and the battery is broken

    The battery on my old Mac Book Pro is broken. I want to buy one online, but all I can find is the 15 inch description. Are they still the same as the ones on the new Mac Book Pro? Thanks for helping!

    fuuunkdat wrote:
    it said: the volume macintosh could not be repaired.
    This suggests that your HDD may be corrupt.  In order to try and repair it, we must get into the recovery partition or use the original installation disks.  Try and start your MBP using COMMAND R.
    http://www.apple.com/osx/recovery/
    If that works, note the 4 option menu.  Select Disk Utility>First Aid and verify and repair the disk.
    If COMMAND R fails, try OPTION COMMAND R.  If that works, try the same as above with Disk Utility.
    If neither works, it suggests that your MBP came with Snow Leopard.  You will need replacement disks which can be ordered from Apple customer service.  Have the serial number of the MBP handy and there is a charge.
    Ciao.

  • My computer comes on but with the loading bar under the apple logo. The bar only loads partially and then the computer shuts off. I've tried turning it on again more than 5 times and the same thing happens. Does anyone know how to fix this?

    My computer comes on but with the loading bar under the apple logo. The bar only loads partially and then the computer shuts off. How do I get this fixed?

    If you are still under warranty and/or have AppleCare, call them.  Let them deal w/it.
    OOW:  Please advise of which model iMac you have?
    http://support.apple.com/kb/HT1758 How to identify iMac models
    OS X Mavericks (10.9)
    If/when you get your problem resolved, you need to update your OS.

  • Have trouble with apple tv i rest it more than 4 times and the screen stays black plz help

    I don't know what genl it is too? help srtarted working then stoped tried to watch something and told me could not find content tried to restoring and didn't work screen stays black

    I am not sure. I have it since last November and I am using it so comfortably. I also have Installus and I am downloading every thing without any problem.

  • I want to display message more than 50 characters

    hi experts
    i want to display message more than 50 characters, and the fm 'POPUP_DISPLAY_MESSAGE' can display just 50characters, my message maybe much long, what other fm can i use?
    btw, i cann't use POPUP_TO_CONFIRM to let user select, the popup screen should only have one button to let user type in.

    thanks for ur reply,
    but 'POPUP_TO_DISPLAY_TEXT' just has two lines(every line has character limit), my message to be displayed may be much long.
    why i need the fm is that, i want to display error message when user made error operation, if i use 'message msg type 'E' ', the message display in the status bar at the left-down place and cann't display the whole message if the message is to long.
    so i had like to find a fm like 'POPUP_TO_CONFIRM' which can display multipul lines and just with one button(which is the user required...).

  • The CSV file on the application server not showing more than 255 characters

    Hi All,
    We are using SAP 4.6C & the CSV file getting created on the application server has more than 255 characters, all the characters beyond 255 are getting truncated, even while downloading the file the same no. of characters are coming in the file.
    Can any one please let me know how can we overcome the problem in SAP 4.6C?

    Hi Buddy,
       You can't display morethan 255 Char. If you see the fun mod you will see the  the limit,I also faced the same problem. Probably you start checking by adding fields one by one or you have to reduce the length of some fields in order to display the full data in CSV.
    Thanks,
    Krishna...

  • Storing more than 2000 characters in a varchar2 column in Oracle 11g?

    We have a table in Oracle 11g with a varchar2 column. We use a proprietary programming language where this column is defined as string. Maximum we can store 2000 characters (4000 bytes) in this column. Now the requirement is such that the column needs to store more than 2000 characters. The DBAs don't like BLOB, CLOB or LONG datatypes for maintenance reasons.
    There are 2 solutions I can think of -
    1. Remove this column from the original table and have a separate table for this column and then store each character in a row, in order to get more than 2000 characters. This table will be joined with the original table for queries.
    2. If maximum I need is 8000 characters, can I just add 3 more columns so that I will have 4 columns with 2000 char each to get 8000 chars. So when the first column is full, values would be spilled over to the next column and so on.
    Which one is a better and easier approach? Please suggest.

    Visu - Some people also do not like to use LOBs because of difficulty in reclaiming space and ever increasing LOB segments. Some of these problems were caused by Oracle bugs (eg, Bug 2944866 Free space in LOB table / tablespace not reused with ASSM, Bug 3019979 Space may not be reused efficiently in a LOB segment) - albeit in 9.2. I've seen a few bug reports for similar things in 10.2 (don't have the references). Still, if there is a workaround/patch is this reason enough to steer the application development into a new direction?

  • Insert more than 4000 characters using sql plus

    I have a SQL script that creates a database. The problem is that some of the fields are longer than 4000 characters in the INSERT statement and Oracle doesn't seem to like it.
    The field is a clob and works fine in the application (i.e. I can insert more than 4000 characters using the app) - how do I achieve this in a SQL script?
    Any help is much appreciated.
    Cheers,
    Steve

    Hi,
    This pl/sql block works absolutely fine in SQL*Plus inserting > 4000 characters into clob column:
    declare
    l_str varchar2(8000);
    l_str1 varchar2(2400) := 'first part of the verly long string...';
    l_str2 varchar2(2400) := 'second part of the verly long string...';
    begin
    l_str := l_str1 || l_str2;
    insert into tmpl values (l_str);
    end;
    So, you'll have to replace inserts with pl/sql blocks in your script.
    Tested in Oracle 8.1.7.0.0
    Regards,
    Andrew Velitchko
    BrainBench MVP for Developer/2000
    http://www.brainbench.com

Maybe you are looking for

  • Event ID 2115 A Bind Data Source in Management Group

    Hi All, I have some issue's with Microsoft System Center Operations manager 2012 R2. The issue is the following: A Bind Data Source in Management Group XXXXXXX has posted items to the workflow, but has not received a response in 2100 seconds.  This i

  • Force Join to Fact

    Hi... Is there any way to force OBI to join to the fact table when only one dimension is pulled into a query? For example, I have a generic date dimension with static dates loaded. Each date has its own alias. When I query a specific date, I only wan

  • Error XK02  (Country PK is not an EC member) Message no. F2141

    Dear Expert, When i chage vendor VAT Reg. No. through T code XK-02 there will be show error (Country PK is not an EC member) Message no. F2141kindly guide me. Regards Priya Sharma

  • Adobe - please explain how to soft proof in LR2

    I have read all the messages I could find. It seems clear that LR2 has no soft proofing of my prints. And yes, I am working with a color managed screen. So Adobe, please tell us how you intend us to soft proof our images????

  • No matter what I do I am unable to set my Safari homepage.

    When I open Safari, it will not go to my homepage.  It goes to a blank even though I have set my homepage in my Preferences.