Text « Icon Image « Java Swing Q&A





1. Java- Write Text onto Image, then Write to Output File    stackoverflow.com

I have an image on top of which I would like to write text that has multiple lines, is center-aligned, and dynamic (variable width). I've tried using the drawString method from ...

2. How to change text in a image(.gif file) through Java    coderanch.com

I am displaying an image ie .gif file in my java application. There is a button in my java application.When I click button, I wants to change a text in my gif file.For example,a text "Welcome" is dislaying in gif file when i am running java application,when I am clicking button,I wants to change text from "Welcome" to "Welcome to Java's ...

4. Text to Image to File    coderanch.com

Sorry guys if I am posting it in the wrong forum. I am trying to convert a text value (String) to an image (.jpg). My program seems to be working somewhat. It's creating a blank (whiite background) .jpg file, without my string value "Saidul Islam". I can open the file in any image editor. it just doesn't have the string I ...

6. how to type text on an image    coderanch.com

import java.awt.*; import java.awt.event.*; import java.awt.font.*; import java.awt.image.BufferedImage; import java.io.*; import java.net.*; import java.util.*; import java.util.List; import javax.imageio.ImageIO; import javax .swing.*; public class ImageText extends JApplet { public void init() { ImageTextPanel itPanel = new ImageTextPanel(); ImageEditor editor = new ImageEditor(itPanel); itPanel.addMouseListener(editor); setLayout(new BorderLayout()); add(new JScrollPane(itPanel)); add(editor.getEditPanel(), "South"); } public static void main(String[] args) { JApplet applet = new ImageText(); JFrame ...

8. Center text on an image    coderanch.com

// Graphics g, x is some ImageObserver, Y is some border you may want FontMetrics metrics = g.getFontMetrics(); int width = metrics.stringWidth("the string you want to print"); if (width < image.getWidth(x) - 2 * Y) { // just use drawString; you can use metrics.getHeight() to determine how high a line would be } else { // trim somehow, use metrics.stringWidth(...) and ...

9. Text boxes over an image    coderanch.com

Hi guys, just wondering if it is possible to have an image and to use text boxes to label different areas of the picture? Where the items are labeled is where I would like to put the boxes so I could type in the answer myself for testing purposes. I have attached the jpg. This is the code I have so ...