Sat Feb 09, 2013 1:01 am
import java.awt.*;
public class CustomWindow extends Frame {
private boolean isApplet = true;
public CustomWindow() {
setLayout(new DiagonalLayout());
setFont(new Font("Aril", Font.PLAIN, 15));
add(new Button("Btn1"));
add(new Button("Btn2"));
add(new Button("Btn3"));
add(new Button("Btn4"));
add(new Button("Btn5"));
}
public boolean handleEvent(Event e) {
if (e.id == Event.WINDOW_DESTROY) {
if (isApplet) {
dispose();
return true;
} else {
System.exit(0);
}
}
return super.handleEvent(e);
}
public static void main(String args[]) {
CustomWindow window = new CustomWindow();
window.isApplet = false;
window.setTitle("Frame with Diagonal Layout Example");
window.pack();
window.show();
}
}
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.