Hi Alex,
At the moment I do have to use AWT. I quess from your answer that I can't do
what
I want. I did read a piece over at javaworld that that basically says I can do
this if I
want to use a Dialog. I don't like the ideal of issuing another window just to
close
the window. Thanks for yout time.
By the way for those interested in the article.
http://www.javaworld.com/javatips
its tip number 69 for AWT and tip number 72 for JFC
Wayne
Alex M. wrote:
> Do you have to use AWT frames? If you use a swing frame, you can use a
> glass pane to do what you are trying to do.
>
> On Wed, 20 Oct 1999, Wayne wrote:
>
> > Hello,
> > I'm close, but no cigar. I'm still trying to get a frame to accept key
> > events.
> > In file TestCntrl.java I have -
> >
> > import java.awt.* ;
> > import java.awt.event.* ;
> >
> > public class TestCntrl extends TestFrame
> > {
> > public static void main(String arg[])
> > {
> > new TestCntrl ().setVisible(true) ;
> > }
> >
> > public TestCntrl ()
> > {
> > ToolKit theToolKit = this.getToolkit () ;
> > Dimension outScreenSize = theToolKit.getScreenSize () ;
> >
> > this.setBounds (ourScreenSize.width/1, ourScreenSize.height/1,
> > ourScreenSize.width/2, (int)
> > (ourScreenSize.height * .8)) ;
> >
> > // When I add the button it doesn't work!
> >
> > Button myButton = new Button("TEST") ;
> > add(myButton) ;
> > }
> > }
> >
> >
> > In the file TestFrame.java
> >
> > import java.awt.* ;
> > import java.awt.event.* ;
> >
> > public class TestFrame extends Frame
> > {
> > public TestFrame ()
> > {
> > enableEvents (QWTEvent.KEY_EVENT_MASK) ;
> > }
> >
> > public void processKeyEvent (KeyEvent e)
> > {
> > super.processKeyEvent (e) ;
> > System.out.println("Print key code" + e.getKeyCode()) ;
> > }
> > }
> >
> > Can someone tell me why this doesn't when I have the button. Also how
> > can I get
> > this to work without putting a handler on the button?
> >
> > TIA
> > Wayne
> >
> >
> > ----------------------------------------------------------------------
> > To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
> >
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]