java項(xiàng)目系統(tǒng)代碼 java項(xiàng)目源碼大全免費(fèi)版下載

求java編寫的倉庫管理系統(tǒng)源代碼或詳細(xì)設(shè)計(jì)

import java.util.*;

十載的固原網(wǎng)站建設(shè)經(jīng)驗(yàn),針對(duì)設(shè)計(jì)、前端、開發(fā)、售后、文案、推廣等六對(duì)一服務(wù),響應(yīng)快,48小時(shí)及時(shí)工作處理。營(yíng)銷型網(wǎng)站建設(shè)的優(yōu)勢(shì)是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動(dòng)調(diào)整固原建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。成都創(chuàng)新互聯(lián)公司從事“固原網(wǎng)站設(shè)計(jì)”,“固原網(wǎng)站推廣”以來,每個(gè)客戶項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。

import java.awt.event.*;

import java.awt.*;

import javax.swing.*;

import java.io.*;

class 商品 extends Panel

{String 代號(hào),名稱;int 庫存;float 單價(jià);

商品(String 代號(hào),String 名稱,int 庫存,float 單價(jià))

{this.代號(hào)=代號(hào);this.名稱=名稱;this.庫存=庫存;this.單價(jià)=單價(jià);

}

}

class ShowWin extends JFrame implements ActionListener

{ Hashtable hashtable=null;

JTextField 代號(hào)文本框=new JTextField(),

名稱文本框=new JTextField(),

庫存文本框=new JTextField(),

單價(jià)文本框=new JTextField(),

查詢文本框=new JTextField(),

查詢信息文本框=new JTextField(),

刪除文本框=new JTextField();

JButton b_add=new JButton("添加商品"),

b_del=new JButton("刪除商品"),

b_xun=new JButton("查詢商品"),

b_xiu=new JButton("修改商品"),

b_show=new JButton("顯示商品清單");

JTextArea 顯示區(qū)=new JTextArea(25,10);

ShowWin()

{super("倉庫管理窗口");

hashtable=new Hashtable();

Container con=getContentPane();

JScrollPane pane=new JScrollPane(顯示區(qū));

顯示區(qū).setEditable(false);

JPanel save=new JPanel();

save.setLayout(new GridLayout(8,2));

save.add(new Label("輸入代號(hào):"));

save.add(代號(hào)文本框);

save.add(new Label("輸入名稱:"));

save.add(名稱文本框);

save.add(new Label("輸入庫存:"));

save.add(庫存文本框);

save.add(new Label("輸入單價(jià):"));

save.add(單價(jià)文本框);

save.add(new Label("單擊添加:"));

save.add(b_add);

save.add(new Label("單擊修改:"));

save.add(b_xiu);

save.add(new Label("輸入查詢代號(hào):"));

save.add(查詢文本框);

save.add(new Label("單擊查詢:"));

save.add(b_xun);

JPanel del=new JPanel();

del.setLayout(new GridLayout(2,2));

del.add(new Label("輸入刪除的代號(hào):"));

del.add(刪除文本框);

del.add(new Label("單擊刪除:"));

del.add(b_del);

JPanel show=new JPanel();

show.setLayout(new BorderLayout());

show.add(pane,BorderLayout.CENTER);

show.add(b_show,BorderLayout.SOUTH);

JSplitPane split_one,split_two;

split_one=new JSplitPane(JSplitPane.VERTICAL_SPLIT,save,del);

split_two=new

JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,split_one,show);

con.add(split_two,BorderLayout.CENTER);

JPanel xun=new JPanel();

xun.add(new Label("所得信息:"));

xun.add(查詢信息文本框);

xun.setLayout(new GridLayout(2,1));

con.add(xun,BorderLayout.SOUTH);

b_add.addActionListener(this);

b_del.addActionListener(this);

b_xun.addActionListener(this);

b_xiu.addActionListener(this);

b_show.addActionListener(this);

}

public void actionPerformed(ActionEvent e)

{if(e.getSource()==b_add)

{String daihao=null,mingcheng=null;int kucun=0;float danjia=0.0f;

daihao=代號(hào)文本框.getText();mingcheng=名稱文本框.getText();

kucun=Integer.parseInt(庫存文本框.getText());

danjia=Float.valueOf(單價(jià)文本框.getText()).floatValue();

商品 goods=new 商品(daihao,mingcheng,kucun,danjia);

hashtable.put(daihao,goods);

try{FileOutputStream file=new FileOutputStream("goods.txt");

ObjectOutputStream out=new ObjectOutputStream(file);

out.writeObject(hashtable); out.close();

}

catch(IOException event){}

}

else if(e.getSource()==b_del)

{String daihao1=刪除文本框.getText();

try{FileInputStream come_in=new FileInputStream("goods.txt");

ObjectInputStream in=new ObjectInputStream(come_in);

hashtable=(Hashtable)in.readObject(); //////

in.close();

}

catch(ClassNotFoundException event){}

catch(IOException event){}

商品 temp=(商品)hashtable.get(daihao1);

{hashtable.remove(daihao1);}

try{FileOutputStream file=new FileOutputStream("goods.txt");

ObjectOutputStream out =new ObjectOutputStream(file);

out.writeObject(hashtable);//

out.close();

}

catch(IOException event){}

}

//

else if(e.getSource()==b_xun)

{ String aa;

aa=查詢文本框.getText();

查詢信息文本框.setText(null);

try{FileInputStream come_in=new FileInputStream("goods.txt");

ObjectInputStream in =new ObjectInputStream(come_in);

hashtable=(Hashtable)in.readObject(); ////

in.close();

}

catch(ClassNotFoundException event){}

catch(IOException event){}

商品 a=(商品)hashtable.get(aa);

查詢信息文本框.setText(" 代號(hào):"+a.代號(hào)+" 名稱:"+a.名稱+" 庫存:"+a.庫存+" 單價(jià):"+a.單價(jià));

}

//

else if(e.getSource()==b_xiu)

{ String bb;

bb=代號(hào)文本框.getText();

try{FileInputStream come_in=new FileInputStream("goods.txt");

ObjectInputStream in=new ObjectInputStream(come_in);

hashtable=(Hashtable)in.readObject(); //////

in.close();

}

catch(ClassNotFoundException event){}

catch(IOException event){}

商品 temp=(商品)hashtable.get(bb);

{hashtable.remove(bb);}

try{FileOutputStream file=new FileOutputStream("goods.txt");

ObjectOutputStream out =new ObjectOutputStream(file);

out.writeObject(hashtable);//

out.close();

}

catch(IOException event){}

String daihao1=null,mingcheng1=null;int kucun1=0;float danjia1=0.0f;

daihao1=代號(hào)文本框.getText();mingcheng1=名稱文本框.getText();

kucun1=Integer.parseInt(庫存文本框.getText());

danjia1=Float.valueOf(單價(jià)文本框.getText()).floatValue();

商品 goods1=new 商品(daihao1,mingcheng1,kucun1,danjia1);

hashtable.put(daihao1,goods1);

try{FileOutputStream file=new FileOutputStream("goods.txt");

ObjectOutputStream out=new ObjectOutputStream(file);

out.writeObject(hashtable); out.close();

}

catch(IOException event){}

}

//

else if(e.getSource()==b_show)

{ 顯示區(qū).setText(null);

try{FileInputStream come_in=new FileInputStream("goods.txt");

ObjectInputStream in =new ObjectInputStream(come_in);

hashtable=(Hashtable)in.readObject(); ////

}

catch(ClassNotFoundException event){}

catch(IOException event){}

Enumeration enum=hashtable.elements();

while(enum.hasMoreElements())

{ 商品 te=(商品)enum.nextElement();

顯示區(qū).append("商品代號(hào):"+te.代號(hào)+" ");

顯示區(qū).append("商品名稱:"+te.名稱+" ");

顯示區(qū).append("商品庫存:"+te.庫存+" ");

顯示區(qū).append("商品單價(jià):"+te.單價(jià)+" ");

顯示區(qū).append("\n ");

}

}

}

}

public class LinkListFour

{public static void main(String args[])

{ ShowWin win=new ShowWin();

win.setSize(400,350);

win.setVisible(true);

win.addWindowListener(new WindowAdapter()

{public void windowClosing(WindowEvent e)

{ System.exit(0);}});

}

}

java超市計(jì)價(jià)系統(tǒng)代碼

package?entity;

public?class?Market?{

private?int?id;//id

private?int?num;//數(shù)量

private?String?goods;//商品

private?double?price;//價(jià)格

public?Market(int?id,?int?num,?String?goods,?double?price)?{

super();

this.id?=?id;

this.num?=?num;

this.goods?=?goods;

this.price?=?price;

}

public?int?getId()?{

return?id;

}

public?void?setId(int?id)?{

this.id?=?id;

}

public?int?getNum()?{

return?num;

}

public?void?setNum(int?num)?{

this.num?=?num;

}

public?String?getGoods()?{

return?goods;

}

public?void?setGoods(String?goods)?{

this.goods?=?goods;

}

public?double?getPrice()?{

return?price;

}

public?void?setPrice(double?price)?{

this.price?=?price;

}

public?double?calc(?){

double?sum=price*num;

System.out.println("您消費(fèi)共計(jì):"+sum+"¥");

return?sum;

}

}

package?test;

import?java.util.HashMap;

import?java.util.Map;

import?java.util.Scanner;

import?entity.Market;

