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 3 of 3

Thread: Can't figure out JTextArea. Please Help!

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

    Default Can't figure out JTextArea. Please Help!

    I'm at wits end. First of all, I'm a beginner and am really struggling with this. I'm at the very end of my assignment and am supposed to append the output.

    My code looks like this-

    do {
    strcost=JOptionPane.showInputDialog("Enter cost (>0) :");
    cost=Integer.parseInt(strcost);
    }while(cost<=0);//end of 1st do statement


    do {
    strresidual=JOptionPane.showInputDialog("Enter residual value(>0and<cost):");
    residual=Integer.parseInt(strresidual);
    }while(residual<=0||residual>cost);//end of 2nd do statement



    do {
    struseful_life=JOptionPane.showInputDialog("Enter useful life (>0): ");
    useful_life=Integer.parseInt(strresidual);
    }while(useful_life<0);//end of 3rd do statement






    //Decimal Format
    DecimalFormat precisionTwo = new DecimalFormat("0.00");
    JTextArea outputTextArea= new JTextArea(7,55);


    JTextArea txtArea = new JTextArea("JTextArea example ", 10,34);


    outputTextArea.append("\t\t" + "Depreciation Schedule" );



    for (int x=1;x<=useful_life;x++)
    {
    year_dep=dep_cost/useful_life;
    accum_dep+=year_dep;
    carry_val=cost-accum_dep;



    JTextArea txtArea1 = new JTextArea("JTextArea example ", 10,34);
    outputTextArea.append(x+"\t"+cost);
    }



    How can I get this to show? Thanks in advance.


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Can't figure out JTextArea. Please Help!

    You have to add it to a window (a JFrame or a JDialog).
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    Nov 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Can't figure out JTextArea. Please Help!

    I see. thanks. I will try and research that.

Similar Threads

  1. JTextArea customization
    By Bagzli in forum AWT / Java Swing
    Replies: 2
    Last Post: April 23rd, 2012, 08:08 AM
  2. [SOLVED] println() for JTextArea
    By KILL3RTACO in forum AWT / Java Swing
    Replies: 4
    Last Post: November 28th, 2011, 06:15 PM
  3. JTextArea Problem
    By grimx in forum What's Wrong With My Code?
    Replies: 3
    Last Post: March 10th, 2011, 07:13 PM
  4. How would you get a JTextArea to know how many lines it had?
    By javapenguin in forum What's Wrong With My Code?
    Replies: 1
    Last Post: January 20th, 2011, 07:58 PM
  5. Expanding JTextArea
    By The_Mexican in forum What's Wrong With My Code?
    Replies: 10
    Last Post: November 27th, 2010, 10:15 PM