📄 delcityinfowindow.java
字号:
package src;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class delCityInfoWindow extends JDialog{
private Graph g;
private cityFile file;
public delCityInfoWindow(JFrame f) {
super(f,"删除城市信息",true);
g = new Graph();
file = new cityFile();
file.inputfromInfoFile(g);
setLayout(null);
l = new JLabel("城市名:");
l.reshape(30,30,60,20);
t = new JTextField(10);
t.reshape(80,30,100,20);
b1 = new JButton("确定");
b1.reshape(35,80,65,20);
b1.addActionListener(new
ActionListener(){
public void actionPerformed(ActionEvent event){
if(t.getText().equals("")){
JOptionPane.showMessageDialog(null,"城 市 名 不 能 为 空!!");
t.grabFocus();
}
else{
if(!g.delCity(t.getText()))
JOptionPane.showMessageDialog(null,"城 市 名 不 存 在!!");
else
JOptionPane.showMessageDialog(null,"城 市 名 删 除 成 功!!");
}
}
});
b2 = new JButton("取消");
b2.reshape(120,80,65,20);
b2.addActionListener(new
ActionListener(){
public void actionPerformed(ActionEvent event){
setVisible(false);
}
});
add(l);
add(t);
add(b1);
add(b2);
setSize(230,160);
setLocation(400,200);
}
private JLabel l;
private JTextField t;
private JButton b1;
private JButton b2;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -