Results 1 to 8 of 8
Thread: JTextArea problem
- 03-20-2012, 11:39 PM #1
Senior Member
- Join Date
- Nov 2011
- Posts
- 116
- Rep Power
- 0
- 03-20-2012, 11:50 PM #2
Re: JTextArea problem
Moved from New to Java.
To get better help sooner, post a SSCCE (Short, Self Contained, Compilable and Executable) example that demonstrates the problem. Not all your code.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 03-20-2012, 11:59 PM #3
Senior Member
- Join Date
- Nov 2011
- Posts
- 116
- Rep Power
- 0
Re: JTextArea problem
Ok. I've got a class called Dvd which has only one instance field String 'title'. I've then got another class called DvdFileHandler which has methods to push String elements (DVD title's) onto a Stack list and also to push String elements off the top Stack, and then a list method to return the Stack (contains dvd title String titles).
In my GUI, a third class, I have all components which I need and layed out, which I need to show here. Here is the code to try and list the contents of the Stack from the DvdFileHandler class:
ThanksJava Code:dvds = dvdHandler.list(); for(int i=0; i<dvds.size(); i++) { jList.setText(jList.getText()+""+dvds.get(i)+ "\n"); }
- 03-21-2012, 12:03 AM #4
Re: JTextArea problem
When you're offered a link to a web resource, we expect you to go through it. No SSCCE, no help -- not because we won't but because we can't.
But. Do you really have a variable jList that refers to a JTextArea? That's a bad choice.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 03-21-2012, 12:07 AM #5
Senior Member
- Join Date
- Nov 2011
- Posts
- 116
- Rep Power
- 0
Re: JTextArea problem
Yes I did go through it, its NOT all the code, its just a snipped of code. Rather than giving me links, I'd like you to explain what you want me to do, in order for you to provide me some help.
And yes, why shall I change the variable name to area or some other related name? Does that even matter to the post I started here?
- 03-21-2012, 12:25 AM #6
Re: JTextArea problem
And is that what the web page describes as an SSCCE?
I already did.
Using meaningful variable names is good programming practice. Considering that a commonly used class exists named JList, using the variable name jList for a JTextArea is a bad choice. And no, a variable name doesn't make a difference how the code executes. Why should it?
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 03-21-2012, 12:33 AM #7
Senior Member
- Join Date
- Nov 2011
- Posts
- 116
- Rep Power
- 0
Re: JTextArea problem
Ok fair enough. I've seen other posts that you have replied on, and they have posted their full entire code, but your giving out to me on one small snipped of code?
All Id like to know is, can you understand my concept of the problem in terms of the way I am trying to list the contents of Stack elements?
Thanks.
- 03-21-2012, 12:38 AM #8
Similar Threads
-
Problem in JtextArea
By justbeller in forum AWT / SwingReplies: 11Last Post: 07-25-2011, 09:20 AM -
JTextArea resizing problem
By me.anchit in forum AWT / SwingReplies: 5Last Post: 07-24-2011, 02:01 PM -
Problem in JTextArea
By justbeller in forum AWT / SwingReplies: 6Last Post: 02-15-2011, 03:02 PM -
Problem with JTEXTAREA
By javanew in forum New To JavaReplies: 6Last Post: 05-07-2010, 02:14 PM -
JTextArea problem
By javanew in forum AWT / SwingReplies: 2Last Post: 05-04-2010, 10:31 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks