Results 1 to 5 of 5
  1. #1
    ashin is offline Member
    Join Date
    Nov 2008
    Posts
    71
    Rep Power
    0

    Default Automatic convert to uppercase in keyevents

    hi guys,, anyone could help me about keyevents? when the user type a letter from the keyboard without capslock.. it can automatically convert to upper case or big letter thank you.:p
    :cool:

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,196
    Rep Power
    19

    Default

    Use a DocumentFilter. Override insertString(...) and replace(...) to invoke the super implementation with the String parameter converted toUpperCase()

    db

  3. #3
    ashin is offline Member
    Join Date
    Nov 2008
    Posts
    71
    Rep Power
    0

    Default

    thank you but i dont get it.. can u use some example? tnx:)
    :cool:

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,196
    Rep Power
    19

  5. #5
    ashin is offline Member
    Join Date
    Nov 2008
    Posts
    71
    Rep Power
    0

    Default

    thank you for your effort Darryl.. i already solved it.. so i used the addverifylistener ... this is my code:

    Java Code:
    final Text txtSubjCode = new Text(group,SWT.BORDER);
    	txtSubjCode.setBounds(130,80,200,25);
    	txtSubjCode.setText(SubjectCode);
    	txtSubjCode.addVerifyListener(new VerifyListener(){
    		public void verifyText(VerifyEvent event){
    		[I]ValidationCode val = new ValidationCode(); 
    		val.ValidateLetterOrDigit(event, txtSubjCode.getText());[/I]
    		[B]event.text =event.text.toUpperCase();[/B]
    		}
    	});
    the bold text is the one i needed. then the italicize text is a class. :)
    tnx tnx.. :D
    :cool:

Similar Threads

  1. uppercase and lowercase please help
    By cuziwow in forum New To Java
    Replies: 4
    Last Post: 04-11-2010, 07:54 AM
  2. Need Help for this problem Uppercase.
    By ezered in forum New To Java
    Replies: 5
    Last Post: 12-04-2009, 12:05 AM
  3. Question about java keyevents?
    By Godsent in forum AWT / Swing
    Replies: 2
    Last Post: 10-26-2009, 09:38 PM
  4. UpperCase problem
    By logieen in forum New To Java
    Replies: 1
    Last Post: 08-03-2008, 11:26 PM
  5. String uppercase/lowercase
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-19-2007, 09:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •