Solved

Insert picture on frame and different color on textarea

Posted on 2000-05-09
2
350 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
[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
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

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…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

691 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