📄 changedisplaypropertydialog.java
字号:
package gui;
import java.applet.*;
import java.awt.*;
/**
* 在这里插入类型说明。
* 建立日期:(00-8-13 9:11:44)
* @程序设计者:
*/
public class ChangeDisplayPropertyDialog extends Frame{
public Choice choice1;
public Button button1,button2;
/**
* 在这里插入方法说明。
* 建立日期:(00-8-13 11:18:46)
*/
public ChangeDisplayPropertyDialog() {
super("Change Display Property");
setFont(new Font("Helvetica",Font.PLAIN,14));
setBackground(Color.lightGray);
setForeground(Color.black);
setLayout(new BorderLayout(0,40));
choice1=new Choice();
choice1.addItem("16 varietyies");
choice1.addItem("256 varietyies");
choice1.addItem("16 bits");
choice1.addItem("24 bits");
choice1.addItem("32 bits");
choice1.select(4);
Panel panel1=new Panel();
panel1.setLayout(new BorderLayout(0,10));
panel1.add(new Label("Color Options"),"North");
panel1.add(choice1,"Center");
button1=new Button(" O K ");
button2=new Button(" Cancel");
Panel panelbutton=new Panel();
panelbutton.setLayout(new GridLayout(1,2,40,0));
panelbutton.add(button1);
panelbutton.add(button2);
add(panel1,"North");
add(panelbutton,"South");
setSize(300,250);
//pack();
setVisible(true);
}
/**
* 在这里插入方法说明。
* 建立日期:(00-8-13 9:56:20)
* @return boolean
* @param evt java.awt.Event
* @param args java.lang.Object
*/
public boolean action(Event evt, Object args) {
if (evt.target==button1){
if (choice1.getSelectedIndex()!=4){
new CompatibilityAlertDialog(getFrame(button1),"Compatibility Alert");
//new CompatibilityAlertDialog(this,"Compatibility Alert");
return true;
}
}
if (evt.target==button2){
dispose();
return true;
}
return false;
}
/**
* 在这里插入方法说明。
* 建立日期:(00-8-13 9:17:45)
* @return java.awt.Frame
* @param component java.awt.Component
*/
public static Frame getFrame(Component component) {
Frame frame;
Component currentcomponent=component;
for (frame =null;currentcomponent!=null;){
if (currentcomponent instanceof Frame ){
frame=(Frame)currentcomponent;
break;
}
else currentcomponent=currentcomponent.getParent();
}
return frame;
}
/**
* 在这里插入方法说明。
* 建立日期:(00-8-13 11:23:37)
* @param args java.lang.String[]
*/
public static void main(String[] args) {
new ChangeDisplayPropertyDialog();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -