How can I perform validation of String withing TableCell to get red outline

I have two columns in a JTable, one is defined to be an Integer and one as a String, when they edit the Integer field add enter an non-integral value the DefaultCellEditor outlines the cell in red and prevents them leaving the cell until they have either entered a valid value or cancel the operation (by pressing 'Esc' on Windows).
Where is this behaviour I cant find it in the Java source code, I want to replicate it for a String to do the same thing if the String does not match a regular expression. I have tried subclassing DefaultCellEditor, and and passing an InputVerifier to the text component used to in the construction of the editor degate, but this has had no effect. I also tried overiding stopCellEditing() this had the effect of preventing leaving the cell until they have entered a correct value, but it does not outline it in red
public class ExcelRefCellEditor extends DefaultCellEditor
    public ExcelRefCellEditor(JTextField textfield)
        //@TODO seems to have no effect
        super(textfield);
        textfield.setInputVerifier(new ExcelRefInputVerifier());       
    public boolean stopCellEditing()
        if(!AQExcelRef.isValidForm((String)delegate.getCellEditorValue()))
            return false;
        else
            return delegate.stopCellEditing();
class ExcelRefInputVerifier extends InputVerifier
    public boolean verify(JComponent input)
        return AQExcelRef.isValidForm(((JTextField)input).getText());
class AQExcelRef implements Serializable
    public static boolean isValidForm(String cellRef)
        return cellRef.matches("[A-Z]+[1-9]+");
tc.setCellEditor(new ExcelRefCellEditor(new JTextField()));

Thanks that works perfectly
But I would be interested to know how it it is done for Integer columns as I cant find any code to do this in the DefaultCellEditor, and I took a quick look at the plaf packages and suns internal packages as well.

