Solved

Insert picture on frame and different color on textarea

Posted on 2000-05-09
2
314 Views
Last Modified: 2008-02-01
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
0
Comment
Question by:Arsari
2 Comments
 
LVL 3

Accepted Solution

by:
rjackman earned 30 total points
ID: 2791843
i have answer to ur first question

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

public class drawImage extends Frame  
{
      private Image img;
      public drawImage()
      {
            this.setSize(600,600);
            img = Toolkit.getDefaultToolkit().getImage("Baby News Bkgrd.gif");//replace the name of gif with the one u have...
            this.setVisible(true);
      }
      public void paint(Graphics g)
      {
            g.drawImage(img,0,10,this);
      }
      public static void main(String s[])
      {
            new drawImage();
      }
}
0
 
LVL 7

Expert Comment

by:Sasha_Mapa
ID: 2791959
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...
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
copyEndy  challenge 15 58
pairstar challenge 2 42
endX challenge 2 50
strCopies  challenge 17 74
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…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

746 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

13 Experts available now in Live!

Get 1:1 Help Now