?
Solved

Insert picture on frame and different color on textarea

Posted on 2000-05-09
2
Medium Priority
?
354 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 60 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses
Course of the Month10 days, 23 hours left to enroll

770 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