Latest Tutorials| Questions and Answers|Ask Questions?|Site Map




Have Programming Question? Ask it here!
 
 
 


srihari badam
Image on frame
0 Answer(s)      a year and 2 months 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


Advertisement
View Answers

Related Tutorials/Questions & Answers:
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
Advertisements
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
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
frame update another frame.
frame update another frame.   How do I make a link or form in one frame update another frame
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
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
one frame update another frame
one frame update another frame  How do I make a link or form in one frame update another frame
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
billing frame
billing frame  how to generate billing frame using swing which contain sr. no, name of product, quantity, price & total
image
image  how to add the image in servlet code
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
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
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
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   
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
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      
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
single frame coding in java
single frame coding in java  sir, i am a beginner in java.i want to do a desktop application in java in which a single frame satisfies all needs.but i want changes in that frame only.how can i solve this?i think multiple frames
Cross frame menus - Ajax
Cross frame menus  Respected Sir/Madam, I am Ragavendran.R.. I need to implement DHTML Cross frame menus..i.e There must be a page with 2 frames(top and bottom).. The main menus must be in the top frame and when I
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   
Frame with JDBC - JDBC
Frame with JDBC  What is the Frame in JDBC?  Hello,What is the structure of table and in which format you wan't to display the data.Last time also you posted the same question.Answer me the above question and I
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
Dialog Frame focus - Framework
Dialog Frame focus  Is it possible somehow to focus/activate/select... visit the parent frame also. But on some event(like a button), I want my dialog frame to be focussed/active.(Here i dont want to reopen it. As it is already opened
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   
jumping frame jFrame to jInternalframe
jumping frame jFrame to jInternalframe  Afternoon sir, I want to ask something code like jumping frame. example this i have form Login , Menu...) , and in employee(jinternal Frame) have nik(jTexkfield1), name(jtextfield2
swing frame problem
swing frame problem  Hi All, I m creating a swing/awt based window... a frame which have few buttons and Text Box to get some data from user at this time when I will click on submit button then next frame should be open with in same
hibernat frame work
hibernat frame work  what is the deployment structure for 'hibernete.cfg.xml','contact.hbm.xml','Contact.java','FirstExample.java' programs into eclipse ide   Have a look at the following link: Hibernate Tutorial
Frame with JDBC - JDBC
Frame with JDBC   i am using frame having two textfield so how i retrieve the data from the ms-access there is two columns name and salary   Hi,Do you want to display the data on JSP Page?If yes then following tutorial
inserting image into database
inserting image into database  how to insert image into database using struts frame work and spring JDBC
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
spring MVC frame work - Spring
spring MVC frame work  Example of spring MVC frame work
another frame by using awt or swings
another frame by using awt or swings  how to connect one frame to another frame by using awt or swings
Frame works - Framework
Frame works  I need tutorials on JAVA Plugin Frameworks and hibernate and springs ? I new to these Technologies so i need with Examples to understand Using above technologies i need to do project. so ASAP pls
zend2 frame work
zend2 frame work  Hi can you please detail about Zend framework 2 latest folder structure and related things in details . I already seen zend website am confused with two old and new folder structures which one has to use
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
call frame - Java Beginners
call frame   dear java, I want to ask something about call frame to another frame and back to first frame. I have FrameA and FrameB. In frameA... String PAINT_ICON = "paint_icon"; //true if the next frame created should
How to make frame of the picture, make frame of the picture, frame of the picture
How to make frame of the picture       This is about a frame example that has been made by some steps, I have mention here all the steps to make this effect. Take picture: First
Creating a Frame
Creating a Frame : Swing Tutorials       This program shows you how to create a frame in Java Swing Application. The frame in java works like the main window where your components
Helps with combo box and frame
on add button another frame pop up with text field(name ,address etc..) ,confirm button and cancel button at bottom of the frame. When i put something...() { return TelephoneNumber; } public AddressList(){ JFrame frame
Advertisements
 

 

 

DMCA.com