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

📄 fpanel6.java

📁 丽婴房库存销售系统 描述:C/S构架
💻 JAVA
字号:
package src1;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;

import java.awt.*;
import java.awt.event.*;
import java.util.Calendar;

public class FPanel6 extends FunctionPanel implements ActionListener{

	private JLabel label = new JLabel(" FPanel 6");
	private JLabel label1,label2,label3,label4,label5,label6,label7,label8,label9;
	private JTextField         tf1,tf2,tf3,tf4,tf5,tf6,tf7,tf8,tf9;
	private JButton bt1,bt2;
	private JPanel panel1,panel2,panel3;
	private String warehouseID="";
	private String addr  ="";
	private String name = "";
    private String sql;
    private ConSqlServer exc;
	
	private JTable table;
	private int i;
	public FPanel6() {
		// TODO 自动生成构造函数存根
		
		//this.add(label);
		operationLabel.setText("操作:修改新仓库信息");
		
		this.setLayout(null);
		label1 = new JLabel("仓库号   ");
		label2 = new JLabel("仓库名称");
		label3 = new JLabel("地   址");
		label1.setIcon(new ImageIcon("./src/icons/5.gif"));
		label2.setIcon(new ImageIcon("./src/icons/5.gif"));
		label3.setIcon(new ImageIcon("./src/icons/5.gif"));
		
		
		tf1  =  new JTextField(12);
		tf2  =  new JTextField(12);
		tf3  =  new JTextField(12);
		tf4  =  new JTextField(12);
		bt1 = new JButton("确定");
		bt2 = new JButton("取消");
		bt1.setIcon(new ImageIcon("./src/icons/35.gif"));
		bt2.setIcon(new ImageIcon("./src/icons/36.gif"));
	
		panel1  =new JPanel();
		panel2  = new JPanel();
		panel3  =new  JPanel();
		//panel4  = new JPanel();
		
		panel1.setBounds(0,20,260,120);
		panel2.setBounds(260,20,260,120);
		panel3.setBounds(-2,160,600,440);
		
		
		panel3.setLayout(null);
		
		table = new JTable(10,3);
		initTable();
		JScrollPane scrollPane = new JScrollPane(table);
		
		 scrollPane.setLocation(30,20);
		 scrollPane.setSize(550,180);
		 panel3.add(scrollPane,BorderLayout.CENTER);
		
		this.add(panel1);
		this.add(panel2);
		this.add(panel3);
	   // this.add(panel4);
	    
		panel1.add(label1);panel1.add(tf1);
		panel1.add(label2);panel1.add(tf2);
		panel2.add(label3);panel2.add(tf3);
		
		
		panel2.add(bt1);
	    panel2.add(bt2);
	    
		//panel1.setBorder(new OwnBorder(2,Color.green));
		panel3.setBorder(new OwnBorder(2,Color.LIGHT_GRAY));
		
		panel1.setBackground(new Color(240,255,255));
		panel2.setBackground(new Color(240,255,255));
		panel3.setBackground(new Color(240,255,255));
	    
		bt1.addActionListener(this);
		bt2.addActionListener(this);
		this.setVisible(false);
	}
	
	
	public void actionPerformed(ActionEvent e)
	{
		if(e.getSource()== bt1)
		{
			getSql();
			System.out.println(sql);
			exc = new ConSqlServer(sql);
			exc.executeUpdate();
			exc.close();
			setTable();
			reInitTf();
		}
	}
	public void getSql()
	{
		getS();
		sql = "update  warehouse  set " + "仓库名="+"'"+name+"'"+
		
		" where 仓库号="+warehouseID;
				
	}
	public boolean isInt(String s)
	{ 
		if(s=="a") return false;
		for(int i=0;s.charAt(i)>0&&s.charAt(i)!='a';i++) 
		{ 
			if(s.charAt(i)<48||s.charAt(i)>57)
				return false;
		}
		return true;
	}
	public void getS()
	{
		warehouseID = tf1.getText();
		name   = tf2.getText();
	
		addr  = tf3.getText();
		
		
	}
	public void reInitTf()
	{
		tf1.setText("");
		tf2.setText("");
		
		tf3.setText("");
		
		
	}
	private void setTable()
	{
	   table.setValueAt(tf1.getText(), i, 0);
	   table.setValueAt(tf2.getText(), i, 1);
	   table.setValueAt(tf3.getText(), i, 2);
	  
	   table.setValueAt(Calendar.getInstance().getTime(), i, 3);
	   table.setVisible(true);
	   i++;
	}
	private void initTable()
	{
		table.setValueAt("仓库号" ,i, 0);
		table.setValueAt("仓库名", i, 1);
		table.setValueAt("地址", i, 2);
		  
	  
		table.setVisible(true);
	    i++;
	}
	
}

⌨️ 快捷键说明

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