Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

java menu workin with frames

  Asked By: Abbie    Date: Apr 01    Category: Java    Views: 747
  

how can i get my java menu to change pages inside my frameset. at the
moment when i click on the buttons on my applet it just loads another
screen and my frames disappear. i just want to change a page inside a
frame and leave my menu alone.

heres some of my code at the moment:

public void actionPerformed(ActionEvent e) {
if(e.getSource() instanceof KornButton)
System.out.println("KornButton = " +
e.getActionCommand());
try {
if(e.getActionCommand() == "Home") {
URL galleryURL = new URL
("www.an-enigma.freeserve.co.uk//charmedGallery.html");
clip1.play();
this.getAppletContext
().showDocument(galleryURL);
}
if(e.getActionCommand() == "News") {
URL mythURL = new URL
("www.an-enigma.freeserve.co.uk//...edMythology.html");
clip3.play();
this.getAppletContext
().showDocument(mythURL);
}

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Lewis Welch     Answered On: Apr 01

There is a version of the showDocument() method which takes the URL and the
target. If one of your frames  matches the
target then that may change  the frame's page  (it has been a while since I have
used this, but I recall it working that
way.)

 
Answer #2    Answered By: Mike Stephens     Answered On: Apr 01

I had this same issue not too long ago..

From your Actionlistner implement this code...

try{
getAppletContext().showDocument(new URL(u),"main");
}catch
(MalformedURLException d)
{
System.out.println(String.valueOf(d));}

"u" is the URL of the page  you want in your frame and "main" is the
frame's name...give that a try

 
Didn't find what you were looking for? Find more on java menu workin with frames Or get search suggestion and latest updates.




Tagged: