File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem on drawing on panel

 
dhirajsrivastava
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
Can any one tell me how can i use draw string on panel
thanks in advance
Dhiraj
 
shweta agarwal
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Text rending is sone using drawString method in Graphics class as:
void drawString( String str, int i, int j)
this draws the string str with i,j as the coordinates of the baseline of the first character in the string.
the above method can be used in conjunction with the getGraphics() method of the component class to solve your problem.
 
Rahul Mahindrakar
Ranch Hand
Posts: 1868
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"dhirajsrivastava"
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
Thanks.
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Put the code that shweta showed in the paint() method of the Panel ( you would probably want to sub-class Panel and make a MyPanel class that draws the string).

[This message has been edited by Cindy Glass (edited October 09, 2001).]
 
dhirajsrivastava
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
I will try and then reply
thanks to both shweta and cindy
dhiraj
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic