aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Drawing text inside rectangles Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Drawing text inside rectangles" Watch "Drawing text inside rectangles" New topic
Author

Drawing text inside rectangles

Andrei Zeus
Greenhorn

Joined: Oct 26, 2010
Posts: 1
I have this task. I need to create rectangles and lines aand to put text inside the rectangle(comment box). I managed to cread rectangles and lines i can put text inside but the text is not displaying when i chancge the button(e.g i want to draw another rectangle
after i created a comment box). I worked with JTextArea and seem to be stacked.
First i dont know where is the problem. because i dont know how to do it.
Maybe you didnt understand my problem. I dont know how to do that and dont know where is the problem.
I tried to do it like this
when i put the mouse down , at mouseDown i did something like this:
I create my own class rectanglet everything is working but text, because when i click on the trectangle the text area doesnt display all , just a small part and after i enter some text it appears aand the rest but when i tried to change the button because i have buttons for every draw(rectangle , line, clear_all and text) the text dissapears. First i want to know how to save the text and draw it every time i change the shape.
More if i try to delete all the shapes including the JTextArea the textarea reamins there.
Declration variables and stuff



And the paint function




MouseDown event


in the next mouse event
mouseUp i tried to save it in a vector




The problem is that i dont know how to do to remain on the screen, i think is maybe in the paint function.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4664
    
    5

Andrei, welcome to the Ranch! Please BeForthrightWhenCrossPostingToOtherSites
http://www.javaprogrammingforums.com/awt-java-swing/5746-drawing-rectangles-lines.html

edit And the recommendation to post an SSCCE still holds good.


luck, db
There are no new questions, but there may be new answers.
Kevin Workman
Ranch Hand

Joined: Sep 28, 2010
Posts: 151
Like I said in the other thread: You've been told what you need to do to get help. That's going to be the case no matter where you go, unless you're paying for a professional tutor. Whether or not you're willing to put forth that effort is up to you.

"No matter where you go" means that even on other forums, you're going to have to post an SSCCE and ask a specific question. Read the SSCCE link. It tells you what to do. Or don't, and don't get help. It's really up to you.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19781
    
  20

Although he puts it a bit harshly, Kevin is quite right. If you don't provide us information (and especially with GUI programs, an SSCCE is often required information) we cannot help you. To solve strange behaviour we must often see strange behaviour ourselves.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Kevin Workman
Ranch Hand

Joined: Sep 28, 2010
Posts: 151
And the only reason I stated anything the least bit harshly was because I tried so many times in the other thread to coax an SSCCE or a specific question out, only to have the OP call it quits and jump to another forum even after I told him the SSCCE/question requirement would be true everywhere. Hmph.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Drawing text inside rectangles