MyFristFrame (T. Wu)

Hi

I got a problem when I try to compiler this file (MyFristFrame.java)

that's the code:/*******************************************

class frame

********************************************/

import java.awt.*;

import java.awt.event.*;

class MyFristFrame extends Frame

implements ActionListener, WindowListener

{

private static final int FRAME_WIDTH=400;

private static final int FRAME_HEIGHT=300;

private static final int FRAME_X=100;

private static final int FRAME_Y=100;

private static final int BUTTON_W=60;

private static final int BUTTON_H=30;

private Button okButton, cancelButton;

public MyFristFrame()

{

setSize(FRAME_WIDTH, FRAME_HEIGHT);

setResizable(false);

setTitle("MY FRIST FRAME");

setLocation(FRAME_X, FRAME_Y);

setLayout(null);

okButton = new Button("OK");

cancelButton = new Button("CANCEL");

okButton.setBounds(100, 150, BUTTON_W, BUTTON_H);

add(okButton);

cancelButton.setBounds(170, 150, BUTTON_W, BUTTON_H);

add(cancelButton);

okButton.addActionListener(this);

cancelButton.addActionListener(this);

addWindowListener(this);

}

public void actionPerformed(ActionEvent event)

{

String label = event.getActionCommand();

if(label.equals("OK"))

setTitle("you press OK");

else

setTitle("you press CANCEL");

// ?possibile confrontare anche i riferimenti invece dei valori

// dichiarando un oggetto che punti al riferimento selezionato

// Button clichButton = (Button) event.getSource();

}

public void windowClosing(WindowEvent event)

{

System.exit(0);

}

public void windowdActivated(WindowEvent event) {}

public void windowClosed(WindowEvent event) {}

public void windowDeactivated(WindowEvent event) {}

public void windowDeiconfinified(WindowEvent event) {}

public void windowIconified(WindowEvent event) {}

public void windowOpened(WindowEvent event) {}

}

and when in c:\sdk\exercises I compiler javac MyFristFrame.java

I got:

MyFristFrame should be declared abstract; it does not defined windowDeiconified(java.awt.event.WindowEvent) in MyFristframe

class MyFristFrame extends Frame

^

Thank you Rosario

[2395 byte] By [belami] at [2007-9-27 20:01:54]
# 1

1. >

public void windowDeiconfinified(WindowEvent event) {}

the word is 'windowDeiconfinified'

2. >

This line will also give you an error;-

public void windowdActivated(WindowEvent event) {}

3. >

You will need to enclose something like this to make it work;-public static void main (String []args){

MyFristFrame app = new MyFristFrame();

app.show();

app.pack();

app.setVisible(true);

}

Sum-shusSue at 2007-7-6 23:53:33 > top of Java-index,Archived Forums,New To Java Technology Archive...