public?class?Test?{

private?static?MapInteger,Market?goods=new?HashMapInteger,?Market();

public?static?void?main(String[]?args)?{

System.out.println("-------超市計(jì)價(jià)系統(tǒng)-------");

String?goods1="可口可樂";

String?goods2="爆米花";

String?goods3="益達(dá)";

printTable("編號(hào)","商品","價(jià)格");

printTable("1",goods1,"3.0¥");

printTable("2",goods2,"5.0¥");

printTable("3",goods3,"10.0¥");

goods.put(1,?new?Market(1,?1,?goods1,?3.0));

goods.put(2,?new?Market(2,?1,??goods2,?5.0));

goods.put(3,?new?Market(3,?1,?goods3,?10.0));

Scanner?input?=?new?Scanner(System.in);

System.out.println("請(qǐng)輸入商品的編號(hào):");

int?num?=?input.nextInt();

System.out.println("請(qǐng)輸入商品的數(shù)量");

int?amount?=?input.nextInt();

Market?market?=?goods.get(num);

market.setNum(amount);

market.calc();

}

private?static?void?printTable(String?row1,String?row2,String?row3?)?{

System.out.print(row1);

int?times=12;

if?(row2!="商品")?{

times=5;

}

for?(int?i?=?0;?i??times;?i++)?{

System.out.print("?");

}

System.out.print(row2);

for?(int?i?=?0;?i??10;?i++)?{

System.out.print("?");

}

System.out.print(row3);

System.out.println("\n");

}

}

//測(cè)試結(jié)果:

-------超市計(jì)價(jià)系統(tǒng)-------

編號(hào)????????????商品??????????價(jià)格

1?????可口可樂??????????3.0¥

2?????爆米花??????????5.0¥

3?????益達(dá)??????????10.0¥

請(qǐng)輸入商品的編號(hào):

3

請(qǐng)輸入商品的數(shù)量

5

您消費(fèi)共計(jì):50.0¥

Eclipse中如何看Java代碼中系統(tǒng)自帶的類的源代碼?例如String ,Scanner等等

首先,需要下載JDK源代碼(Oracle官網(wǎng)找或者搜一下,到處都有),一般會(huì)打成zip包做下載,下載后并不需要進(jìn)行解壓;

然后,可使用以下幾種方式將class文件與源文件進(jìn)行關(guān)聯(lián):

(1) 如果你沒有進(jìn)行關(guān)聯(lián)過,可以在Editor中寫下如下的語句:

String str = null;

然后按住Ctrl鍵, 用鼠標(biāo)左鍵點(diǎn)擊"String",

就會(huì)彈出 Class File Editor 的界面讓你關(guān)聯(lián)源文件,

點(diǎn)擊界面上的"Attach Source..."按鈕,

在彈出的"Source Attachment Configuration"界面中,

點(diǎn)擊"External File", 選擇你下載的源文件zip包,一路OK即可;

(2) 在項(xiàng)目中找到 JRE System Library,定位到如下:

JRE System Library - rt.jar - java-lang-String.class

雙擊String.class,即彈出關(guān)聯(lián)源文件的界面;

(3) 在項(xiàng)目中找到 JRE System Library, 定位到 rt.jar,

鼠標(biāo)右鍵點(diǎn)擊,在彈出的界面中選擇"Properties...",

在彈出的界面中,左邊默認(rèn)會(huì)選中"Java Source Attachment",

在右邊進(jìn)行源文件的關(guān)聯(lián);

(4) Window-Preferences-Java-Installed JREs

在右邊的"Installed JREs:"窗口中選中所使用的JRE,

點(diǎn)擊其右邊的"Edit",在彈出的"Edit JRE"窗口中,

有一個(gè)"JRE system libraries:"列表,

在其中找到 "...jdk1.6.0_13\jre\lib\rt.jar" 并選中,

點(diǎn)擊右邊的"Source Attachment...",

在彈出的"Source Attachment Configuration"界面中,

點(diǎn)擊文本框右邊的"External File",

選擇你下載的源文件zip包,一路OK即可;

求用Java編寫的學(xué)生成績(jī)管理系統(tǒng)的完整代碼,要能運(yùn)行的

以下方法實(shí)現(xiàn)了用戶界面登陸

import java.awt.*;

import java.awt.event.*;

public class DengLuJieMian extends Frame implements ActionListener

{

Label username=new Label("用戶名:");//使用文本創(chuàng)建一個(gè)用戶名標(biāo)簽

TextField t1=new TextField();//創(chuàng)建一個(gè)文本框?qū)ο?/p>

Label password=new Label("密碼:");//創(chuàng)建一個(gè)密碼標(biāo)簽

TextField t2=new TextField();

Button b1=new Button("登陸");//創(chuàng)建登陸按鈕

Button b2=new Button("取消");//創(chuàng)建取消按鈕

public DengLuJieMian()

{

this.setTitle("學(xué)生信息管理系統(tǒng)");//設(shè)置窗口標(biāo)題

this.setLayout(null);//設(shè)置窗口布局管理器

username.setBounds(50,40,60,20);//設(shè)置姓名標(biāo)簽的初始位置

this.add(username);// 將姓名標(biāo)簽組件添加到容器

t1.setBounds(120,40,80,20);// 設(shè)置文本框的初始位置

this.add(t1);// 將文本框組件添加到容器

password.setBounds(50,100,60,20);//密碼標(biāo)簽的初始位置

this.add(password);//將密碼標(biāo)簽組件添加到容器

t2.setBounds(120,100,80,20);//設(shè)置密碼標(biāo)簽的初始位置

this.add(t2);//將密碼標(biāo)簽組件添加到容器

b1.setBounds(50,150,60,20);//設(shè)置登陸按鈕的初始位置

this.add(b1);//將登陸按鈕組件添加到容器

b2.setBounds(120,150,60,20);//設(shè)置取消按鈕的初始位置

this.add(b2);// 將取消按鈕組件添加到容器

b1.addActionListener(this);//給登陸按鈕添加監(jiān)聽器

b2.addActionListener(this);// 給取消按鈕添加監(jiān)聽器

this.setVisible(true);//設(shè)置窗口的可見性

this.setSize(300,200);//設(shè)置窗口的大小

addWindowListener(new WindowAdapter()

{

public void windowClosing(WindowEvent e)

{

System.exit(0);

}

});//通過內(nèi)部類重寫關(guān)閉窗體的方法

}

public void actionPerformed(ActionEvent e)

{

if(e.getSource()==b1)//處理登陸事件

{

String name=t1.getText();

String pass=t2.getText();

if(name!=nullpass.equals("000123"))//判斷語句

{

new StudentJieMian();

}

}

}

public static void main(String args[])//主函數(shù)

{

new DengLuJieMian();

}

}

以下方法實(shí)現(xiàn)了學(xué)生界面設(shè)計(jì)

import java.awt.*;

import java.awt.event.*;

class StudentJieMian extends Frame implements ActionListener

{

MenuBar m=new MenuBar();//創(chuàng)建菜單欄

Menu m1=new Menu("信息");//創(chuàng)建菜單“信息”

MenuItem m11=new MenuItem("插入");//創(chuàng)建“插入”的菜單項(xiàng)

MenuItem m12=new MenuItem("查詢");

Menu m2=new Menu("成績(jī)");//創(chuàng)建菜單“成績(jī)”

MenuItem m21=new MenuItem("查詢");

public StudentJieMian()

{

this.setTitle("學(xué)生界面");//設(shè)置窗口標(biāo)題

this.setLayout(new CardLayout());//設(shè)置窗口布局管理器

this.setMenuBar(m);//將菜單欄組件添加到容器

m.add(m1);//將信息菜單放入菜單欄

m.add(m2);

m1.add(m11);//將“插入”菜單項(xiàng)添加到“信息”菜單

m1.add(m12); //將“查詢”菜單項(xiàng)添加到“信息”菜單

m2.add(m21); //將“查詢”菜單項(xiàng)添加到“成績(jī)”菜單

m11.addActionListener(this); //給“插入”菜單項(xiàng)添加監(jiān)聽器

m12.addActionListener(this); //給“查詢”菜單項(xiàng)添加監(jiān)聽器

m21.addActionListener(this); //給“查詢”菜單項(xiàng)添加監(jiān)聽器

this.setVisible(true); //設(shè)置窗口的可見性

this.setSize(300,200); //設(shè)置窗口的大小

addWindowListener(new WindowAdapter()

{

public void windowClosing(WindowEvent e)

{

System.exit(0);//關(guān)閉窗口

}

});

}

public void actionPerformed(ActionEvent e)

{

if(e.getSource()==m11) //處理“添加信息”事件

{

new AddStudent();

}

if(e.getSource()==m12) //處理“查詢信息”事件

{

new SelectStudent();

}

if(e.getSource()==m21) //處理“查詢成績(jī)”事件

{

new ChengJiStudent();

}

}

public static void main(String args[])

{ new StudentJieMian(); //創(chuàng)建一個(gè)對(duì)象 }

文章標(biāo)題:java項(xiàng)目系統(tǒng)代碼 java項(xiàng)目源碼大全免費(fèi)版下載
本文網(wǎng)址:http://muchs.cn/article22/dossejc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供關(guān)鍵詞優(yōu)化、企業(yè)建站網(wǎng)站營(yíng)銷、虛擬主機(jī)微信公眾號(hào)、品牌網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

h5響應(yīng)式網(wǎng)站建設(shè)