[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Insert picture on frame and different color on textarea

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
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 …
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

650 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