java收银台界面代码 java超市收银

Java 超市收银系统用eclipse的可视化插件或者netbeans可视化做吧,简单的很快 。
仅供参考~
JAVA的图形用户界面代码package hao;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.io.File;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextPane;
import javax.swing.text.BadLocationException;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
public class ChatPanel extends JPanel {
private static final long serialVersionUID = 1L;
JButton send,record,saveRecord,image;
JTextArea inputArea;
JTextPane text;//注意用法****************************************************************************
JComboBox fontName = null, fontSize = null, fontStyle = null, fontColor = null,fontBackColor = null;
publicStyledDocument doc = null; JScrollPane scrollPane;JPanel textChat;
JButton music;
public ChatPanel() {
setLayout(new BorderLayout());
text = new JTextPane();
text.setEditable(false);
doc = text.getStyledDocument();//跟踪文本和图片写到该区域java收银台界面代码的位置*************************************
scrollPane = new JScrollPane(text);
//注意下面对JComboBoxjava收银台界面代码的巧用***********************************************************************
String[] str_name = { "宋体", "黑体", "Dialog", "Gulim" };
String[] str_Size = { "12", "14", "18", "22", "30", "40" };
String[] str_Style = { "常规", "斜体", "粗体", "粗斜体" };
String[] str_Color = { "黑色", "红色", "蓝色", "黄色", "绿色" };
String[] str_BackColor = { "无色", "灰色", "淡红", "淡蓝", "淡黄", "淡绿" };
fontName = new JComboBox(str_name);
fontSize = new JComboBox(str_Size);
fontStyle = new JComboBox(str_Style);
fontColor = new JComboBox(str_Color);
fontBackColor = new JComboBox(str_BackColor);
fontName.setBackground(new Color(255,153,255));
fontSize.setBackground(new Color(255,153,255));
fontStyle.setBackground(new Color(255,153,255));
fontColor.setBackground(new Color(255,153,255));
fontBackColor.setBackground(new Color(255,153,255));
Box box = Box.createVerticalBox();//创建一个可以容纳多个Box组件java收银台界面代码的Box*******************************
Box box_1 = Box.createHorizontalBox();
Box box_2 = Box.createHorizontalBox();
Box box_4 = Box.createHorizontalBox();
box.add(box_1);
box.add(box_2);
box.add(box_4);
JLabel b1= new JLabel("字体~~"), b2 = new JLabel("样式~~"),b3 = new JLabel("字号~~"),b4 = new JLabel("颜色~~"),b5 = new JLabel("背景~~");
b1.setBackground(new Color(255,153,255));
b2.setBackground(new Color(255,153,255));
b3.setBackground(new Color(255,153,255));
b4.setBackground(new Color(255,153,255));
b5.setBackground(new Color(255,153,255));
box_1.add(b1);
box_1.add(fontName);
box_1.add(Box.createHorizontalStrut(8));
box_1.add(b2);
box_1.add(fontStyle);
box_1.add(Box.createHorizontalStrut(8));
box_1.add(b3);
box_1.add(fontSize);
box_2.add(Box.createHorizontalStrut(8));
box_2.add(b4);
box_2.add(fontColor);
box_2.add(Box.createHorizontalStrut(8));
box_4.add(b5);
box_4.add(fontBackColor);
textChat = new JPanel();
textChat.setLayout(new BorderLayout());
textChat.setBackground(new Color(255,153,255));
inputArea = new JTextArea(3, 20);
inputArea.setLineWrap(true);//设置文本区java收银台界面代码的换行策略 。88888*********************************
send = new JButton("发送");
record=new JButton("显示记录");
saveRecord=new JButton("储存记录");
image=new JButton("表情");
send.setBackground(new Color(255,153,255));
record.setBackground(new Color(255,153,255));
saveRecord.setBackground(new Color(255,153,255));
image.setBackground(new Color(255,153,255));
Box box_3 = Box.createHorizontalBox();
box_3.add(send);box_3.add(Box.createHorizontalStrut(8));//设置按钮间距*************************888
box_3.add(record);box_3.add(Box.createHorizontalStrut(8)); //设置按钮间距*************************888
box_3.add(saveRecord);box_3.add(Box.createHorizontalStrut(8));//设置按钮间距*************************888
box_3.add(image);
box.setBorder(BorderFactory.createLineBorder(new Color(102,102,0),5));//设置Boxjava收银台界面代码的边框线********************
box_3.setBorder(BorderFactory.createLineBorder(new Color(102,102,0),5));
textChat.add(box,BorderLayout.NORTH);
textChat.add(inputArea,BorderLayout.CENTER);
textChat.add(box_3, BorderLayout.SOUTH);
inputArea.requestFocus(true);
inputArea.setBorder(BorderFactory.createLineBorder(new Color(102,102,0),5));//设置输入窗口边框线*******************
text.setBorder(BorderFactory.createLineBorder(new Color(102,102,0),8));//设置输入窗口边框线*******************
JPanel audioPanel = new JPanel();//最上面的边框************************************************************************
audioPanel.setBackground(new Color(255,153,255));
audioPanel.setLayout(new GridLayout(1,1));
music = new JButton("想听就听");
music.setPreferredSize(new Dimension(320,50));
music.setBorder(BorderFactory.createLineBorder(Color.BLACK,10));//设置输入窗口边框线*******************
audioPanel.add(music);
add(audioPanel, BorderLayout.NORTH);
add(scrollPane,BorderLayout.CENTER);
add(textChat, BorderLayout.SOUTH);
}
void insertIcon(ImageIcon image) {
text.setCaretPosition(doc.getLength());
text.insertIcon(image);
insert(new MessageStyle());//?????????????????????????????????????????????????????????????????????????????/
}
public void insert(MessageStyle attrib) {
try {
doc.insertString(doc.getLength(), attrib.getText()"\n", attrib.getAttrSet());//写完后接着换行************
} catch (BadLocationException e) {
e.printStackTrace();
}
}
public MessageStyle getMessageStyle(String line) {
MessageStyle att = new MessageStyle();
att.setText(line);
att.setName((String) fontName.getSelectedItem());
att.setSize(Integer.parseInt((String) fontSize.getSelectedItem()));
String temp_style = (String) fontStyle.getSelectedItem();
if (temp_style.equals("常规")) {
att.setStyle(MessageStyle.GENERAL);
}
else if (temp_style.equals("粗体")) {
att.setStyle(MessageStyle.BOLD);
}
else if (temp_style.equals("斜体")) {
att.setStyle(MessageStyle.ITALIC);
}
else if (temp_style.equals("粗斜体")) {
att.setStyle(MessageStyle.BOLD_ITALIC);
}
String temp_color = (String) fontColor.getSelectedItem();
if (temp_color.equals("黑色")) {
att.setColor(new Color(0, 0, 0));
}
else if (temp_color.equals("红色")) {
att.setColor(new Color(255, 0, 0));
}
else if (temp_color.equals("蓝色")) {
att.setColor(new Color(0, 0, 255));
}
else if (temp_color.equals("黄色")) {
att.setColor(new Color(255, 255, 0));
}
else if (temp_color.equals("绿色")) {
att.setColor(new Color(0, 255, 0));
}
String temp_backColor = (String) fontBackColor.getSelectedItem();
if (!temp_backColor.equals("无色")) {
if (temp_backColor.equals("灰色")) {
att.setBackColor(new Color(200, 200, 200));
}
else if (temp_backColor.equals("淡红")) {
att.setBackColor(new Color(255, 200, 200));
}
else if (temp_backColor.equals("淡蓝")) {
att.setBackColor(new Color(200, 200, 255));
}
else if (temp_backColor.equals("淡黄")) {
att.setBackColor(new Color(255, 255, 200));
}
else if (temp_backColor.equals("淡绿")) {
att.setBackColor(new Color(200, 255, 200));
}
}
return att;
}
}
【JAVA求助】编写一个程序小兄弟、你的程序也不算大程序、但是要做,至少也得3个小时、都在上班、哪有那么多时间给你做啊 。知识是学着自己用的、你要是把这个项目做出来了、你就会进步、会明白很多、其实java真的不难,何不自己试试呢?一步一步的做,加油 , 别低估了JAVA 。
求一个用Java Eclipse 链接SQL数据库的超市收银管理系统的源代码 , 这个我可以做java收银台界面代码,两天做好交给java收银台界面代码你java收银台界面代码;可以私信我
java超市计价系统代码package entity;
public class Market {
private int id;//id
private int num;//数量
private String goods;//商品
private double price;//价格

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("您消费共计java收银台界面代码:" sum "¥");
return sum;
【java收银台界面代码 java超市收银】 }
}
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("-------超市计价系统-------");
String goods1="可口可乐";
String goods2="爆米花";
String goods3="益达";
printTable("编号","商品","价格");
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("请输入商品java收银台界面代码的编号:");
int num = input.nextInt();
System.out.println("请输入商品java收银台界面代码的数量");
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; itimes; i) {
System.out.print(" ");
}
System.out.print(row2);
for (int i = 0; i10; i) {
System.out.print(" ");
}
System.out.print(row3);
System.out.println("\n");
}
}
//测试结果:
-------超市计价系统-------
编号商品价格
1可口可乐3.0¥
2爆米花5.0¥
3益达10.0¥
请输入商品java收银台界面代码的编号:
3
请输入商品java收银台界面代码的数量
5
您消费共计:50.0¥
关于java收银台界面代码和java超市收银的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站 。

    推荐阅读