S
SimonSimon
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");
}
}
}
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");
}
}
}