Solved

Create an image out of a graphics source

Posted on 1998-01-06
1
180 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

932 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now