• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Requesting focus on a minimised Frame

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have got three buttons in my applet, upon clicking the buttons it will open new frame. Now what I want is even for the second if the same button is clicked, instead of opening the new frame, I should show the already opened frame for that button to appear as the top level active frame on the screen.
I used frame.toFront(), frame.requestFocus() methods which worked fine as long as the frame is not minimised. When the frame is minimised I couldn't make it appear as the top level active frame on the screen.
I tried frame.setState( Frame.NORMAL ) and then frame.requestFocus() methods, which actually worked, but unfortunately the setState() method is NOT supported by IE and Netscape 4.73 (becoz those supports only JDK 1.1). But it worked in Netscape 6 (as it supports JDK1.3).
Now I want to know is there any equivalent method for setState(int ) in JDK1.1 or how to handle this situtation. I have to use JDK1.1 and AWT only and moreover I am working this in applet.
Thanks in advance.
Regards,
Jayakumar
--------------------------------------------
Thanks for your reply Kavitha Adimurthy, but as I said, I tried the show() and is not working.
[This message has been edited by Jayakumar Gopalan (edited February 19, 2001).]
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi JayaKumar,
try this: It will open the minimized frame/dialog the second time you click on the same button
public class Example
{ private AnotherFrame aFrame;
private JButton button1 = new JButton("Open AnotherFrame object");
public void actionPerformed(ActionEvent e)
{ if((e.getSource()).equals(button1))
{ if(aFrame == null) // first initialization
aFrame = new AnotherFrame();
// add your logic here
aFrame.show();
}
}
}

Originally posted by Jayakumar Gopalan:
I have got three buttons in my applet, upon clicking the buttons it will open new frame. Now what I want is even for the second if the same button is clicked, instead of opening the new frame, I should show the already opened frame for that button to appear as the top level active frame on the screen.
I used frame.toFront(), frame.requestFocus() methods which worked fine as long as the frame is not minimised. When the frame is minimised I couldn't make it appear as the top level active frame on the screen.
I tried frame.setState( Frame.NORMAL ) and then frame.requestFocus() methods, which actually worked, but unfortunately the setState() method is supported by IE and Netscape 4.73 (becoz those supports only JDK 1.1). But it worked in Netscape 6 (as it supports JDK1.3).
Now I want to know is there any equivalent method for setState(int ) in JDK1.1 or how to handle this situtation.
Thanks in advance.
Regards,
Jayakumar


 
reply
    Bookmark Topic Watch Topic
  • New Topic