• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 364
  • Last Modified:

Insert picture on frame and different color on textarea

1. I want to insert picture on Frame in Java aplication about *.jpg ,*.gif . How can I use method for this?
2. In textarea I want  text has different color for example ,first row has red color
and second row has green color
1 Solution
i have answer to ur first question

import java.awt.*;
import java.io.*;

public class drawImage extends Frame  
      private Image img;
      public drawImage()
            img = Toolkit.getDefaultToolkit().getImage("Baby News Bkgrd.gif");//replace the name of gif with the one u have...
      public void paint(Graphics g)
      public static void main(String s[])
            new drawImage();
The answer to your 2nd question is that it is impossible.
The possible solutions are implementing your own TextArea or using either JEditorPane or JTextPane...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now