How to reach that a jtextfield only accept characters?...

I tried it...doing:
http://forum.java.sun.com/thread.jsp?forum=57&thread=394377&tstart=0&trange=15
But.....i realized that is necesary to introduce the exact number of characters so the characters don't be removed.....somebody has other idea or suggestion about how is the best way to reach it?....
Thnaks in advance..
Mary....

You just need to create a class that extends PlainDocument, and override the method insertString, try using the codes, I haven't tested the code but it should work:
public class CharacterField extends JTextField {
public CharacterField(int cols) {
super(cols);
protected Document createDefaultModel() {
     return new CharacterDocument();
class CharacterDocument extends PlainDocument {
public void insertString(int offs, String str, AttributeSet a)
     throws BadLocationException {
/*Here str is the string typed or pasted by the user
     if (/*Condition or match for being characters*/) {
     super.insertString(offs, str, a);
Create an object of the CharacterField class and it will accept only the string which matches your condition.

Similar Messages

  • I no longer have access to system folders that allow me to remove old or incorrect PAGES templates. Need to find out how to do that. The only way I can do it now is to blank the template and replace the bad template with a blank.

    I no longer have access to system folders that allow me to remove old or incorrect PAGES templates. Need to find out how to do that. The only way I can do it now is to blank the template and replace the unwanted template with a blank. It was previously possible to go to MY TEMPLATES and remove the unwanted templates. I don't if this issue is before or since installation of 10.8 (a nightmare in my case, which led to significant failure issues).  And because I haven't tried to remove templates since finally managing to install 10.8 (now at 10.8.4), I don't know if this is typical of the newer OS or a problem. I've been a Mac user for more than 25 years, but I think I'm nearing the end of the road. By the way, I've never needed to do this before because the manuals always offered an answer... they don't seem to do that anymore. In any case, I don't know how this works... I'd prefer an email reply if that's possible. But that would probably be too easy, and I don't know how to get a reply.

    Thanks, I appreciate the help.  I think this is one of the problems Apple is creating by changing the OS so often. I had fomer colleagues at [a major aerospace contractor] who told me that so many original files were ultimately lost because of the deadly change in the "Save As" operation that they are now afraid of every OS update. Apple has badly damaged their support base with that very prominent company (they won't update now until they've fully examined and understand changes in the pre-conditioned nature of OS computer functions), and they are a whole lot less enthaled with Mac-related equipment/software. Can't blame them, I too used orginal files that way (as easy-to-use templates), and lost some important files before I realized what was happening (to late to revert). Companies should not have to retrain employees each time an OS gets an update, it's can be very expensive several different ways. They learned a painful lesson with that one. And because I'm now retired and don't use multiple devices, I need iCloud like I need a hole in the head... but I'm told there's no way to keep Apple out of my computer. Fortunately, because of major problems when initially installing Mountain Lion, one hold-over of the hardware/software damage I experienced was that iCloud can no longer access my computer even though everything else is working fine again. That was the only "good luck" I had as a result of that expensive nightmare.

  • I bought my wife an ipad for xmas and the machine is faulty the apple authorised dealer admitted it was faulty and wants to replace my new machine with a factory refurbished unit. I told them that i will only accept a new one? am i right?

    i bought my wife an ipad retina for xmas and the machine is faulty, it keeps on switching off. the apple authorised dealer admitted it was faulty and wants to replace my new machine with a factory refurbished unit. I told them that i will only accept a new one as it is only a few weeks old and had the problem from the begining? is it correct that apple replaces new defective products with factory refurbished one? I have used apple products most of my life from mac 2 to G5. I had over a dozen apple machines and never had a problem so far? I do not believe this is right..

    architectmartin wrote:
    In the EU there is also a mandatory two year warranty by european union law. I am not a lawyer but i never signed or agreed to any apple policy at the time of purchase, i was told you have a two year guarantee bring it back if anything goes wrong which i did and now i am being quoted all sorts of policies. my own policy is that if you buy new you get new, with no excuses.  I feel a bit cheated by apple if i have to compromise with a second hand unit. the unit is not even a month old and we took it to the original store a couple of weeks after it was bought and they sent us to take it to a servicing dept in another town. I am an apple fan and expect excellent service like the products themselves.
    No one ever does sign anything - the purchase itself, where you exchange money for the product, is your de facto agreement to all warranties and policies set forth by both the seller and the OEM supplier.  That's a pretty firmly established principle of consumer law (image the nightmare if you had to read and sign to such things every time you purchased anything or everything?).
    You can complain to the store or to Apple about it if you wish.

  • HT201359 Can you please tell me how I check that I have only downloaded only one album my I pod is showing a lot of downloads for the same album I don't want to be charged for the same album thanks

    How do I acess my iTunes account to make sure I have not been charged for downloads which are showing up on my I pod I downloaded the 80's album but it looks like it has downloaded it more than once thanks

    You can view the purchase history on your account on your computer's iTunes via the Store > View Account menu option, on your account's details page there should be a purchase history section with a 'see all' link to its right : http://support.apple.com/kb/HT2727

  • A JTextField that only accepts alphabet characters?

    Hi there,
    I'm new to java and I'm looking for a way to create a JTextField that only accepts characters. If anyone can maybe show me some code to do this? I've googled and searched these forums for related posts and I found this post:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=762721
    however I haven't the first idea of documents or maskformatters, and my program is meant to be pretty simple. Is there any short way to do this? Or a way of accepting anything, then filtering it and replacing the inputted text with the new text, non-alphabet characters taken out?
    Thanks
    -Stern

    lots of help if you google; for instance adapting some of these ideas may help:
    http://www.cs.ut.ee/facilities/docs/java/tutorial/uiswing/components/textfield.html#validation

  • I forgot the passcode to turn off restrictions. I have restored my iPad back to the factory settings and then synced it with the latest backup. The restrictions are still on and it is asking for the passcode. Can someone tell me how to get that off.

    I forgot the passcode to turn off restrictions. I have restored my iPad back to the factory settings and then synced it with the latest backup. The restrictions are still on and it is asking for the passcode. Can someone tell me how to get that off.

    The only option is to wipe the device clean and restore it to factory settings.  Hope you have a backup.
    Follow the instructions in  iOS: How to back up your data and set up your device as a new device http://support.apple.com/kb/HT4137 to restore the device to factory settings.
    Once you have setup the device as a new one, you can then sync it back with your iTunes account and all your music, apps, contacts and any other content sync'ed with iTunes will be loaded on the device. Any content that is stored only on the device and not sync'ed with iTunes, like app logins or data, will be lost during this process. Be forewarned that this is a long process and can take a couple of hours or more to complete. This can be painful, but it is necessarily so to prevent users from working around the security settings. After the restore is complete, you can setup a new Restrictions passcode. Make a note of the passcode to avoid this situation in future.
     Cheers, Tom

  • In iPhoto, I want to copy certain photos in an event and then have the copies in another event WITHOUT removing the original photos from their original event; how to do that?

    in iPhoto, I want to copy certain photos in an event and then have the copies in another event WITHOUT removing the original photos from their original event; how to do that?

    The only way to do that is to export the image to a new file and then re-import it.
    It's not really the intended way of working as it uses twice the disk space and is inefficient.
    Use Albums instead. A Photo can be in any number of albums and use no extra disk space as it just simply references the image in the Library. Albums can be sorted any way you want - including manaually - and can have image from anywhere in the Library just by drag and drop.

  • How can i download my contacts into an in car phone system that only accepts v.card format

    How do I import contacts into an in car phone system that only accepts a v.card format.

    You can't. If the system doesn't support the PBAP bluetooth profile, you can not transfer your contacts to it.

  • We have two iphones and only one ipad.  We want to be able to use "find my iphone" for both phones, which have separate apple ids.  How do we get our ipad to accept this?

    We have two iphones and only one ipad - no mac.  We want to be able to use "find my iphone" for both phones.  How do we get the ipad to accept two iphone accounts?  icloud is enabled on all three devices. 

    Also, be aware of the following:
    The "Find my..." function is pretty much useless if the device is in the hands of a thief.  All that is necessary is for the thief to connect to any computer with iTunes and "Restore as new."
    The only real protection you have is with the personal information on the device rather than the physical device itself.  Something as small as an iPod/iPhone should have a strong 8-digit (or longer) password AND be configured for automatic wipe in the event of ten consecutive incorrect password entries.

  • Old I-tunes accepted both my i-pods now it only accepts one and tells me that I CANNOT SYNC MY SECOND I-POD AS A DUPLICATED NAME WAS USED...DON'T KNOW WHAT THIS MEANS CAN ANYONE HELP?

    Old I-tunes accepted both my i-pods - now it only accepts one and tells me the second cannot be synched as a duplicate name has been used.
    There is no explanation as to what I must do to put this right....can anyone help with this? Thanks.   

    If you are wondering why you are not getting any responses, it is because you have vented a complaint without any details that make any sense or give anyone something to work on.
    If you want help, I suggest actually detailing what has happened, with versions of software etc. Anything that would let us assist.
    As a start I am guessing that you have not really got the hang of "How it all works". Firstly download the Pages09_UserGuide.pdf from under the Help menu. Read that and view the Video Tutorials in the same place. A good addition would be the iWork 09 Missing manual book and something to help you learn how to use your Mac.
    If there are specific tasks you need help with:
    http://www.freeforum101.com/iworktipsntrick/index.php?mforum=iworktipsntrick
    Is a good resource.
    Peter

  • I bought a used macbook pro from a friend. Software updates are available, but when I try to update, the computer asks for apple id and will only accept the former owner´s. How can I connect my macbook to my apple id?

    I bought a used macbook pro from a friend. Software updates are available, but when I try to update, the computer asks for apple id and will only accept the former owner´s. How can I connect my macbook to my apple id?

    The first thing you should do after acquiring a used computer is to erase the internal drive and install a clean copy of OS X. How you do that depends on the model. Look it up on this page to see what version was originally installed.
    If the machine shipped with OS X 10.4 or 10.5, you need a boxed and shrink-wrapped retail Snow Leopard installation disc, which you can get from the Apple Store or a reputable reseller — not from eBay or anything of the kind.
    If the machine shipped with OS X 10.6, you need the gray installation discs that came with it. If you don't have the discs, order replacements from Apple. A retail disc, or the gray discs from another model, will not work.
    To boot from an optical disc, insert it, then reboot and hold down the C key at the startup chime. Release the key when you see the gray Apple logo on the screen.
    If the machine shipped with OS X 10.7 or later, it should boot into Internet Recovery mode when you hold down the key combination option-command-R at the startup chime. Release the keys when you see a spinning globe.
    Once booted from the disc or in Internet Recovery, launch Disk Utility and select the icon of the internal drive — not any of the volume icons nested beneath it. In the Partition tab, select the default options: a GUID partition table with one data volume in Mac OS Extended (Journaled) format. This operation will permanently remove all existing data on the drive, which is what you should do.
    After partitioning, quit Disk Utility and run the OS X Installer. When the installation is done, the system will automatically reboot into the Setup Assistant, which will prompt you to transfer the data from another Mac, its backups, or from a Windows computer. If you have any data to transfer, this is usually the best time to do it.
    You should then run Software Update and install all available system updates from Apple. If you want to upgrade to a major version of OS X newer than 10.6, buy it from the Mac App Store. Note that you can't keep an upgraded version that was installed by the previous owner. He or she can't legally transfer it to you, and without the Apple ID you won't be able to update it in Software Update or reinstall, if that becomes necessary. The same goes for any App Store products that the previous owner installed — you have to repurchase them.

  • The guide to bootcamp assistant states that bootcamp can only be installed on a drive with a single partition. New Macs with Lion preinstalled have two partitions - the second is a recovery partition.  How do I install Bootcamp?

    Late in August 2011 I took delivery of a new 27" iMac with Lion preinstalled.  I need to run Windows as well. Following Apple's written suggestion, I printed off the then current 12 pages of the document "Bootcamp Installation & Setup Guide" which clearly stated that the hard drive you were going to install on had to have on it, before install, a maximum of one partition.  Using finder and disk utility I determined that there was only one partition.  Unbeknownst to me, there was (is) an additional hidden (from those two pieces of software) partition on the disk.  As of machines delivered new with Lion preinstalled, Apple has begun to include a "recovery partition".  In that partition there is a copy of the software necessary to reinstall Lion via a download from the Apple App Store.  Not knowing the partition was there, I cranked up  "Bootcamp Assistant" which nicely offered to repartition my hard drive creating a "Bootcamp Partition" in addition to the existing.  I told it how big to make each and hit the do it button, subsequently destroying my operating system.  Oh, it very nicely told me, after the damage was done, how many partitions were REALLY on the disk and that I could not install Bootcamp cause there were too many partitions.
    Luckily the the Recovery Partition, which at that point I knew existed, was not harmed and after doing some research on another compter, I used it to once again download Lion from the App Store and reinstall. So, I have recovered but am still stuck with the problem:  how do I install Bootcamp in this new environment?

    First you need to seriously back up your Mac.
    A clone is an exact duplicate of your existing Mac HDD. Merely copying and pasting a drive will not make a bootable backup. In case of problems you can boot from an Ext HDD clone and use the utilities to repair, reformat, or clone the Ext HDD back to the internal Mac HDD.  While Time machine back ups are easy you can not boot from it. The best thing to have for any kind of problem is a bootable clone backup on an external drive. Some even have two external backup drives in case one fails. There are two good apps for cloning named SuperDuper and Carbon Copy Cloner.
    In dealing with the recovery partition a simple approach is to clone the Mac partition to an external disk then re-partition the Mac to a single partition (GUID partition table) . Then clone the external disk clone back to the Mac. You will now have only one Partition and Boot Camp assistant sould not object.
    Some have recommended getting rid of the recovery partition while others have advised not to do this. If you have the Lion USB Thumb Drive you do not need a recovery partition so can discard it without concern. There is another way to get rid of the recovery partition if you decide to do it but first be sure to have a backup of your Mac ( I know I sound like a nagging mom but many dead computers have been saved by this simple precaution).
    Use Disk Utility.
    1) Make the Recovery visible in Disk Utility by using a program like Secrets:http://www.macupdate.com/app/mac/27025/secrets or MacPilot:http://www.koingosw.com/products/macpilot.php (15 day free trial).
    2) Highlite the Recovery partition and Control click it and select Mount the partition.
    3) With the Recovery partition highlited, erase the partition, you'll get an error message, ignore it.
    4) Now highlite the top identity of the hard drive and select the partition tab.
    5) Highlite the Recovery partition and press the minus sign.
    6) Click and hold on the bottom edge of the partition above and drag it to the bottom, if it doesn't go there automatically, the press apply.

  • Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the rows? Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the records?
    Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    The Oracle documentation has a good overview of the options available
    Generating XML Data from the Database
    Without knowing your version, I just picked 11.2, so you made need to look for that chapter in the documentation for your version to find applicable information.
    You can also find some information in XML DB FAQ

  • I have an IMAP mailbox that seems to only show mail 7 days old on my iMac running Snow Leopard.However, all old emails that I have not deleted are showing up on my macbook pro running the next OS (Lion?).  How do I get all my old emails back on my iMac?

    I have an IMAP mailbox that seems to only show mail 7 days on my iMac running Snow Leopard.  However, on my MacBook Pro I can see all old mail that I have not deleted.  It is running the next operating system (Lion?).  Does anyone know how I can get all my old mail back on my iMac.  It is my primary computer and I need some of those old messages.  I have tried to rebuild the mailbox but it has not done anything.

    I have tried to rebuild the mailbox to no avail.  The mailbox behavior says:  Drafts (not checked) store draft messages on the server, Notes (checked) show not in Inbox, Sent (checked) Store sent messages on the server Delete sent messages when (option never selected), Junt (not checked) store junk messages on the server Delete junk messages when (option never selected), Trash (checked) moves deleted messages to the Trash mailbox and (checked)  store deleted messages on the server Permanently erase deleted messages when (one month old option selected).
    I have not set up any rules that I know of other than a signature, in the very least I have not changed any.

  • I am trying to sync my ipod but it keeps saying that a previous library exists and that I can only sync it to one library.  I want to sync it to the previous library but how do I get it to go there?

    I am trying to sync my ipod but it keeps saying that a previous library exists and that I can only sync to one library.  I want to sync it to the original library bc that is the one that has all songs.  It keeps giving me a library with just songs that I have bought on itunes.  I never created a new library so I am not sure why it is doing this.  How do I get it to sync to my original library?  I have already tried to restore a previous version of itunes but that did not help.

    It appears that something happened to yur computer/iTunes files.  It happens sometimes.  To recovery:
    - Import the old music into the current iTunes library
    - Make sure all the apps are also in the library
    - If in the USA and therplaces where iCloud has benn released you can redownload most iTunes puchases by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    - You can always redownload apps at no additional cost as long as you are singned into the same iTunes account the originally purchased them.
    - After all the suff in in the iTunes library, make a backup of the iPod by connecting the iPod to the computer and right clicking on the iPOd under Devices in iTunes. 
    - Restore the iPod from backup and restore as necessary.

Maybe you are looking for