Solved

Create an image out of a graphics source

Posted on 1998-01-06
1
183 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
egit plugin on eclipse 8 102
servlet and mdb, jms error 1 57
learn programming 8 72
Given a github repo find email address of all collaborators in that repo 1 36
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
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.

730 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