java-awt

java-awt

View Answers

August 23, 2008 at 12:00 PM

hai frnd....
"\" is a special character...
i think u must use "\\" whereever u want "\"
try using this......
img = Toolkit.getDefaultToolkit().getImage("C:\\Documents and Settings\\gayathri\\My Documents\\My Pictures\\photo\\Image010.jpg");


or


img = Toolkit.getDefaultToolkit().getImage("C://Documents and Settings//gayathri//My Documents//My Pictures//photo//Image010.jpg");
hope it work..
thanks and regards

Prashu
[email protected]

August 27, 2008 at 4:16 PM

Hi friend,

i am sending code.

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.JFrame;


public class ImageDisplayTest {
public static void main(String[] args) {
ImagePanel panel = new ImagePanel(new ImageIcon("/home/vinod/amarexamples/cat.gif").getImage());
JFrame frame = new JFrame();
frame.getContentPane().add(panel);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(300,400);
frame.setVisible(true);
}
}

class ImagePanel extends JPanel {

private Image img;
public ImagePanel(String img) {
this(new ImageIcon(img).getImage());
}
public ImagePanel(Image img) {
this.img = img;

}

public void paintComponent(Graphics g) {
g.drawImage(img, 0, 0, null);
}

}

------------------------------------

Read for more information,

http://www.roseindia.net/java/


Thanks.









Related Tutorials/Questions & Answers:
JAVA AWT BASE PROJECT
JAVA AWT BASE PROJECT  suggest meaningful java AWT-base project
java awt calender
java awt calender  java awt code for calender to include beside a textfield
Advertisements
Java AWT event hierarchy
Java AWT event hierarchy  What class is the top of the AWT event hierarchy?  The java.awt.AWTEvent class is the highest-level class in the AWT event-class hierarchy
java awt components - Java Beginners
java awt components  how to make the the button being active at a time..? ie two or more buttons gets activated by click at a time
java awt package tutorial
Java AWT Package In Java, Abstract Window Toolkit(AWT) is a platform independent widget toolkit for windowing, graphics, and user-interface. As the Java programming language, the AWT is also platform-independent. A common set
Create a Container in Java awt
Create a Container in Java awt       Introduction This program illustrates you how to create a container. Container contains several control or tools for develop your
Java AWT
Java AWT  How can the Checkbox class be used to create a radio button
Java AWT
Java AWT  What interface is extended by AWT event listeners
Java AWT
Java AWT  What is the relationship between the Canvas class and the Graphics class
Java AWT
Java AWT  What is meant by controls and what are different types of controls in AWT
Event handling in Java AWT
Event handling in Java AWT     ... events in java awt. Here, this is done through the java.awt.*; package of java. Events are the integral part of the java platform. You can see the concepts
how to include a session class in java awt code - JavaMail
how to include a session class in java awt code  Hi... i have been developing a mini online shopping tool using java awt and websphere MQ as middleware technology.. Iam facing problem in handling MQ calls ...so i need
java-awt - Java Beginners
java-awt  how to include picture stored on my machine to a java frame? when i tried to include the path of the file it is showing error. i have... information, http://www.roseindia.net/java/ Thanks
Java AWT Components
Java AWT Components      ... components available in the Java AWT package for developing user interface for your program. Following some components of Java AWT are explained : ADS
Java AWT Package Example
Java AWT Package Example       In this section you will learn about the AWT package of the Java... as Abstract Window Toolkit (AWT).   What is AWT in java
Image on Frame in Java AWT
Image on Frame in Java AWT       Introduction In this section, you will learn how to display image on the frame. This program shows you how to display image in your application
Different types of event in Java AWT
Different types of event in Java AWT   ... in Java AWT. These are as follows :  ActionEvent AdjustmentEvent... that are generated by your AWT Application. These events are used to make the application more
Create a Frame in Java
in java AWT package. The frame in java works like the main window where your components (controls) are added to develop a application. In the Java AWT, top-level... in Java AWT. Here are more examples: What is AWT in Java
What is AWT in java
What is AWT in java In this Example we will describe awt in java. The awt in java stands for Abstract Windowing Toolkit and is a package... in java full tutorials We have described Interface and Description of AWT Package
How to Create Button on Frame
; frame the topic of Java AWT package. In the section, from the generated output... a command button on the Java Awt Frame. There is a program for the best
Choice Option (Combo) In Java
by using Java AWT package. Here, you will see in the output of the program... Choice Option (Combo) In Java     ... of constructing a drop down list in java by using java awt.ADS_TO_REPLACE_1
How to handle the text using Key Listener Interface
How to handle the text using Key Listener Interface       In this section, you will learn how to handle the text using the key events on the Java Awt component. All the key events
Radio Button In Java
on the frame. The java AWT , top-level window, are represent by the CheckBoxGroup... for the procedure of inserting checkbox group on the Java AWT frame. Program... Radio Button In Java      
Hiding Frame in Java
Hiding Frame in Java       Introduction This section illustrates you how to hide the Java Awt frame... argument is true then the form object will be visible. By default Java Awt Form
Java AWT Package Example
How to Create Circle In Java
How to Create Circle In Java       Introduction: This is a simple program of java awt. In this section, you will learn how to create Circle Diagram. The java circle is the most
BorderLayout Example In java
BorderLayout in java awt package. The Border Layout is arranging and resizing components to set in five position which is used in this program. The java program uses... BorderLayout Example In java     
Image Size
; This Java awt (Abstract Windowing Toolkit) tutorial describes about the image size... exact implementation of awt. The various components are bounded by subclass...:\vinod\awt1>javac ImageSize.java C:\vinod\awt1>java ImageSize
Arcs Drawing In Java
Arcs Drawing In Java       Introduction: In this section, you will learn how to create arcs diagram in java awt package. The Java program uses Arcs2D class, arcs2D is the abstract
Events
Events       In this section, you will learn how to handle events in Java awt. Events are the integral part of the java platform. You can see the concepts related to the event
java
java  what is procedure to run client and server in java(awt
drop down
drop down  how can i add data from choice/dropdown component of java awt to myaql table
caleder
caleder   what is the simple code for a calender beside a textfield using java awt concept
awt
Java AWT Applet example  how to display data using JDBC in awt/applet
java
java  how we can create the purches order by using the java awt
java
java  how we can create purches order format by using the java awt
java
java  how we can create purches order format by using the java awt
java
java  how we can create purches order format by using the java awt
for management system
for management system  i need to store some data and to display the stored data and again to modify the data that have been stored and also with either java swing or java awt in format of similar to tat of form
SWINGS - Swing AWT
more information,Examples and Tutorials on Swing,AWT visit to : http://www.roseindia.net/java/example/java/awt/ http://www.roseindia.net/java/example/java
java compilation error - Applet
java compilation error  hi friends the following is the awt front design program error, give me the replay E:\ramesh>javac...://www.roseindia.net/java/example/java/awt/ Thanks
Animation
links: http://www.roseindia.net/java/example/java/awt/AnimationLine.shtml http://www.roseindia.net/java/example/java/swing/graphics2D/bouncing-thread.shtml
abt proj - Java Beginners
to start java project using swings  Hi Friend, Learn awt, swing... http://www.roseindia.net/java/example/java/awt/ http://www.roseindia.net/java/example/java/swing/ Above links will be helpful for you. Thanks
Simple Form in Java
; This is a simple program of java awt package which constructs a look like... text boxes and command button have been created on the Java Awt Frame...: This is the class of Java Awt package that is used for creating a container. Label
square - Java Beginners
: http://www.roseindia.net/java/example/java/awt/ Thanks...square  what is the java code to display the shape of "square"?  Hi friend, Code to display the shape of "square" import
Swing - Java Beginners
/example/java/awt/ Hope that it will be helpful for you. Thanks... links: http://www.grandt.com/sbe/ http://www.javafaq.nu/java/free-swing-book/ http://www.freebookcentre.net/JavaTech/Free-Java-Gui-books-download.html You
Java KeyAdapter
. To know more about this, just click http:/www.roseindia.net/java/example/java/awt... Java KeyAdapter       This is an abstract adapter class used to receive keyboard events
How to create CheckBox On frame
will learn how to create CheckBox on the frame. In the Java AWT, top-level windows... with the full description. If you are fresher in java awt programming then you... for the procedure of inserting checkboxes on the Java AWT Frame. You can understand very easily
Disable of Combo - JSP-Servlet
://www.roseindia.net/jsp/comboSelect.shtml http://www.roseindia.net/java/example/java/awt/choice-option-in-java.shtml Thanks
java swings - JavaMail
/java/example/java/awt/borderlayout-example-in-java.shtml http://www.roseindia.net...java swings  Hi sir,i am doing a project on swings,i don't have any...://www.roseindia.net/java/example/java/swing/GrideComponents.shtml http

Ads