⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cx.java~4~

📁 cs结构的一个公交车系统好有使用价值啊下吧--- --- ---
💻 JAVA~4~
字号:
package bus;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
import java.util.Vector;

public class cx extends JFrame{
	JTable tb=new JTable();
	DefaultTableModel model=new DefaultTableModel();
	Vector head=new Vector();
	JButton bt_query=new JButton("确定");
	JButton bt_qx=new JButton("取消");
	BusManager bm=new BusManager();
	tj t;
 public	cx(tj t)
	{
	this.t=t;
	this.setSize(300,300);
	this.setTitle("查询");
	Container ct=this.getContentPane();
	ct.setLayout(new BorderLayout());
	JScrollPane sp=new JScrollPane(tb);
	ct.add(sp,"Center");
	head.add("ID");
	head.add("SiJi");
	model.setColumnIdentifiers(head);
	tb.setModel(model);
	JPanel ps=new JPanel();
	ps.add(bt_query);
	bt_query.addActionListener(new Cl());
	ps.add(bt_qx);
	bt_qx.addActionListener(new Cl()); 
	ct.add(ps,"South");
	String s="select ID,SiJi from BusGuanli";
	Vector vt=bm.selectBus(s);
	model.setDataVector(vt,head);
	tb.getTableHeader().setBackground(Color.white);
	tb.setBackground(Color.pink);
	tb.setRowHeight(20);
	tb.setGridColor(Color.cyan);
	this.setVisible(true);	
		}
	class Cl implements ActionListener{
		public void actionPerformed(ActionEvent e){
			if(e.getSource()==bt_query)
			{
			  String s=(String)model.getValueAt(tb.getSelectedRow(),1);
				t.setName(s);
				cx.this.dispose();
				}
			if(e.getSource()==bt_qx)
			{
			cx.this.dispose();	
				}
			}
		}

	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -