189 8069 5689

java课程表源代码 java编程编写简单课程表

java课程设计源代码(急!!!!)

import java.awt.Color;

专注于为中小企业提供网站设计、成都网站制作服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业晋城免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了成百上千家企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。

import java.awt.Font;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.SwingConstants;

import javax.swing.border.LineBorder;

public class game21 extends JFrame {

private JLabel label_2;

private int number;

private int sum;

final JLabel label = new JLabel();

final JLabel label_1 = new JLabel();

public static void main(String[] args) {

new game21();

}

public game21() {

super("21点?!");

getContentPane().setLayout(null);

this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

final JButton button = new JButton();

button.addActionListener(new ActionListener() {

public void actionPerformed(final ActionEvent arg0) {

onClick();

}

});

button.setText("出牌");

button.setBounds(170, 350, 106, 28);

getContentPane().add(button);

label.setBorder(new LineBorder(Color.black, 1, false));

label.setHorizontalAlignment(SwingConstants.CENTER);

label.setFont(new Font("", Font.BOLD, 26));

label.setText("背面");

label.setBounds(158, 81, 137, 153);

getContentPane().add(label);

label_1.setText("你已经拥有的牌:");

label_1.setBounds(109, 22, 270, 45);

getContentPane().add(label_1);

this.setBounds(200, 300, 501, 528);

this.setVisible(true);

getContentPane().add(getLabel_2());

}

public int randNumber() {

try {

Thread.sleep(10);

} catch (InterruptedException e) {

e.printStackTrace();

}

return (int) (Math.random() * 10 + 1);

}

public void onClick() {

number = this.randNumber();

this.sum += number;

label.setText("" + number);

String strTemp = this.label_1.getText();

strTemp += "" + number + " ";

label_1.setText(strTemp);

String temp = "合计:" + sum;

label_2.setText(temp);

isWin();

}

public void isWin() {

if (sum 21) {

JOptionPane.showMessageDialog(this, "你输了");

clear();

return;

} else if (sum == 21) {

JOptionPane.showMessageDialog(this, "你赢了");

clear();

return;

} else {

int i = JOptionPane.showOptionDialog(this, "是否继续?", "提示",

JOptionPane.OK_CANCEL_OPTION,

JOptionPane.INFORMATION_MESSAGE, null, null, null);

if (i == JOptionPane.OK_OPTION) {

onClick();

} else

return;

}

}

private void clear() {

label_2.setText("合计:");

sum = 0;

number = 0;

label_1.setText("你已经拥有的牌:");

}

/**

* @return

*/

protected JLabel getLabel_2() {

if (label_2 == null) {

label_2 = new JLabel();

label_2.setText("合计:");

label_2.setBounds(313, 35, 66, 18);

}

return label_2;

}

}

真好无聊中。。

亲有java语言写的超市管理系统课程设计和源代码吗,能给我吗

package untitled5;

import java.io.*;

import java.net.*;

import java.sql.*;

import java.lang.*;

import javax.sql.*;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import com.borland.jbcl.layout.*;

public class delbook extends JFrame {

JPanel contentPane;

XYLayout xYLayout1 = new XYLayout();

JLabel jLabel1 = new JLabel();

JLabel jLabel2 = new JLabel();

JLabel jLabel3 = new JLabel();

JTextField jTextField1 = new JTextField();

JLabel jLabel4 = new JLabel();

JTextField jTextField2 = new JTextField();

JLabel jLabel5 = new JLabel();

JTextField jTextField3 = new JTextField();

JLabel jLabel6 = new JLabel();

JTextField jTextField4 = new JTextField();

JButton jButton1 = new JButton();

//Construct the frame

public delbook() {

enableEvents(AWTEvent.WINDOW_EVENT_MASK);

try {

jbInit();

}

catch(Exception e) {

e.printStackTrace();

}

}

//Component initialization

private void jbInit() throws Exception {

contentPane = (JPanel) this.getContentPane();

jLabel1.setFont(new java.awt.Font("SansSerif", 0, 25));

jLabel1.setForeground(Color.red);

jLabel1.setText("超市管理系统");

contentPane.setLayout(xYLayout1);

this.setSize(new Dimension(500,400));

this.setTitle("超市管理系统");

jLabel2.setFont(new java.awt.Font("SansSerif", 0, 30));

jLabel2.setText("业务单位信息");

jLabel3.setFont(new java.awt.Font("SansSerif", 0, 25));

jLabel3.setText("产品编号");

jTextField1.setText("");

jLabel4.setFont(new java.awt.Font("SansSerif", 0, 25));

jLabel4.setText("公司名称");

jTextField2.setText("");

jLabel5.setFont(new java.awt.Font("SansSerif", 0, 25));

jLabel5.setText("订单号码");

jTextField3.setText("");

jLabel6.setFont(new java.awt.Font("SansSerif", 0, 25));

jLabel6.setText("电 话");

jTextField4.setText("");

jButton1.setFont(new java.awt.Font("SansSerif", 0, 25));

jButton1.setText("提交");

jButton1.addActionListener(new delbook_jButton1_actionAdapter(this));

contentPane.add(jLabel1, new XYConstraints(179, 1, 153, 32));

contentPane.add(jLabel2, new XYConstraints(162, 33, -1, -1));

contentPane.add(jLabel3, new XYConstraints(83, 89, -1, -1));

contentPane.add(jTextField1, new XYConstraints(189, 88, 141, 36));

contentPane.add(jTextField2, new XYConstraints(189, 149, 142, 36));

contentPane.add(jLabel4, new XYConstraints(84, 148, -1, -1));

contentPane.add(jTextField3, new XYConstraints(188, 206, 143, 33));

contentPane.add(jLabel5, new XYConstraints(84, 204, -1, -1));

contentPane.add(jLabel6, new XYConstraints(84, 253, -1, -1));

contentPane.add(jTextField4, new XYConstraints(189, 260, 143, 36));

contentPane.add(jButton1, new XYConstraints(197, 318, -1, -1));

}

//Overridden so we can exit when window is closed

protected void processWindowEvent(WindowEvent e) {

super.processWindowEvent(e);

if (e.getID() == WindowEvent.WINDOW_CLOSING) {

System.exit(0);

}

}

void update() {

try {

//定义显示的字符串

String str1;

String str2;

String str3;

String str4;

str1 = jTextField1.getText();

str2 = jTextField2.getText();

str3 = jTextField3.getText();

str4 = jTextField4.getText();

//装载jdbc驱动程序

String driverName = "oracle.jdbc.OracleDriver";

Driver driver = (Driver) Class.forName(driverName).newInstance();

//连接数据库

Connection con = DriverManager.getConnection(

"jdbc:oracle:thin:@thsspc0791:1521:liuyong", "hr", "tongfang");

PreparedStatement pstmt = con.prepareStatement(

" insert Customer1('goodID','Name','PID','tel')values(?,?,?,?)");

pstmt.setString(1, str1);

pstmt.setString(2, str2);

pstmt.setString(1, str3);

pstmt.setString(4, str4);

ResultSet res = pstmt.executeQuery();

pstmt.close();

con.close();

}catch (InstantiationException e) {

System.out.println(e.getMessage());

}catch (IllegalAccessException e) {

System.out.println(e.getMessage());

}catch (ClassNotFoundException e) {

System.out.println(e.getMessage());

}catch (SQLException edd) {

edd.printStackTrace() ;

System.out.println(edd.getMessage());

}

}

void jButton1_actionPerformed(ActionEvent e) {

update();

}

}

class delbook_jButton1_actionAdapter implements java.awt.event.ActionListener {

delbook adaptee;

delbook_jButton1_actionAdapter(delbook adaptee) {

this.adaptee = adaptee;

}

public void actionPerformed(ActionEvent e) {

adaptee.jButton1_actionPerformed(e);

}

}

package untitled5;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import com.borland.jbcl.layout.*;

/**

* pTitle: /p

* pDescription: /p

* pCopyright: Copyright © 2003/p

* pCompany: /p

* @author not attributable

* @version 1.0

*/

public class retur extends JFrame {

JPanel contentPane;

XYLayout xYLayout1 = new XYLayout();

JLabel jLabel1 = new JLabel();

//Construct the frame

public retur() {

enableEvents(AWTEvent.WINDOW_EVENT_MASK);

try {

jbInit();

}

catch(Exception e) {

e.printStackTrace();

}

}

//Component initialization

private void jbInit() throws Exception {

contentPane = (JPanel) this.getContentPane();

jLabel1.setFont(new java.awt.Font("SansSerif", 0, 20));

jLabel1.setForeground(Color.red);

jLabel1.setText("超市管理系统");

contentPane.setLayout(xYLayout1);

this.setSize(new Dimension(400, 300));

this.setTitle("超市管理系统");

contentPane.add(jLabel1, new XYConstraints(139, 1, 126, 33));

}

//Overridden so we can exit when window is closed

protected void processWindowEvent(WindowEvent e) {

super.processWindowEvent(e);

if (e.getID() == WindowEvent.WINDOW_CLOSING) {

System.exit(0);

}

}

}

package untitled5;

import java.io.*;

import java.net.*;

import java.sql.*;

import java.lang.*;

import javax.sql.*;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import com.borland.jbcl.layout.*;

import com.borland.dbswing.*;

//货品信息登记

public class Frame2 extends JFrame {

JPanel contentPane;

JLabel jLabel1 = new JLabel();

XYLayout xYLayout1 = new XYLayout();

JLabel jLabel2 = new JLabel();

JLabel jLabel3 = new JLabel();

JTextField jTextField1 = new JTextField();

JLabel jLabel4 = new JLabel();

JTextField jTextField2 = new JTextField();

JPanel jPanel1 = new JPanel();

XYLayout xYLayout2 = new XYLayout();

JScrollPane jScrollPane1 = new JScrollPane();

JLabel jLabel5 = new JLabel();

JTextField jTextField3 = new JTextField();

//Construct the frame

public Frame2() {

enableEvents(AWTEvent.WINDOW_EVENT_MASK);

try {

jbInit();

}

catch(Exception e) {

e.printStackTrace();

}

}

//Component initialization

private void jbInit() throws Exception {

contentPane = (JPanel) this.getContentPane();

contentPane.setLayout(xYLayout1);

this.setSize(new Dimension(600, 500));

this.setTitle("超市管理系统");

this.addHierarchyBoundsListener(new Frame2_this_hierarchyBoundsAdapter(this));

jLabel1.setFont(new java.awt.Font("SansSerif", 0, 25));

jLabel1.setForeground(Color.red);

jLabel1.setText("超市管理系统");

contentPane.setForeground(Color.black);

jLabel2.setFont(new java.awt.Font("SansSerif", 0, 30));

jLabel2.setText("产 品 信 息 展 示");

// statusBar.setFont(new java.awt.Font("SansSerif", 0, 20));

jLabel3.setFont(new java.awt.Font("SansSerif", 0, 20));

jLabel3.setText("产品名称");

jTextField1.setText("");

jLabel4.setEnabled(true);

jLabel4.setFont(new java.awt.Font("SansSerif", 0, 20));

jLabel4.setText("产品ID号");

jTextField2.setText("");

jTextField2.addActionListener(new Frame2_jTextField2_actionAdapter(this));

jPanel1.setLayout(xYLayout2);

jLabel5.setFont(new java.awt.Font("SansSerif", 0, 25));

jLabel5.setForeground(Color.red);

jLabel5.setText("该产品详细信息");

jTextField3.setText("");

contentPane.add(jLabel1, new XYConstraints(237, 0, 153, 40));

contentPane.add(jLabel2, new XYConstraints(200, 47, 231, 58));

contentPane.add(jLabel3, new XYConstraints(47, 102, 101, 42));

contentPane.add(jTextField1, new XYConstraints(128, 108, 112, 34));

contentPane.add(jTextField2, new XYConstraints(361, 107, 109, 36));

contentPane.add(jPanel1, new XYConstraints(75, 166, 453, 277));

jPanel1.add(jScrollPane1, new XYConstraints(14, 8, 433, 221));

jScrollPane1.getViewport().add(jTextField3, null);

jPanel1.add(jLabel5, new XYConstraints(112, 240, -1, -1));

contentPane.add(jLabel4, new XYConstraints(278, 111, -1, -1));

}

//Overridden so we can exit when window is closed

protected void processWindowEvent(WindowEvent e) {

super.processWindowEvent(e);

if (e.getID() == WindowEvent.WINDOW_CLOSING) {

System.exit(0);

}

}

void Select() {

try {

String str1, str2;

str1 = jTextField1.getText();

str2 = jTextField2.getText();

用Java怎样实现课表代码?有周次

课表数据时存储于数据库中的吗?

/**

* 获取一周的时间集合(从周一到周日)

* @param weekNum ;-1:上周;0:本周;1:下周

*/

public static ListDate getWeekDates(int weekNum){

ListDate list = new ArrayListDate();

Calendar cal = Calendar.getInstance();

// 获取指定下几个星期

cal.add(Calendar.DAY_OF_WEEK, weekNum * 7);

cal.setFirstDayOfWeek(Calendar.MONDAY);

cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);

list.add(cal.getTime());

for(int i = 0;i 6;i++){

cal.add(Calendar.DAY_OF_WEEK, 1);

list.add(cal.getTime());

}

return list;

}

这个是获取这一周时间的代码 ,之后用下面的代码获取周一到周日的日期

ListDate ds = DateUtil.getNowWeekDates(weekNum);

ds.get(0)//周一

ds.get(6)//周日

用这两个时间到数据库中进行范围查询,之后的你应该明白了吧

java课程设计题目及代码是什么?

java课程设计题目及代码分别是:

1、题目:计算器。设计内容是设计一个图形界面(GUI)的计算器应用程序,完成简单的算术运算。

设计要求是设计的计算器应用程序可以完成家法、减法、乘法、除法和取余运算。且有小数点、正负号、求倒数、退格和清零功能。

2、代码:

数字按钮NumberButton类如下:

import java.awt.

import java.awt.event.

import javax.swing.

public class NumberButton extends Button.

{

int number.

public NumberButton(int number).

{

super(""+number).

this.number=number.

setForeground(Color.blue).

}

public int getNumber().

{

return number;

}

}

其它java课程设计题目及代码是:

题目:华容道。编写一个按钮的子类,使用该子类创建的对象代表华容道中的人物。通过焦点事件控制人物颜色,当人物获得焦点时颜色为蓝色,当失去焦点时颜色为灰色。

通过键盘事件和鼠标事件来实现曹操、关羽等人物的移动。当人物上发生鼠标事件或键盘事件时,如果鼠标指针的位置是在人物的下方(也就是组件的下半部分)或按下键盘的“↓“键,该人物向下移动。向左、向右和向上的移动原理类似。

代码是:

String name[]={"曹操","关羽","张","刘","马","许","兵","兵","兵","兵"}.

for(int i=0;iname.length;i++).

{

person[i]=new Person(i,name[i]).

person[i].addKeyListener(this).

person[i].addMouseListener(this).

//     person[i].addFocusListener(new Person).

add(person[i]).

}

person[0].setBounds(104,54,100,100).

person[1].setBounds(104,154,100,50).

person[2].setBounds(54,154,50,100).

person[3].setBounds(204,154,50,100).

person[4].setBounds(54,54,50,100).

person[5].setBounds(204,54,50,100);

person[6].setBounds(54,254,50,50);

person[7].setBounds(204,254,50,50);

person[8].setBounds(104,204,50,50);

person[9].setBounds(154,204,50,50);

请帮我用JAVA数组的方式编写一个课程表,感激不尽!

public class IdUtil {

public static void main(String[] args) {

//七天的课程

String[] week = new String[7];

//每天的课程名

week[0] = "语文,语文,语文,语文,语文,语文,语文,语文,语文,语文";

week[1] = "数学,数学,数学,数学,数学,数学,数学,数学,数学,数学";

week[2] = "外语,外语,外语,外语,外语,外语,外语,外语,外语,外语";

week[3] = "物理,物理,物理,物理,物理,物理,物理,寂寞学,物理,物理";

week[4] = "化学,化学,化学,化学,化学,化学,化学,化学,化学,化学";

week[5] = "生物,生物,生物,生物,生物,生物,生物,生物,生物,生物";

week[6] = "寂寞学,寂寞学,寂寞学,寂寞学,寂寞学,寂寞学,寂寞学,寂寞学,寂寞学,寂寞学";

//上课时间

String[] time = {"8:00","9:00","8:00","8:00","8:00","8:00","8:00","8:00","8:00","8:00"};

for(int a=1;a8;a++){

System.out.print("\t"+"星期"+a);

}

System.out.println();

int b = 0;

for(int i=1;i11;i++){

switch (i) {

case 1:

System.out.println("上午");

break;

case 5:

System.out.println("下午");

break;

case 9:

System.out.println("晚上");

break;

}

System.out.print(time[i-1]+"\t");

for(int j=0;j7;j++){

System.out.print(week[j].split(",")[b]+"\t");

}

System.out.println();

b++;

}

}

}

java编写课程表Course

这个应该不难吧,网上有很多实例,你找一个,好好看一下逻辑,尝试着编写。


网站标题:java课程表源代码 java编程编写简单课程表
链接分享:http://cdxtjz.com/article/hgisgs.html

其他资讯