Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2006

Tip: Looking for answers? Try searching our database.

How to change image?

Thread view: 
SimonSimon - 04 May 2006 11:39 GMT
Hello, I am learning Java and I have a question :)

In the panorama applet I draw an image into the screen. Image is in
variable "pano", which is loaded on the beginning. If I click on the
right place on the image, method show_window from applet "target"
should load new image into variable "pano" and the whole picture should
change. But in my case it does not change. Do you know what shoult I do
to change and display image in the variable "pano"?

I hope it is clear enough :)

public class panorama extends Applet
{
   public static panorama selfRef = null;
   public Image pano;

   public void init()
   {
    selfRef = this;
       String s1 = getParameter("panorama");
    loadImage(s1);
   }

   public void loadImage(String mainPicture)
   {
    pano = getImage(getCodeBase(), mainPicture);
   }

   public void paint(Graphics g)
   {
       width = pano.getWidth(this);
        /*
        ...
        */
   }
}

public class target extends JApplet
{
   String file;

   public void show_window(Applet applet)
   {
   if (file.equals("Train.jpg"))
   {
       panorama panoramaApplet = null;
       panoramaApplet = panorama.selfRef;
       panoramaApplet.loadImage("Train.jpg");
   }
   }
}
SimonSimon - 04 May 2006 11:42 GMT
yeah, some of the code is missing, but this should be enough to
represent my problem
Andrew T. - 05 May 2006 04:25 GMT
> yeah, some of the code is missing, but this should be enough to
> represent my problem

MouseListener

Andrew T.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.