在好例子网,分享、交流、成长!
您当前所在位置:首页CSS 开发实例网页布局 → 高颜值网页模板(适用商品售卖、图片展示、新闻播报等)

高颜值网页模板(适用商品售卖、图片展示、新闻播报等)

网页布局

下载此实例
  • 开发语言:CSS
  • 实例大小:7.68M
  • 下载次数:9
  • 浏览次数:102
  • 发布时间:2021-07-16
  • 实例类别:网页布局
  • 发 布 人:614816698
  • 文件格式:.zip
  • 所需积分:2
 相关标签: web

实例介绍

【实例简介】

一个自制精美的基础网页,主要用于商品售卖、产品展示等

【实例截图】

from clipboard


from clipboard

【核心代码】


import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
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 javax.swing.JToolBar;
import javax.swing.border.EtchedBorder;
import javax.swing.border.TitledBorder;
import javax.swing.table.DefaultTableModel;

import connection.my_connection;

public class caigou extends JFrame implements ActionListener
{
private static final long serialVersionUID = 7975505039196904660L;
Connection con;
Statement st;
private JTable ta;
private JScrollPane sPane;
private JButton btn;
private JButton btn1;
private JButton btn2;
private JButton btn3;
private String []c={"物料编号","物料名称","物料数量","金额","单位","采购时间","采购员姓名编号","供应商"};
private String [][]v={};
private DefaultTableModel tablemodel;
public JTable getTa()
{
return ta;
}
public void setTa(JTable ta)
{
this.ta = ta;
}

private JTextField e1;
private JTextField e2;
private JTextField e3;
private JTextField e4;
private JTextField e5;
private JTextField e6;
private JTextField e7;
private JTextField e8;
private JTextField e9;

private JLabel E1;
private JLabel E2;
private JLabel E3;
private JLabel E4;
private JLabel E5;
private JLabel E6;
private JLabel E7;
private JLabel E8;
private JLabel E9;


private JPanel p0;
private JPanel p1;
private JPanel p2;
private JPanel p3;
private JPanel p4;
private JPanel p5;
private JPanel p6;
JToolBar toolBar;
Box top;
Box top1;
Box top2;
Object data[][]=new Object[0][4];
// String title[]=new String[4];
private void init()
{
tablemodel=new DefaultTableModel(v,c);
ta=new JTable(tablemodel);
ta.setModel(tablemodel);
toolBar = new JToolBar();
top1 = Box.createVerticalBox();
top2 = Box.createVerticalBox();
// top1 =Box.createHorizontalBox();  

sPane=new JScrollPane();
E1=new JLabel("物料编号");
E2=new JLabel("物料编号");
E3=new JLabel("物料名称");
E4=new JLabel("物料数量");
E5=new JLabel("金额");
E6=new JLabel("单位");
E7=new JLabel("采购时间");
E8=new JLabel("采购员姓名编号");
E9=new JLabel("供应商");


btn1=new JButton("删除");
btn2=new JButton("修改");
btn3=new JButton("添加");

btn=new JButton("采购信息");

btn.addActionListener(this);
btn1.addActionListener(this);
btn2.addActionListener(this);
btn3.addActionListener(this);

p0=new JPanel();
p1=new JPanel();
p2=new JPanel();
p3=new JPanel();
p4=new JPanel();
setSize(1000, 600);
    setLocation(200, 100);
setVisible(true);
setResizable(false);

e1=new JTextField(12);
e2=new JTextField(12);
e3=new JTextField(12);
e4=new JTextField(12);
e5=new JTextField(12);
e6=new JTextField(12);
e7=new JTextField(12);
e8=new JTextField(12);
e9=new JTextField(12);

p4.setBorder(new TitledBorder(new EtchedBorder(), "查询所有采购信息"));
p4.add(btn);

p1.add(btn1);
p1.add(E1);
p1.add(e1);
p0.add(btn2);
p0.add(btn3);
p0.add(E2);
p0.add(e2);
p0.add(E3);
p0.add(e3);
p0.add(E4);
p0.add(e4);
p0.add(E5);
p0.add(e5);
p5.add(E6);
p5.add(e6);
p5.add(E7);
p6.add(e7);
p6.add(E8);
p6.add(e8);
p6.add(E9);
p6.add(e9);






top1.setBorder(new TitledBorder(new EtchedBorder(), "管理采购信息"));

top1.add(p2);
top1.add(p1);
top2.add(p2);
top2.add(p0);

top=Box.createVerticalBox();
top.add(Box.createHorizontalStrut(20));
top.add(p4);
top.add(top1);
top.add(top2);
p3.add(new JLabel("采购信息表 "));
top.add(p3);
top.add(sPane);
top.add(Box.createGlue());
add(toolBar, BorderLayout.NORTH);
add(top, BorderLayout.CENTER);
add(new JLabel("      "), BorderLayout.SOUTH);
add(new JLabel("      "), BorderLayout.EAST);
add(new JLabel("      "), BorderLayout.WEST);

}
public caigou() throws SQLException
{
this.setTitle("采购管理");
con=my_connection.getConnection();
st=con.createStatement();
init();

ta.setModel(new DefaultTableModel(data,c));
sPane.setViewportView(ta);
ta.setEnabled(false);
setVisible(true);
setResizable(false);
setAlwaysOnTop(true);
}
public void actionPerformed(ActionEvent e) {
if(e.getSource()==btn1){
try {

con=my_connection.getConnection();
java.sql.Statement 
cmd=con.createStatement();
int  rs=cmd.executeUpdate("delete from 采购信息  where 物料编号 ='" e1.getText() "'");
if(rs!=0)
{
JOptionPane.showMessageDialog(null,"删除成功!");

e1.setText("");
/* e3.setText("");
e4.setText("");
e5.setText(""); */
}
else
{
JOptionPane.showMessageDialog(null,"删除失败,请重新输入!");
}


catch (Exception ex) {
JOptionPane.showMessageDialog(this,"信息查询失败!");
ex.printStackTrace();
}
}
else if(e.getSource()==btn)
{
try {
ResultSet rs=st.executeQuery("select * from 采购信息");
tablemodel.setRowCount(0);//清零
// tablemodel.getRowCount();//获得行数
while(rs.next())
{
String data[]={rs.getString(1),rs.getString(2),"" rs.getInt(3) "","" rs.getInt(4) "",rs.getString(5),"" rs.getDate(6) "",rs.getString(7),rs.getString(8)};
tablemodel.addRow(data);//ta.setModel(tablemodel);
}
ta.setModel(tablemodel);
}
catch (SQLException e1) {
JOptionPane.showMessageDialog(this,"信息查询失败!");
e1.printStackTrace();
}
}
else if(e.getSource()==btn2){

try{
int rs;
con=my_connection.getConnection();
java.sql.Statement  cmd=con.createStatement();
rs=cmd.executeUpdate("update 采购信息set 物料名称= '" e3.getText() "',物料数量= '" e4.getText() "',金额= '" e5.getText() "',单位= '" e6.getText() "',采购时间= '" e7.getText() "',采购员编号= '" e8.getText() "',供应商= '" e9.getText() "' where 物料编号='" e2.getText() "'");
if(rs!=0){
JOptionPane.showMessageDialog(null,"修改成功!");
   }
}
catch(Exception ex){
ex.printStackTrace();
JOptionPane.showMessageDialog(null,"请重新输入!");
}

}
else if(e.getSource()==btn3){

try{
//int rs;
con=my_connection.getConnection();
java.sql.Statement  cmd=con.createStatement();
String sqlinsert="INSERT into 采购信息 values('" e2.getText() "','" e3.getText() "','" e4.getText() "','" e5.getText() "','" e6.getText() "','" e7.getText() "','" e8.getText() "','" e9.getText() "')";
cmd=con.createStatement();
cmd.executeUpdate(sqlinsert);
JOptionPane.showMessageDialog(null,"添加成功!");
   
}
catch(Exception ex){
ex.printStackTrace();
JOptionPane.showMessageDialog(null,"请重新输入!");
}

}
}
public static void main(String[] args) throws SQLException
{
caigou u=new caigou();
u.setAlwaysOnTop(true);
}
}



标签: web

实例下载地址

高颜值网页模板(适用商品售卖、图片展示、新闻播报等)

不能下载?内容有错? 点击这里报错 + 投诉 + 提问

好例子网口号:伸出你的我的手 — 分享

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有0条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
;
报警