Solved

Create an image out of a graphics source

Posted on 1998-01-06
1
182 Views
Last Modified: 2006-11-17
I want to write a string (with a font) to an offscreen graphic and then create out of this an image object for further usage. The way to get the graphics from an image seems easy to me. But how works it the other way round?
Help would be appreciated very much!!
0
Comment
Question by:mwaber
1 Comment
 
LVL 6

Accepted Solution

by:
jpk041897 earned 100 total points
ID: 1231997
If you create a derived Canvas, you can use the:

java.awt.Graphics.drawString()  

method to write your strings into your image inside an overide of the paint method. I.e.:

     public void paint(Graphics g)
          {
          ...
             g.drawString("Your Text", x, y);
          ...
          }

Another alternative, albeit more complex could be to use the clipboard.

0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
replace a word with other 1 44
egit plugin on eclipse 8 62
tomcat administrtor 12 46
tomcat startup error 5 59
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question