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

📄 tsearch.java

📁 java课程的资料以及实验的代码
💻 JAVA
字号:
/* *TSearch.java主要功能是建立左侧界面中的查询输入界面。 *该界面包括输入字段和查询按钮。 */ import javax.swing.JFrame;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.JTable;import java.awt.Dimension;import java.awt.GridLayout;import java.awt.event.*;import java.awt.event.*;import java.awt.*;import javax.swing.*;import javax.swing.BorderFactory; import javax.swing.border.Border;import javax.swing.border.TitledBorder;import javax.swing.border.EtchedBorder;public class TSearch extends JPanel  implements ActionListener {	TCardModel tcm;		Border b = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);	private Container cont;        private GridBagLayout layout;        private GridBagConstraints cons;	JLabel lblAssetId ;        JLabel lblAssetName ;        public JTextField jtfAssetId ;        public JTextField jtfAssetName ;        JButton btnSelectId;        JButton btnSelectName;                public TSearch(){};            	public TSearch(TCardModel t) {    		tcm = t;    		cont = this;   		layout = new GridBagLayout();   		cont.setLayout(layout);   		cons = new GridBagConstraints();    		    		lblAssetId = new JLabel("以资产编号为条件");    		addComponent(lblAssetId,0,0,1,1);    		jtfAssetId = new JTextField(10);    		addComponent(jtfAssetId,1,0,1,1);    		btnSelectId = new JButton("按编号查询");    		btnSelectId.setActionCommand("selectid");    		btnSelectId.addActionListener(this);    		addComponent(btnSelectId,2,0,1,1);    		lblAssetName = new JLabel("以资产名称为条件");    		addComponent(lblAssetName,3,0,1,1);    		jtfAssetName = new JTextField(10);    		addComponent(jtfAssetName,4,0,1,1);    		btnSelectName = new JButton("按名称查询");    		btnSelectName.setActionCommand("selectname");    		btnSelectName.addActionListener(this);    		addComponent(btnSelectName,5,0,1,1);    		    		setBorder(b);    		setVisible(true);    	}    	private void addComponent(Component comp,   	int row,int column,int width,int height) {   		cons.gridx = column;   		cons.gridy = row;   		cons.gridwidth = width;   		cons.gridheight = height;   		layout.setConstraints(comp,cons);   		cont.add(comp);       }       public void actionPerformed(ActionEvent e) {       	  if (e.getActionCommand() == "selectid")              if (Share.verify(jtfAssetId)){             	tcm.selAssetId(jtfAssetId.getText());             }       	         	               	  if (e.getActionCommand() == "selectname")        	     tcm.selAssetName(jtfAssetName.getText());       }        /*      public String getCateId(){   			return jtfAssetId.getText();   		}*/}

⌨️ 快捷键说明

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