📄 extraguidemo4.java
字号:
/**
*A dialog demonstration program
*Dialogs have several restrictions as follows:
*1.They cannot have menus or be resized
*2.They must be owned by a parent window in order to exist
*Since dialogs are designed for user input,they can be designed either
* as model or non_model at creation time.Model dialog are to be explicitly
* closed,as they do not allow simutaneous navigation in two different
* windows whereas non-model dialogs do
*AWT provides two types of dialogs:Generic dialog and file dialog
*Note that the applet gets disabled when the frame window is open
*2005.1.11. xhcprince
*/
import java.applet.*;
import java.awt.*;
public class extraGUIDemo4 extends Applet
{
public void init()
{
Myframe f = new Myframe("My window");
f.setSize(200,200);
f.init();
f.setVisible(true);
}
}
class Myframe extends Frame
{
Myframe(String name)
{
super(name);
}
public void init()
{
Dialog d = new Dialog(this,"first dialog",true);//the boolean type is for model or
d.setLayout(new FlowLayout(FlowLayout.CENTER)); // non_model
/*Generic dialog constructor:Dialog(Frame,String,boolean)*/
TextField tf = new TextField(30);
d.add(tf);
d.add(new Button("OK"));
d.setSize(200,175);
d.setVisible(true);
}
}
/*
<applet code = "extraGUIDemo4.class" width = 300 height = 300>
</applet>
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -