• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

could someone look at my code and help me with a JScrollPane in a JTextPane please?

 
Sebastion Hill
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I am trying to get a JScrollPane going vertically in my JTextPane but I am having no luck at this. Is my gridbaglayout the reason why my scrollpane fails to work? :-/

Could someone offer any help or suggestions for fixing this and understanding what is going on?

 
Sebastion Hill
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
actually, I am slow ... I don't know how I missed the tutorial for this ... bout to check it out now (hopefully i can figure it out on my own first)

Update! Reading is fundamental ... i think i solved my problem ... is there a way to delete this thread? so it doesn't take up space?
 
Campbell Ritchie
Sheriff
Pie
Posts: 49841
70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have difficulties with anything like that in Swing, always try a tiny application which simply does one thing. Then you can sort out one problem at a time. It was really difficult to try your app, particularly since the Activity class was missing, but eventually I found you aren't adding "scrollPane" to your panel anywhere . . .

Look at Cai Horstmann's website; there is a class called GBC which makes GridBag much easier to use.

We usually discuss this sort of thing on the Swing forum, so I shall move you there.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49841
70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sebastion Hill wrote:is there a way to delete this thread?
We don't delete threads, unless there is "something wrong with them." The discussion might be useful for somebody else in future. Also you may get other helpful opinions after you think the problem has been finished with.
 
Sebastion Hill
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Campbell, about to look at Cai Horstmann's website for the class you mentioned. Also, sounds good that you all keep the threads for others. Just FYI, the link I forgot to read for this was: http://java.sun.com/docs/books/tutorial/uiswing/components/scrollpane.html

Also, sorry about not putting ALL of my code up for people to try out ... here it is, late (sorry). Btw, is my ActivityTab clas proper use of OO programming?





 
Campbell Ritchie
Sheriff
Pie
Posts: 49841
70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have only had a 5-second look at your Activity class, but it looks mostly right to me. If you are doing something, and call it an Activity, with those attributes, then that is the sort of class you would want. You should consider overriding the equals() hashCode() and toString() methods. You should also consider whether the number you are returning adds anything to the boolean values about importance and urgency, and whether it is necessary at all.
Thank you for posting the code, but often an abbreviated application which reproduces the problem (called SCCEE or something like that) (more details here, with correct spelling!) is much easier to read.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic