srihari badam
Image on frame
0 Answer(s)      3 months and 17 days ago
Posted in : Java Beginners

Hi,

This is my code. In this I am unable to load the image.I want to know the problem with this code.

import java.awt.*;
import java.awt.event.*;
public class AwtImg extends Frame
{
    Image img;
    public static void main(String args[])
    {
        AwtImg ai=new AwtImg();
    }
    AwtImg()
    {
        super("Image Frame");
        MediaTracker mt=new MediaTracker(this);
        img=Toolkit.getDefaultToolkit().getImage("swamiji.jpeg");
        mt.addImage(img,0);
        setSize(400,400);
        setVisible(true);
        addWindowListener(new WindowAdapter(){
          public void windowClosing(WindowEvent we){
          dispose();
          }
       });
      }
         public void update(Graphics g){
  paint(g);
  }

  public void paint(Graphics g){
  if(img != null)
  g.drawImage(img, 100, 100, this);
  else
  g.clearRect(0, 0, getSize().width, getSize().height);
  }

}

Thank You

srihari

View Answers









Related Pages:
Image on frame
Image on frame   Hi, This is my code. In this I am unable to load... java.awt.event.*; public class AwtImg extends Frame { Image img; public...(); } AwtImg() { super("Image Frame"); MediaTracker mt=new
how to set a image in frame? - Swing AWT
how to set a image in frame?  how to set a image in frame using swing
Frame query
Frame query  Hi, I am working on Images in java. I have two JFrame displaying same image. We shall call it outerFrame and innerFrame.In innerFrame i am rotating the image.After all the rotations i need to display this image
Image on Frame in Java AWT
Image on Frame in Java AWT     ... on the frame. This program shows you how to display image in your application... the image on the frame in your application. These are explained below :  main
Creating a Frame
; Setting the Icon for a Frame    Showing a Dialog Box  ... an Icon to a JButton Component    Making a Frame Non-Resizable    Removing the Title Bar of a Frame   
FRAME
FRAME  WHILE I'M RUNNINGFILE OF A GUI PROGRAMME(JDBC CONNECTION) INSTEAD OF OUTPUT FRAME ONLY TWO BLANK FRAMES ARE GETTING DISPLAYD... CAN ANYONE HELP ME TO SOLVE DS PROBLEM
FRAME
FRAME  WHILE I'M RUNNINGFILE OF A GUI PROGRAMME(JDBC CONNECTION) INSTEAD OF OUTPUT FRAME ONLY TWO BLANK FRAMES ARE GETTING DISPLAYD... CAN ANYONE HELP ME TO SOLVE DS PROBLEM
frame
frame  how to creat a frame in java   Hi Friend, Try the following code: import java.awt.*; import javax.swing.*; import java.awt.event.*; class RetrieveDataFromTextFields{ public static void main(String[] args
How to design a frame of the picture.
How to design a frame of the picture.       This is a picture frame example, it will help you to make a picture frame easily because it has some simple steps. If you want
Struts 2 imagae set to frame.
Struts 2 imagae set to frame.  I could not set image to frame...:image src="%{src}" width="150" height="200"/> File Name : <s:property... this: <img:image src=%{src} width="150" height="200"/>, i could
Removing the Title Bar of a Frame
. Following  is the image of the frame without title bar: Code Description... Removing the Title Bar of a Frame   ... bar of a frame or window in java. That means show the frame or window without
Setting the Icon for the frame in Java
the icon of the frame. This program is the detailed illustration to set the icon to the frame. Toolkit class has been used to get the image and then the image... Setting the Icon for the frame in Java   
Setting an Icon for a Frame in Java
an icon for the frame in Java Swing. This program helps us to set the icon (image... for the frame or window after getting the image using the Image class method named... Setting an Icon for a Frame in Java   
Iconifying and Maximizing a frame in Java
will be in the minimized form. Following is the image of the frame which has... Iconifying and Maximizing a frame in Java   ... and maximizing a frame in java. Iconifying means to show a frame in minimized
Paint an Image
; This section provides you to paint an image on the frame. Paint means draw an image and set its on the frame to the specified location according to its x...*; public class PaintIcon extends Frame{   Image image
how to call a frame having threading concept
how to call a frame having threading concept   i hav a frame having buttton on it .on click event of the button ,i want to call another frame which... of that frame ,frame is displaying but no other content. that frame contains
Image Demo
Image Demo       This section simply display the image demo that means multiple images and its name are based on the frame to a particular location. For displaying images demo
inserting image into database
inserting image into database  how to insert image into database using struts frame work and spring JDBC
frame update another frame.
frame update another frame.   How do I make a link or form in one frame update another frame
Image Size
. For setting an image on the frame, you will need an image that have to be added...;class ImageSize extends Frame{   Image image;  ... Image Size      
AWT Image
, 110, 100, 20); } public static void main(String s[]) { final JFrame frame
one frame update another frame
one frame update another frame  How do I make a link or form in one frame update another frame
Get Image
Get Image       This Example shows you get the image. Description of the code.... Toolkit.getImage() : getImage method return a Image class object and this object get
panel and frame
panel and frame  What is the difference between panel and frame
Java Frame
Java Frame  What is the difference between a Window and a Frame
image effects - Java Beginners
image effects  hey can u help me in loadin an image file... that will show you image crop effect: import java.sql.*; import java.awt.... java.awt.image.FilteredImageSource; public class Upload extends JPanel { BufferedImage image; Image img
billing frame
billing frame  how to generate billing frame using swing which contain sr. no, name of product, quantity, price & total
Display Image in Java
it on a frame using ImageIO class. User enters the name of the image using the command prompt and then the program displays the same image on the frame... are passing the boolean value as true to display the image on the frame
frame generation
frame generation  Hi I wnat to genarate one frame with two tabs working ,production..and I want two radiobuttons sector ,others in the frames..based on the tab selection I want to clikc the radio button..when i ckick the radio
Image Selection - Swing AWT
Image Selection  Hi, I need to provide the image selection facility... click on any item, the image of that item should be selected as done in windows...; JButton saveButton; public DisplayImage() { super("Image Selection program
Regarding Image in Swings
Regarding Image in Swings  Hi, I have some requireemnt like when i click on the button in frame,it wil display the image.....plz do the needful.............   import java.awt.*; import java.io.*; import javax.swing.
image
image  how to add the image in servlet code
Image
Image  how to insert image in xsl without using xml. the image was displayed in pdf..Please help me
Image
Image  how to insert image in xsl without using xml. the image was displayed in pdf..Please help me
Image
Image  how to insert image in xsl without using xml. the image was displayed in pdf..Please help me
Set Transparent Background Image
to your frame or other components by setting the transparent background image on the frame. Here we are going to give the transparent effect to the image...Set Transparent Background Image Swing components not only allow you to change
insert image in JFrame - Development process
insert image in JFrame  how to insert a image in JFrame.please... Panel { BufferedImage image; public ShowImage() { try { System.out.println("Enter image name\n"); BufferedReader bf=new BufferedReader(new
UIButton Image Size
UIButton Image Size In this example we are going to discuss about how to set image size and setting image as a UIButton background. We are doing...:UIButtonTypeCustom]; myButton.frame = CGRectMake(80, 50, 70, 70); //set frame
upload image and fields.....fields is id name.....
upload image and fields.....fields is id name.....  Hi this is sreenu my problam is capcharing data to the servler thi is my frame Id: Name: browse:Image are file
upload image and fields.....fields is id name.....
upload image and fields.....fields is id name.....  Get Data using Java Servlet The frame takes following input.. Id: Name: browse:Image are file
displaying image in awt - Java Beginners
ImagePanel("D:/Sunset.jpeg"); JFrame frame = new JFrame("Image Frame...displaying image in awt  Hi All, I have downloaded the code to display image using awt from here and when I execute the code I am getting
how to create frame in swings
how to create frame in swings  how to create frame in swings
collection frame work
collection frame work  explain all the concept in collection frame work
Get Image Size Example
Get Image Size Example       This Example shows you get the image size... the default toolkit. Toolkit.getImage() : getImage method return a Image
setbackground image to JFrame - Java Beginners
setbackground image to JFrame   how to setbackground image to JFrame... TransparentBackgroundImage { public static void main(String[] args) { JFrame frame = new... GridLayout(2,2)){ ImageIcon image = new ImageIcon( "C:/rose.jpg
Compute the image processing - Java Beginners
Compute the image processing  Hi, Question 1: I have some... code here to find the averaging of the image (grey image) also, How do i compute... the subtraction of the image using hte g(x,y) = |f1(x,y) - f2(x,y) How do i change
link to other frame - Applet
link to other frame  how a button to open to another frame? and the frame can keyin the data and it can show at the previous frame
collection frame work
collection frame work  explain the hierarchy of one dimensional collection frame work classes
collection frame work
collection frame work  could you please tell me detail the concept of collection frame work

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.