Advertisement

[java] Does AWT work with Frames

Started by December 15, 2000 10:55 AM
2 comments, last by rockslave 24 years, 1 month ago
I''m still learning and I don''t know. If I use frames with the same functions I would use for applets, like add(), action, mouseDown, etc, will it work? Thanks, Arthur(rockslave)
import money.*;#include "cas.h"uses bucks;
yes, but you just have to add to do this (in the constructor):

  import java.awt.*;import java.awt.event.*;public class SomeApp extends Frame {   public SomeApp() {       Container c = this.getContentPane();       //do this when you want to add() buttons and such       c.add(new Button("some button name"));       //init the window        addWindowListener(new WindowAdapter() {         public void windowClosing( WindowEvent e){            System.exit( 0 );         }       });       setSize(width,height);//replace vars with vals...       show();   }   //other code ...   public static void main(String args[]) {       new SomeApp();   }}  


so, that''s it. Hope this helped.
JP



==============================================
I feel like a kid in some kind of store...
==============================================
www.thejpsystem.com
==============================================I feel like a kid in some kind of store... ============================================== www.thejpsystem.com
Advertisement
Thanks a lot, loser(why did you choose such an ID?). It helped much. I hope soon I''ll get a Java tutorial in my page(I''m still learning to drink it), but there''s a HTML tutorial there in www.come.to/rockslave. Well, anyway, who wants to learn HTML, everyone knows already!
import money.*;#include "cas.h"uses bucks;
The link was broken, I forgot the http:// stuff.
http://www.come.to/rockslave

Thanks, Arthur(rockslave)
import money.*;#include "cas.h"uses bucks;

This topic is closed to new replies.

Advertisement