Similar Messages

  • How Can I replace newScale Text Strings with Custom Values?

    How Can I replace newScale Text Strings with Custom Values?
    How can I replace newScale text strings with custom values?
    All  newScale text is customizable. Follow the procedure below to change the  value of any text string that appears in RequestCenter online pages.
    Procedure
    1. Find out the String ID of the text string you would like to overwrite by turning on the String ID display:
    a) Navigate to the RequestCenter.ear/config directory.
    b) Open the newscale.properties file and add the following name-value pair at the end of the file:res.format=2
    c) Save the file.
    d) Repeat steps b and c for the RmiConfig.prop and RequestCenter.prop files.
    e) Stop and restart the RequestCenter service.
    f) Log  in to RequestCenter and browse to the page that has the text you want  to overwrite. In front of the text you will now see the String ID.
    g) Note down the String ID's you want to change.
    2. Navigate to the directory: /RequestCenter.ear/RequestCenter.war/WEB-INF/classes/com/newscale/bfw.
    3. Create the following sub-directory: res/resources
    4. Create the following empty text files in the directory you just created:
    RequestCenter_0.properties
    RequestCenter_1.properties
    RequestCenter_2.properties
    RequestCenter_3.properties
    RequestCenter_4.properties
    RequestCenter_5.properties
    RequestCenter_6.properties
    RequestCenter_7.properties
    5. Add the custom text strings to the appropriate  RequestCenter_<Number>.properties file in the following manner  (name-value pair) StringID=YourCustomTextString
    Example: The StringID for "Available Work" in ServiceManager is 699.
    If you wanted to change "Available Work" to "General Inbox", you  would add the following line to the RequestCenter_0.properties file
         699=General Inbox
    Strings are divided into the following files, based on their numeric ID:
    Strings are divided into the following files, based on their numeric ID:
    String ID  File Name
    0 to 999 -> RequestCenter_0.properties
    1000 to 1999 -> RequestCenter_1.properties
    2000 to 2999 -> RequestCenter_2.properties
    3000 to 3999 -> RequestCenter_3.properties
    4000 to 4999 -> RequestCenter_4.properties
    5000 to 5999 -> RequestCenter_5.properties
    6000 to 6999 -> RequestCenter_6.properties
    7000 to 7999 -> RequestCenter_7.properties
    6. Turn off the String ID display by removing (or commenting out) the line "res.format=2" from the newscale.properties, RequestCenter.prop and RmiConfig.prop files
    7. Restart RequestCenter.
    Your customized text should be displayed.

    I've recently come across this information and it was very helpful in changing some of the inline text.
    However, one place that seemed out of reach with this method was the three main buttons on an "Order" page.  Specifically the "Add & Review Order" button was confusing some of our users.
    Through the use of JavaScript we were able to modify the label of this button.  We placed JS in the footer.html file that changes the value of the butt

  • I am using i 4 phone. recently I had a problem with my lap top and had formatted hard disk of it. Now I want to use sync data in my iphone back to itune n my lap top. how can I perform this task with out loosing data in my i phone.

    I am using i 4 phone. recently I had a problem with my lap top and had formatted hard disk of it. Now I want to sync data in my iphone back to itune on my lap top. how can I perform this task with out loosing data in my i phone.

    Hey floridiansue,
    Do you have an installed email program such as Microsoft Outlook?  If your email is through an online login, such as Gmail, etc, then one will have to create an email association with a program such as Microsoft Outlook on the PC for this Scan to Email system to function.
    -------------How do I give Kudos? | How do I mark a post as Solved? --------------------------------------------------------
    I am not an HP employee.

  • I have about 10000 images of different persons with dimension of 640*480. I wan to crop face from these images to dimension of 200*280. The location of face varies in differnt pics. So, please let me know step by step how can I perform this using the Ligh

    I have about 10000 images of different persons with dimension of 640*480. I wan to crop face from these images to dimension of 200*280. The location of face varies in differnt pics. So, please let me know step by step how can I perform this using the Lightroom software. Also I wan to know what should be the aspect ratio to do so.Thank you in advance

    The aspect ratio should be set to 200x280, or equivalently 5x7.
    I don't think it is possible to do the cropping automatically in Lightroom, you'd have to do this image by image to crop the faces correctly.

  • HT2518 I migrated from a PC to a Mac Book Pro.  The contacts transferred over to the Mac along with many contacts that I had deleted sometime ago. Also some contacts did not transfer at all.  How can I perform a correct and up to date migration of my cont

    I migrated from a PC to a Mac Book Pro.  The contacts transferred over to the Mac along with many contacts that I had deleted sometime ago.  Also some contacts did not transfer at all. How can I perform a correct and up to date migration of my contacts? 

    well no reply from the community. sniff- do i stink!? - probably a little bit. If i have lost all that data then I'm gonna really really pong.
    Any ways i have purchased a 1tb usb HDD and have managed to duplicate the dmg file onto it. however still unable to mount the **** thing. so now i have ordered disk warrior which will be in my possession tomorrow.
    fingers toes eyes crossed.

  • How can I perform this kind of range join query using DPL?

    How can I perform this kind of range join query using DPL?
    SELECT * from t where 1<=t.a<=2 and 3<=t.b<=5
    In this pdf : http://www.oracle.com/technology/products/berkeley-db/pdf/performing%20queries%20in%20oracle%20berkeley%20db%20java%20edition.pdf,
    It shows how to perform "Two equality-conditions query on a single primary database" just like SELECT * FROM tab WHERE col1 = A AND col2 = B using entity join class, but it does not give a solution about the range join query.

    I'm sorry, I think I've misled you. I suggested that you perform two queries and then take the intersection of the results. You could do this, but the solution to your query is much simpler. I'll correct my previous message.
    Your query is very simple to implement. You should perform the first part of query to get a cursor on the index for 'a' for the "1<=t.a<=2" part. Then simply iterate over that cursor, and process the entities where the "3<=t.b<=5" expression is true. You don't need a second index (on 'b') or another cursor.
    This is called "filtering" because you're iterating through entities that you obtain from one index, and selecting some entities for processing and discarding others. The white paper you mentioned has an example of filtering in combination with the use of an index.
    An alternative is to reverse the procedure above: use the index for 'b' to get a cursor for the "3<=t.b<=5" part of the query, then iterate and filter the results based on the "1<=t.a<=2" expression.
    If you're concerned about efficiency, you can choose the index (i.e., choose which of these two alternatives to implement) based on which part of the query you believe will return the smallest number of results. The less entities read, the faster the query.
    Contrary to what I said earlier, taking the intersection of two queries that are ANDed doesn't make sense -- filtering is the better solution. However, taking the union of two queries does make sense, when the queries are ORed. Sorry for the confusion.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How can I choose mySQL(4/5) with my mother tongue display fine?

    if I choose mySQL(
    3) in CF
    8 administrator > Data & Services > Data Sources
    and add the code
    "useUnicode=true&characterEncoding=euc-kr" in Connection
    String,
    it displays my mother tongue fine.
    if I choose mySQL(
    4/5) in CF
    8 administrator > Data & Services > Data Sources,
    I can't add the code
    ""useUnicode=true&characterEncoding=euc-kr" in Connection
    String
    because it causes Connection verification failed for data
    source.
    If I choose mySQL(
    4/5) in CF
    8 administrator > Data & Services > Data Sources,
    and not to add the code
    "useUnicode=true&characterEncoding=euc-kr" in Connection
    String,
    It displays my mother tongue broekn.
    How can I choose mySQL(4/5) with my mother tongue display
    fine?

    in MySQL the correct name for your encoding is euckr (note:
    no dash)
    reference: mysql manual chapter 10.9
    change your connection string to:
    useUnicode=true&characterEncoding=euckr
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com

  • How can i filter just te equipment with date to 31129999 ??

    Hi ,
    How can i filter just te equipment with dateto 31129999 ??  i need just the valid equipment with dateto 31129999 but this char i cant take it to filter, how can i do this?

    In the Update tab of the InfoPackage, you can select the Time-Dependent data. In this, if you only want to extract Equipment Master Data Attributes or Master Data Text for effectivity dates of current date through 31-Dec-9999, you can create a routine for the time interval by updating it as such:
      CONSTANTS: c_max_date TYPE d VALUE '99991231'.
      p_datefrom = sy-datum. "Current Date
      p_dateto   = c_max_date. "Max Date

  • How can I recover my old account with a new one?

    Hi, my hotmail account it was hacked, I can't have acces to my adobe account anymore.
    How can I get acces to my old account with a new Adobe ID?
    I'm already subscribed to creative cloud and I can't have acces to my account and upgrade my products.
    what can I do?
    Thanks

    Thanks Romshina
    I read the link you send me and thanks, but the thing is that I still can't get into my Adobe Id, because when I try they ask me to reset my password in an email they will send me to my old account and there is the problem, because I don't have acces to that old acount, [email protected]
    now this is my new email, because the las one it was hacked and I just can't get back to it.
    So I would like to have access to my account and update this new email account, to have acces to my CC account.
    Thanks
    Date: Fri, 27 Dec 2013 06:51:15 -0800
    From: [email protected]
    To: <Removed by Moderator>
    Subject: Re: How can I recover my old account with a new one? How can I recover my old account with a new one?
        Re: How can I recover my old account with a new one?
        created by Romsinha in Adobe Creative Cloud - View the full discussion
    Hi Guillermo Castellanos,
    Please refer the knowledge base article: http://helpx.adobe.com/x-productkb/policy-pricing/account-password-sig n-faq.html.
    Regards,
    Romit Sinha
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5959347#5959347
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: Re: How can I recover my old account with a new one?
    To unsubscribe from this thread, please visit the message page at Re: How can I recover my old account with a new one?. In the Actions box on the right, click the Stop Email Notifications link.
               Start a new discussion in Adobe Creative Cloud at Adobe Community
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0.

  • How can we view the data asociated with Request ID

    Hi All,
    I have data loaded in an ODS there are multiple files loaded in this ODS. Now i want to view data for a perticuler request OR i want to know how can we know the data associated with a perticular request.
    Please help me out.
    Thanks & Regards
    Amit Kumar

    Copy the request number (not request ID) from the ODS manage screen, Goto RSRQ give the request number and execute. it shows the monitor screen- now goto PSA from the top and check the data. But this possible only if you are loading data to PSA also along with ODS.
    Otherwise, Goto Display Data of ODS from the right click on it -- in the selection screen give the Request ID that you want to check the data. Then it displays only that request data.
    Hope this helps.
    Veerendra.
    Edited by: denduluri veerendra kumar on Dec 1, 2009 12:40 PM
    Edited by: denduluri veerendra kumar on Dec 1, 2009 12:43 PM

  • How can I use my Apple ID with 2 Apple devices?

    I just got an ipad mini and I registered it with the same Apple ID I use for my iphone 4s. Everything was fine until I downloaded apps to the ipad and noticed that the ones I had on both devices  no longer opened on my iphone. Why is this? How can I use my Apple ID with 2 Apple devices and how can I recover my apps on my iphone?

    I've had an iPad for almost two years. When I purchased an iPhone last fall I set it up to use the same Apple ID as my iPhone. I've had no problems doing this. Try resetting each device and see what happens.
    First thing to try is to reset your device. Press and hold the Home and Sleep buttons simultaneously ignoring the red slider should one appear until the Apple logo appears. Let go of the buttons and let the device restart. See if that fixes your problem.

  • How can i use my apple ID with the itune store over my windows laptop

    how can i use my apple ID with the itune store over my windows laptop

    If you don't have iTunes installed on your laptop then you can download and install it from here : http://www.apple.com/itunes/download/
    You can then log into your account on it via the Store > Sign In menu option (on iTunes 11 on a PC you can get the menus to show via control-B) :
    And you can then select the Store on the left-hand sidebar (you can enable the sidebar via control-S), and then browse items in the store and buy them by clickin on their price.

  • I am new to IPAD and I want o use facetime, how can I use it to communicate with my mac at home, do I need to create another account with a different email account

    I am new to IPAD and I want o use facetime, how can I use it to communicate with my mac at home, do I need to create another account with a different email account

    do I need to create another account with a different email account
    Yes, the email addresses need to be unique to each device. You may use the same Apple ID on each device, but the email address used by each device needs to be different.

  • How can I use my time capsule with windows7

    How can I use my time capsule with windows7?

    This is asked regularly.
    https://discussions.apple.com/message/10978060#10978060
    Look at the more like this. On the right column next to the post.
    Load airport utility for windows.. which will also load bonjour for windows.
    In windows explorer type \\TCname or \\TCipaddress (replacing with the actual values.. names with spaces will give you trouble so change all names in the TC to SMB compatible or actual ip address).

  • How to restore my ipad?My ipad say on screen CONNECT TO ITUNE.How can i do when i connect with computer.It is need itune new version.Can you sent me.I will be waiting your answer.Please help me sir.

    How to restore my ipad?My ipad say on screen CONNECT TO ITUNE.How can i do when i connect with computer.It is need itune new version.Can you sent me.I will be waiting your answer.Please help me sir.

    Check for Updates.
    http://i1224.photobucket.com/albums/ee374/Diavonex/Album%208/78d42b19fa42e8d83b5 5a65e1333373f_zpsf58bbe10.jpg

Maybe you are looking for