class FrameMenubar {
//Other methods
private void createGUI(){
//Other components
MenuItem about = new MenuItem("About");
about.addActionListener(new AboutAdapter());
// other components
}
class AboutAdapter implements ActionListener{
OkBox aboutBox;
public void actionPerformed(ActionEvent e){
String topString = new String(copyRight+" "+author+"\n");
String midString = new String(aboutMidText+"\n");
//OkBox whose code not shown here is a subclass of
//java.awt.Dialog. Some variables passed to the
//OkBox constructor are declared in the enclosing
//classes.FrameMenuApp is the top-most class which
//is not shown.
aboutBox = new OkBox(FrameMenuApp.this,
256, // width
256, // height
aboutBoxTitle,
topString+midString,
false);
aboutBox.addActionListener(
new ActionListener() {//Anonymous class
public void actionPerformed(ActionEvent e){
aboutBox.dispose();
}
}
);
aboutBox.show();
}
}//End of AboutAdapter
}//End of FrameMenubar
No comments:
Post a Comment