• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTextArea, outlining the area?  RSS feed

 
Davy Kelly
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey everyone,

is there any methods I can use to oultine a JTextArea or JTextField?

davy
 
Campbell Ritchie
Marshal
Posts: 56562
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you looked in the API for JTextArea to see whether it has any methods allowing you to set a border?
 
Davy Kelly
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, been at it all day.

davy
 
Paul Clapham
Sheriff
Posts: 22832
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It shouldn't take all day. Use the "search" feature of your browser (Control-F) and look for the word "border".
 
Davy Kelly
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am starting to find this place elitest.....

sorry but when I started using this forum people helped, not condescend.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Davy Kelly:
I am starting to find this place elitest.....

sorry but when I started using this forum people helped, not condescend.


We're all here to learn, so when responding to others, please focus on helping them discover their own solutions, instead of simply providing answers.


I think that's exactly what Paul and Campbell did.
 
Davy Kelly
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A hint does not go astray, does it?

and comments like it shouldn't take all day does not help
does it?

sometimes the API is not as easy to understand.
[ March 02, 2007: Message edited by: Davy Kelly ]
 
Paul Clapham
Sheriff
Posts: 22832
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, to tell you the truth I was surprised when you said you had been looking at the API documentation for JTextArea all day and couldn't find any methods for setting a border. So I thought perhaps you didn't know how to search it effectively. Hence the suggestion.

But perhaps I guessed wrong about what you had been doing all day? (And I don't know what time it is where you are.) If so, sorry about that. Perhaps you can clarify?
 
Davy Kelly
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I am not on this thing 100% of the day, I have other things to do, but I was at it for hours, not just looking at the JTextArea for borders but for other classes to provide the answer.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think anyone was being rude or condescending here, but I apologize on behalf of the Ranch for making you feel this way. We try to make sure people are being nice -- but as has already been pointed out, "nice' means helping people learn, and not always just handing out free answers.

In any case, JTextArea, like the other Swing components, has a method named "setBorder()". If you had searched the JTextArea Javadoc page for the word "border", you would have found it. Did you actually do this?
 
Davy Kelly
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did do a search, found the setBorder() method, but implementing it was proving a problem.

I think I will chose my words more carefully in future on how I ask questions.

just to let you all know, when I am trying to code something, I do search the API, I ask after I have been at it for at least 3 hours, cause I am trying to figure the answer out myself, testing and trying out different code.

Sometimes a point in the right direction helps grately.

davy
 
Campbell Ritchie
Marshal
Posts: 56562
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry to have appeared rude.

You will have to find the Border interface (I think it is in java.awt) and try one of its subclasses as an argument to setBorder().
I have tried it myself only a couple of minutes ago.
It is also worth your while exploring the javax.swing.BorderFactory class.
 
Paul Clapham
Sheriff
Posts: 22832
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Campbell Ritchie:
You will have to find the Border interface (I think it is in java.awt)
In javax.swing.border actually.

My track through the API documentation would have been something like this:

1. Go to JTextArea.
2. Track down the setBorder method.
3. What's a "Border" anyway?
4. Follow the link to the API docs for Border.
5. Notice the link to a tutorial named "How to Use Borders".

But yes, it does take practice to navigate the documentation successfully.
 
Davy Kelly
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks campbell,

i got it.

have another problem now, but will look into more tomorrow

thanks
 
Campbell Ritchie
Marshal
Posts: 56562
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pleased to see you have got it working.



CR
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!