📄 xianlupnl.java
字号:
/*线路增,删,改的界面与功能的实现*/
package pro;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class XianluPnl extends JPanel //线路处理
implements ActionListener
{
private MainFrame mmf;
JButton btnUpdate = new JButton();
JPanel CenterPnl = new JPanel();
JButton btnDelete = new JButton();
JButton btnInsert = new JButton();
CardLayout cl=new CardLayout();
public XianluPnl(MainFrame mf)
{
mmf=mf;
this.setLayout(null);
btnUpdate.setBounds(new Rectangle(10, 47, 112, 28));
btnUpdate.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
btnUpdate.setForeground(new Color(0, 217, 0));
btnUpdate.setText("修改线路");
CenterPnl.setBorder(BorderFactory.createLineBorder(Color.black));
CenterPnl.setBounds(new Rectangle(141, 20, 414, 494));
CenterPnl.setLayout(null);
btnDelete.setBounds(new Rectangle(10, 117, 112, 28));
btnDelete.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
btnDelete.setForeground(new Color(0, 217, 0));
btnDelete.setText("删除线路");
btnInsert.setBounds(new Rectangle(10, 186, 112, 28));
btnInsert.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
btnInsert.setForeground(new Color(0, 217, 0));
btnInsert.setText("增加线路");
btnUpdate.setActionCommand("btnUpdate");
btnDelete.setActionCommand("btnDelete");
btnInsert.setActionCommand("btnInsert");
btnUpdate.addActionListener(this);
btnDelete.addActionListener(this);
btnInsert.addActionListener(this);
this.add(CenterPnl);
CenterPnl.setLayout(cl);
CenterPnl.add(new XianluxiugaiPnl(),"XianluxiugaiPnl");
CenterPnl.add(new XianlushanchuPnl(mmf),"XianlushanchuPnl");
CenterPnl.add(new XianlucharuPnl(mmf),"XianlucharuPnl");
this.add(btnUpdate);
this.add(btnDelete);
this.add(btnInsert);
}
public void actionPerformed(ActionEvent ae)
{
String str=ae.getActionCommand();
if(str.equals("btnDelete"))
{
cl.show(this.CenterPnl,"XianlushanchuPnl");
}
if(str.equals("btnUpdate"))
{
cl.show(this.CenterPnl,"XianluxiugaiPnl");
}
if(str.equals("btnInsert"))
{
cl.show(this.CenterPnl,"XianlucharuPnl");
}
}
public void paintComponent(Graphics g)//传一个画笔进来!
{
javax.swing.ImageIcon ii = new ImageIcon("img/huran.jpg");//把图片读出来!
g.drawImage(ii.getImage(), 0, 0, this);//画画,定位置!
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -