Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: JTextField character limit

  1. #1
    Junior Member
    Join Date
    May 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default JTextField character limit

    Hello!

    I need some help! I'm currently working on a Brew Calculator for home use. It is connected to MySql so I can enter in recipe, update, and delete them. I also have a tab that I use for the calculations. My problem that I am having is that my calculations are inserted into JtextField's, but the format is being a pain. I want it to show doubles like nn.nn. It will show nn.nnnnnnn and so on. I am using Eclipse (Indigo) and WindowBuilder. I will attach my app so you can see how I am doing this. I have two classes. The WumpBrewingCalculator has majority of my code and where my GUI and Database commands are. The second class for the calculator tab and it contains all the calculations which is called by the WumpBrewingCalculator class under the "calculate" button. I am just unsure how to edit the JTextFields. I have researched before posting and many people suggest JFormattedTextField but I can not find an example that is trying to do what I am doing. Thanks for the help! WumpBrewingCalculatorTest.zip


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: JTextField character limit

    I want it to show doubles like nn.nn
    Look at the DecimalFormat class.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. file upload size limit
    By shiv@P in forum JavaServer Pages: JSP & JSTL
    Replies: 2
    Last Post: December 24th, 2012, 10:50 PM
  2. How do i limit the input time
    By itayj in forum Java Theory & Questions
    Replies: 6
    Last Post: October 24th, 2011, 03:47 PM
  3. set time limit on running of a thread
    By z.zojaji in forum Threads
    Replies: 3
    Last Post: July 10th, 2010, 10:57 AM
  4. The character '' is an invalid XML character exception getting
    By sumanta in forum What's Wrong With My Code?
    Replies: 5
    Last Post: January 9th, 2010, 11:13 AM