?? example5_16.java.bak
字號:
/* 顯示提示信息框 */
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class MDialog extends JFrame implements ActionListener
{
MDialog()
{
super("顯示提示信息");
setSize(200,200);
setVisible(true);
Container con=getContentPane();
con.setLayout(new FlowLayout());
JButton jbtn=new JButton("退出");
con.add(jbtn);
jbtn.addActionListener(this);
validate();
}
public void actionPerformed(ActionEvent e)
{
String msg="你確定退出嗎?";
int type=JOptionPane.YES_NO_OPTION;
String tite="信息提示框";
JOptionPane.showMessageDialog(null,msg,tite,type);
System.exit(0);
}
}
//主類
public class Example5_16
{
public static void main(String[] args)
{ new MDialog();}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -