[求助]关于GUI的问题
class Fdialog extends Frame implements ActionListener{
static Fdialog frm=new Fdialog();
static FileDialog fdlg=new FileDialog(frm,"open");
static Button btn=new Button("opne");
static TextArea txa=new TextArea();
public static void main(String args[])
{
BorderLayout br=new BorderLayout();
frm.setTitle("Dialog Demo");
frm.setLayout(br);
frm.setSize(200,150);
frm.add(txa,br.CENTER);
frm.add(btn,br.SOUTH);
btn.addActionListener(frm);
frm.setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
fdlg.setVisible(true);
String fName=fdlg.getDirectory()+fdlg.getFile();
try{
FileInputStream in=new FileInputStream(fName);
Byte byteBuf[]=new Byte[in.available()];
in.read(byteBuf);
txa.setText(new String(byteBuf));
in.close();
}
catch(IOException ioe){
}
}
}
错在哪里呢