Solved

Create an image out of a graphics source

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

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…
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

707 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

18 Experts available now in Live!

Get 1:1 Help Now