[nbusers] Re: Can't get text to display in JTextArea.

  • From: "Jeffrey H. Coffield" < >
  • To:
  • Subject: [nbusers] Re: Can't get text to display in JTextArea.
  • Date: Sun, 28 Oct 2012 08:14:55 -0700


On 10/26/2012 06:30 PM, RwGWiccan wrote:
Trying this for a class. I am using the newest IDE and cannot get the text to 
show up in the JTextArea of the JFrame. the code is as follows:

...

public class DVDInv5UI extends javax.swing.JFrame {
         private JTextArea txt;
1. remove the previous line

...
      */
     public void displayDVD() {
         txt.setEditable(false);
                txt.setText("DVD Details:\n");
                txt.append("Item number: " + inv.get(currentDisplay).getdvdNumber() + 
"\n");
                txt.append("DVD name: " + inv.get(currentDisplay).getdvdName() + 
"\n");
                txt.append("Units in stock: " + inv.get(currentDisplay).getQuantity() + 
"\n");
                txt.append("Price: $" + 
String.format("%.2f",inv.get(currentDisplay).getPrice()) + "\n");
                txt.append("Total value: $" + 
String.format("%.2f",inv.get(currentDisplay).getInventoryValue()) + "\n");
                txt.append("Fee: $" + 
String.format("%.2f",inv.get(currentDisplay).getInventoryValue()*0.05) + "\n\n");
        
                txt.append("Total value: $" + 
String.format("%.2f",inv.value()));
}
...

2. In this section, change all "txt" to "jTextArea1"

3. To conform with naming conventions, getdvdNumber should be getDvdNumber and getdvdName should be getDvdName.


Jeff Coffield
www.digitalsynergyinc.com



[nbusers] Can't get text to display in JTextArea.

RwGWiccan 10/27/2012

[nbusers] Re: Can't get text to display in JTextArea.

Jeffrey H. Coffield 10/28/2012

[nbusers] Re: Can't get text to display in JTextArea.

Bayless Kirtley 10/28/2012

[nbusers] Can't get text to display in JTextArea.

RwGWiccan 10/29/2012

Project Features

About this Project

www was started in November 2009, is owned by jpirek, and has 21 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close