本文目录一览:
- 1、java 课程设计???
- 2、java课程设计(符合要求,别太深奥)
- 3、java课程设计题目及代码是什么?
- 4、Java课程设计!急!!!(高分)
- 5、java课程设计双机通信
- 6、Java课程设计
java 课程设计???
//父类MyMedia
public class MyMedia{
protected String mediaName;
protected float price;
protected String press;
protected String artist;
public MyMedia(String mn,float pri,String pre,String art){
mediaName=mn;
price=pri;
press=pre;
artist=art;
}
public void mediaNameInput(String mn){
mediaName=mn;
}
public void mediaPriceInput(float pri){
price=pri;
}
public void mediaPressInput(String pre){
press=pre;
}
public void mediaArtistInput(String art){
artist=art;
}
}
//子类MyBook
public class MyBook extends MyMedia{
private String editor;
private String publishDate;
private String bookISBN;
public MyBook(String mn,float pri,String pre,String art,String edi,String pub,String isbn){
super(mn,pri,pre,art);
editor=edi;
publishDate=pub;
bookISBN=isbn;
}
public void bookOtherInfo(String edi,String pub,String isbn){
editor=edi;
publishDate=pub;
bookISBN=isbn;
}
public void getBookInfo(){
System.out.println();
System.out.println("书名: "+mediaName);
System.out.println("书的价格:"+price);
System.out.println("书的出版社:"+press);
System.out.println("书的作者:"+artist);
System.out.println("书的editor:"+editor);
System.out.println("书的出版日期:"+publishDate);
System.out.println("书的bookISBN:"+bookISBN);
}
}
//子类MyCD
public class MyCD extends MyMedia{
private String cdISRC;
private String cdPublisher;
public MyCD(String mn,float pri,String pre,String art,String isrc,String cdp){
super(mn,pri,pre,art);
cdISRC=isrc;
cdPublisher=cdp;
}
public void CDOtherInfo(String isrc,String cdp){
cdISRC=isrc;
cdPublisher=cdp;
}
public void getCDInfo(){
System.out.println();
System.out.println("CD名: "+mediaName);
System.out.println("CD的价格:"+price);
System.out.println("CD的出版社:"+press);
System.out.println("CD的演唱者:"+artist);
System.out.println("CD的cdISRC:"+cdISRC);
System.out.println("CD的发行者:"+cdPublisher);
}
}
//子类MyTape
public class MyTape extends MyMedia{
private String TapeISRC;
public MyTape(String mn,float pri,String pre,String art,String isrc){
super(mn,pri,pre,art);
TapeISRC=isrc;
}
public void TapeOtherInfo(String isrc){
TapeISRC=isrc;
}
public void getTapeInfo(){
System.out.println();
System.out.println("CD名: "+mediaName);
System.out.println("CD的价格:"+price);
System.out.println("CD的出版社:"+press);
System.out.println("CD的演唱者:"+artist);
System.out.println("CD的TapeISRC:"+TapeISRC);
}
}
未完代叙 时间太晚了!!
QQ 383513327
java课程设计(符合要求,别太深奥)
俄罗斯方块没有 有自己做的贪食蛇
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.MouseAdapter;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.io.File;
import java.io.IOException;
import java.util.Random;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
public class GameMain extends JFrame implements Runnable {
int runY = 140;
int runX = 120;
int width = 600;
int height = 500;
int W = 10;
int M = 10;
int fangxiang = 0;
int sheshen[] = new int[200];
int foodx = 150;
int foody = 150;
int score = 0;
boolean zhuangtai = true;
class UsurKey extends KeyAdapter {
public void keyPressed(KeyEvent e) {
fangxiang = e.getKeyCode();
}
}
class UsurMouse extends MouseAdapter {
public void mouseClicked(MouseEvent e) {
System.out.println(e.getX() + "," + e.getY());
}
}
public GameMain() {
this.setSize(width, height);
this.setVisible(true);
this.addKeyListener(new UsurKey());
this.addMouseListener(new UsurMouse());
new Thread(this).start();
for (int i = 0; i W; i++) {
sheshen[i * 2] = runX + i * W;
sheshen[i * 2 + 1] = runY;
}
}
public static void main(String[] args) {
GameMain g = new GameMain();
}
int count = 0;
public void paint(Graphics g) {
g.fillRect(0, 0, width, height);
g.setColor(new Color(155, 155, 155));
try {
File file1 = new File("img/�0�8�0�8.jpg");
Image image = ImageIO.read(file1);
g.drawImage(image, 150, 100, null);
} catch (IOException e) {
e.printStackTrace();
}
g.drawRect(20, 50, width - 40, height - 100);
g.setColor(new Color(133, 195, 95));
for (int i = 0; i W; i++) {
g.fillRect(sheshen[i * 2], sheshen[i * 2 + 1], 10, 10);
}
g.setColor(new Color(255,255,0));
count++;
if(count%2==0){
g.fillRect(foodx, foody, M, M);
}
}
public void updata() {
if (fangxiang == KeyEvent.VK_UP) {
runY = runY - 10;
}
if (fangxiang == KeyEvent.VK_DOWN) {
runY = runY + 10;
}
if (fangxiang == KeyEvent.VK_RIGHT) {
runX = runX + 10;
}
if (fangxiang == KeyEvent.VK_LEFT) {
runX = runX - 10;
}
for (int i = W - 1; i 0; i--) {
sheshen[i * 2] = sheshen[(i - 1) * 2];
sheshen[i * 2 + 1] = sheshen[(i - 1) * 2 + 1];
}
sheshen[0] = runX;
sheshen[1] = runY;
if (sheshen[0] = 20 || sheshen[0] + W = 580) {
zhuangtai = false;
}
if (sheshen[1] = 50 || sheshen[1] + W = 450) {
zhuangtai = false;
}
Random rand= new Random();
if(sheshen[0]==foodxsheshen[1]==foody){
W++;
while(true){
foodx = Math.abs((rand.nextInt()%(50 + width-100 -10))/10*10);
foody = Math.abs((rand.nextInt()%(50 + height-100 -10))/10*10);
if(foodx60foody60){
boolean flag=true;
for(int i=0;iW;i++){
if(sheshen[2*i] == foodx sheshen[2*i+1] == foody){
flag=false;
}
}
if(flag){
break;
}
}
}
}
}
public void run() {
while (zhuangtai) {
try {
updata();
this.repaint();
Thread.sleep(50);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
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课程设计!急!!!(高分)
我帮你编写了一部分,实现了“输入十个同学的相关信息,并在文本框中显示”(图形界面实现)。
要实现接下去的功能其实也真的不难的,但是真的很麻烦、很浪费时间……我就帮你做到这里了,你自己添加一下代码就可以(或者提高悬赏的话可以考虑考虑啊!哈哈……)代码如下:
import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JFrame;
import java.awt.Dimension;
import javax.swing.JButton;
import java.awt.Rectangle;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JOptionPane;
public class TongJi extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JButton jButton = null;
private JLabel jLabel = null;
private JScrollPane jScrollPane = null;
private JTextArea jTextArea = null;
/**
* This is the default constructor
*/
public TongJi() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(412, 372);
this.setContentPane(getJContentPane());
this.setTitle("成绩统计");
this.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
this.setVisible(true);
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jLabel = new JLabel();
jLabel.setBounds(new Rectangle(18, 66, 65, 18));
jLabel.setHorizontalAlignment(SwingConstants.CENTER);
jLabel.setText("统计结果:");
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(getJButton(), null);
jContentPane.add(jLabel, null);
jContentPane.add(getJScrollPane(), null);
}
return jContentPane;
}
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
private JButton getJButton() {
if (jButton == null) {
jButton = new JButton();
jButton.setBounds(new Rectangle(18, 16, 86, 28));
jButton.setText("开始统计");
jButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
/////录入成绩信息
String[][] mymsg=new String[10][6];
for(int i=0;i10;i++){
String strnum=JOptionPane.showInputDialog(null, "请输入第"+(i+1)+"个学生的学号", "信息录入", JOptionPane.WARNING_MESSAGE);
String strname=JOptionPane.showInputDialog(null, "请输入第"+(i+1)+"个学生的姓名", "信息录入", JOptionPane.WARNING_MESSAGE);
String doublemath=JOptionPane.showInputDialog(null, "请输入第"+(i+1)+"个学生的数学成绩", "信息录入", JOptionPane.WARNING_MESSAGE);
String doubleeng=JOptionPane.showInputDialog(null, "请输入第"+(i+1)+"个学生的英语成绩", "信息录入", JOptionPane.WARNING_MESSAGE);
String doublejava=JOptionPane.showInputDialog(null, "请输入第"+(i+1)+"个学生的JAVA成绩", "信息录入", JOptionPane.WARNING_MESSAGE);
String doublecomp=JOptionPane.showInputDialog(null, "请输入第"+(i+1)+"个学生的计算机成绩", "信息录入", JOptionPane.WARNING_MESSAGE);
mymsg[i][0]=strnum;
mymsg[i][1]=strname;
mymsg[i][2]=doublemath;
mymsg[i][3]=doubleeng;
mymsg[i][4]=doublejava;
mymsg[i][5]=doublecomp;
}
////显示成绩信息
jTextArea.setText("学号 姓名 数学 英语 JAVA 计算机");
for(int i=0;i10;i++){
jTextArea.setText(jTextArea.getText()+"\r\n");
for(int j=0;j6;j++){
jTextArea.setText(jTextArea.getText()+mymsg[i][j]+" ");
}
}
}
});
}
return jButton;
}
/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setBounds(new Rectangle(18, 86, 370, 230));
jScrollPane.setViewportView(getJTextArea());
}
return jScrollPane;
}
/**
* This method initializes jTextArea
*
* @return javax.swing.JTextArea
*/
private JTextArea getJTextArea() {
if (jTextArea == null) {
jTextArea = new JTextArea();
jTextArea.setEditable(false);
}
return jTextArea;
}
public static void main(String args[]){
new TongJi();
}
} // @jve:decl-index=0:visual-constraint="10,10"
效果如下图:
java课程设计双机通信
图片大小与byte[]的关系是:1kb-- byte[] buf = new byte[1000]; 2kb-- byte[] buf = new byte[2000];一次类推。。。 服务器端:import java.io.FileInputStream;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;/*6、 编写客户/服务器程序,客户端Client2.java使用DatagramSocket对象将数据包发送到服务器,
* 请求获取服务器端的图像(考生可自选图像文件)。服务器端n3BT6 .java将图像文件包装成数据包,
* 并使用DatagramSocket对象将该数据包发送到客户端。首先将服务器端的程序编译通过,
* 并运行起来,等待客户的请求。
*/
public class n3BT6
{
DatagramSocket socket;
DatagramPacket packet;
DatagramSocket socket3;
DatagramPacket packet3;
DatagramSocket socket4;
DatagramPacket packet4;
DatagramSocket socket2;
DatagramPacket packet2;
byte[] buf = new byte[1024];
byte[] buf2 = new byte[50000];
FileInputStream in;
public n3BT6()
{
try
{
socket = new DatagramSocket(6005);
packet = new DatagramPacket(buf,buf.length);
socket.receive(packet);
socket3 = new DatagramSocket(6006);
packet3 = new DatagramPacket(buf,buf.length);
socket3.receive(packet3);
socket4 = new DatagramSocket(6007);
packet4 = new DatagramPacket(buf,buf.length);
socket4.receive(packet4);
System.out.println("客户的地址:"+packet.getAddress()+"\n"+new String(packet.getData()));
System.out.println("客户的地址:"+packet3.getAddress()+"\n"+new String(packet3.getData()));
System.out.println("客户的地址:"+packet4.getAddress()+"\n"+new String(packet4.getData()));
in = new FileInputStream("C:\\Documents and Settings\\Administrator\\桌面\\1.jpg");
in.read(buf2);
Thread.sleep(10);
socket2 = new DatagramSocket();
packet2 = new DatagramPacket(buf2,buf2.length,InetAddress.getLocalHost(),6008);
socket2.send(packet2);
}
catch(Exception e)
{
e.printStackTrace();
}
}
public static void main(String[] args)
{
new n3BT6();
}
} 客户端:import java.awt.Button;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;import javax.swing.ImageIcon;
import javax.swing.JFrame;public class Client2 extends Frame implements ActionListener
{
Button bt;
DatagramSocket socket;
DatagramPacket packet;DatagramSocket socket3;
DatagramPacket packet3;DatagramSocket socket4;
DatagramPacket packet4;DatagramSocket socket2;
DatagramPacket packet2;byte[] buf = new byte[50000];ImageIcon ima;
public Client2()
{
bt = new Button("获取图像");
this.add(bt,"North"); bt.addActionListener(this); setSize(800, 600);
setVisible(true);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
dispose();
}
}); try
{
socket = new DatagramSocket();
packet = new DatagramPacket("正在等待".getBytes(),"正在等待".getBytes().length,InetAddress.getByName("169.254.85.236"),6005); socket.send(packet);
socket3 = new DatagramSocket();
packet3 = new DatagramPacket("正在等待".getBytes(),"正在等待".getBytes().length,InetAddress.getLocalHost(),6006); socket3.send(packet3);
socket4 = new DatagramSocket();
packet4 = new DatagramPacket("正在等待".getBytes(),"正在等待".getBytes().length,InetAddress.getLocalHost(),6007); socket4.send(packet4);
socket2 = new DatagramSocket(6008);
packet2 = new DatagramPacket(buf,buf.length);
socket2.receive(packet2);
ima = new ImageIcon(packet2.getData()); }
catch (Exception e) {
e.printStackTrace();
}
}
public void paint(Graphics g)
{
if(ima != null)
g.drawImage(ima.getImage(), 0, 0,null);
}
public static void main(String[] args)
{
new Client2();
}
public void actionPerformed(ActionEvent arg0) { repaint();
}
}
Java课程设计
感觉不是特别麻烦。
文件系统是什么?就是读取个特殊文件吗?要解码?
界面建议你就用windowbuilder直接做吧,简单点。
要看到结果,选择题的好看,问题怎么判断。再来个论述题。
把要求写详细点。