⑴ java课程设计!急!!!(高分)
我帮你编写了一部分,实现了“输入十个同学的相关信息,并在文本框中显示”(图形界面实现)。
要实现接下去的功能其实也真的不难的,但是真的很麻烦、很浪费时间……我就帮你做到这里了,你自己添加一下代码就可以(或者提高悬赏的话可以考虑考虑啊!哈哈……)代码如下:
importjava.awt.BorderLayout;
importjavax.swing.JPanel;
importjavax.swing.JFrame;
importjava.awt.Dimension;
importjavax.swing.JButton;
importjava.awt.Rectangle;
importjavax.swing.JLabel;
importjavax.swing.SwingConstants;
importjavax.swing.JScrollPane;
importjavax.swing.JTextArea;
importjavax.swing.JOptionPane;
{
=1L;
privateJPaneljContentPane=null;
privateJButtonjButton=null;
privateJLabeljLabel=null;
privateJScrollPanejScrollPane=null;
privateJTextAreajTextArea=null;
/**
*Thisisthedefaultconstructor
*/
publicTongJi(){
super();
initialize();
}
/**
*Thismethodinitializesthis
*
*@returnvoid
*/
privatevoidinitialize(){
this.setSize(412,372);
this.setContentPane(getJContentPane());
this.setTitle("成绩统计");
this.addWindowListener(newjava.awt.event.WindowAdapter(){
publicvoidwindowClosing(java.awt.event.WindowEvente){
System.exit(0);
}
});
this.setVisible(true);
}
/**
*
*
*@returnjavax.swing.JPanel
*/
privateJPanelgetJContentPane(){
if(jContentPane==null){
jLabel=newJLabel();
jLabel.setBounds(newRectangle(18,66,65,18));
jLabel.setHorizontalAlignment(SwingConstants.CENTER);
jLabel.setText("统计结果:");
jContentPane=newJPanel();
jContentPane.setLayout(null);
jContentPane.add(getJButton(),null);
jContentPane.add(jLabel,null);
jContentPane.add(getJScrollPane(),null);
}
returnjContentPane;
}
/**
*ThismethodinitializesjButton
*
*@returnjavax.swing.JButton
*/
privateJButtongetJButton(){
if(jButton==null){
jButton=newJButton();
jButton.setBounds(newRectangle(18,16,86,28));
jButton.setText("开始统计");
jButton.addActionListener(newjava.awt.event.ActionListener(){
publicvoidactionPerformed(java.awt.event.ActionEvente){
/////录入成绩信息
String[][]mymsg=newString[10][6];
for(inti=0;i<10;i++){
Stringstrnum=JOptionPane.showInputDialog(null,"请输入第"+(i+1)+"个学生的学号","信息录入",JOptionPane.WARNING_MESSAGE);
Stringstrname=JOptionPane.showInputDialog(null,"请输入第"+(i+1)+"个学生的姓名","信息录入",JOptionPane.WARNING_MESSAGE);
Stringdoublemath=JOptionPane.showInputDialog(null,"请输入第"+(i+1)+"个学生的数学成绩","信息录入",JOptionPane.WARNING_MESSAGE);
Stringdoubleeng=JOptionPane.showInputDialog(null,"请输入第"+(i+1)+"个学生的英语成绩","信息录入",JOptionPane.WARNING_MESSAGE);
Stringdoublejava=JOptionPane.showInputDialog(null,"请输入第"+(i+1)+"个学生的JAVA成绩","信息录入",JOptionPane.WARNING_MESSAGE);
Stringdoublecomp=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(inti=0;i<10;i++){
jTextArea.setText(jTextArea.getText()+" ");
for(intj=0;j<6;j++){
jTextArea.setText(jTextArea.getText()+mymsg[i][j]+"");
}
}
}
});
}
returnjButton;
}
/**
*
*
*@returnjavax.swing.JScrollPane
*/
(){
if(jScrollPane==null){
jScrollPane=newJScrollPane();
jScrollPane.setBounds(newRectangle(18,86,370,230));
jScrollPane.setViewportView(getJTextArea());
}
returnjScrollPane;
}
/**
*
*
*@returnjavax.swing.JTextArea
*/
privateJTextAreagetJTextArea(){
if(jTextArea==null){
jTextArea=newJTextArea();
jTextArea.setEditable(false);
}
returnjTextArea;
}
publicstaticvoidmain(Stringargs[]){
newTongJi();
}
}//@jve:decl-index=0:visual-constraint="10,10"
效果如下图:
⑵ java课程设计---计算器 要求如下:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
import java.util.LinkedList;
import java.io.*;
public class CalculatorWindow extends JFrame implements ActionListener{
NumberButton numberButton[];
OperationButton operationButton[];
JButton 小数点操作,正负号操作,退格操作,等号操作,清零操作,sin;
JTextField resultShow; //显示计算结果
JTextField showComputerProcess; //显示当前计算过程
JTextArea saveComputerProcess; //显示计算步骤
JButton saveButton,Button,clearButton;
LinkedList<String> list; //链表用来存放第一个运算数、运算符号和第二个运算数
HandleDigit handleDigit; //负责处理ActionEvent事件
HandleOperation handleOperation ;
HandleBack handleBack;
HandleClear handleClear;
HandleEquality handleEquality;
HandleDot handleDot;
HandlePOrN handlePOrN;
HandleSin handleSin;
public CalculatorWindow(){
setTitle("计算器");
JPanel panelLeft,panelRight;
list=new LinkedList<String>();
resultShow=new JTextField(10);
resultShow.setHorizontalAlignment(JTextField.RIGHT);
resultShow.setForeground(Color.blue);
resultShow.setFont(new Font("TimesRoman",Font.BOLD,16));
resultShow.setBorder(new SoftBevelBorder(BevelBorder.LOWERED));
resultShow.setEditable(false);
resultShow.setBackground(Color.white);
showComputerProcess=new JTextField();
showComputerProcess.setHorizontalAlignment(JTextField.CENTER);
showComputerProcess.setFont(new Font("Arial",Font.BOLD,16));
showComputerProcess.setBackground(Color.cyan);
showComputerProcess.setEditable(false);
saveComputerProcess=new JTextArea();
saveComputerProcess.setEditable(false);
saveComputerProcess.setFont(new Font("宋体",Font.PLAIN,16));
numberButton=new NumberButton[10];
handleDigit=new HandleDigit(list,resultShow,showComputerProcess);
for(int i=0;i<=9;i++){
numberButton[i]=new NumberButton(i);
numberButton[i].setFont(new Font("Arial",Font.BOLD,20));
numberButton[i].addActionListener(handleDigit);
}
operationButton=new OperationButton[4];
handleOperation=new HandleOperation(list,resultShow,
showComputerProcess,saveComputerProcess);
String 运算符号[]={"+","-","*","/"};
for(int i=0;i<4;i++){
operationButton[i]=new OperationButton(运算符号[i]);
operationButton[i].setFont(new Font("Arial",Font.BOLD,20));
operationButton[i].addActionListener(handleOperation);
}
小数点操作=new JButton(".");
handleDot=new HandleDot(list,resultShow,showComputerProcess);
小数点操作.addActionListener(handleDot);
正负号操作=new JButton("+/-");
handlePOrN=new HandlePOrN(list,resultShow,showComputerProcess);
正负号操作.addActionListener(handlePOrN);
等号操作=new JButton("=");
handleEquality=new HandleEquality(list,resultShow,
showComputerProcess,saveComputerProcess);
等号操作.addActionListener(handleEquality);
sin=new JButton("sin");
handleSin=new HandleSin(list,resultShow,
showComputerProcess,saveComputerProcess);
sin.addActionListener(handleSin);
退格操作=new JButton("退格");
handleBack=new HandleBack(list,resultShow,showComputerProcess);
退格操作.addActionListener(handleBack);
清零操作=new JButton("C");
handleClear=new HandleClear(list,resultShow,showComputerProcess);
清零操作.addActionListener(handleClear);
清零操作.setForeground(Color.red);
退格操作.setForeground(Color.red);
等号操作.setForeground(Color.red);
sin.setForeground(Color.blue);
正负号操作.setForeground(Color.blue);
小数点操作.setForeground(Color.blue);
panelLeft=new JPanel();
panelRight=new JPanel();
panelLeft.setLayout(new BorderLayout());
JPanel centerInLeft=new JPanel();
panelLeft.add(resultShow,BorderLayout.NORTH);
panelLeft.add(centerInLeft,BorderLayout.CENTER);
centerInLeft.setLayout(new GridLayout(4,5));
centerInLeft.add(numberButton[1]);
centerInLeft.add(numberButton[2]);
centerInLeft.add(numberButton[3]);
centerInLeft.add(operationButton[0]);
centerInLeft.add(清零操作);
centerInLeft.add(numberButton[4]);
centerInLeft.add(numberButton[5]);
centerInLeft.add(numberButton[6]);
centerInLeft.add(operationButton[1]);
centerInLeft.add(退格操作);
centerInLeft.add(numberButton[7]);
centerInLeft.add(numberButton[8]);
centerInLeft.add(numberButton[9]);
centerInLeft.add(operationButton[2]);
centerInLeft.add(sin);
centerInLeft.add(numberButton[0]);
centerInLeft.add(正负号操作);
centerInLeft.add(小数点操作);
centerInLeft.add(operationButton[3]);
centerInLeft.add(等号操作);
panelRight.setLayout(new BorderLayout());
panelRight.add(showComputerProcess,BorderLayout.NORTH);
saveButton=new JButton("保存");
Button=new JButton("复制");
clearButton=new JButton("清除");
saveButton.setToolTipText("保存计算过程到文件");
Button.setToolTipText("复制选中的计算过程");
clearButton.setToolTipText("清除计算过程");
saveButton.addActionListener(this);
Button.addActionListener(this);
clearButton.addActionListener(this);
panelRight.add(new JScrollPane(saveComputerProcess),BorderLayout.CENTER);
JPanel southInPanelRight=new JPanel();
southInPanelRight.add(saveButton);
southInPanelRight.add(Button);
southInPanelRight.add(clearButton);
panelRight.add(southInPanelRight,BorderLayout.SOUTH);
JSplitPane split=new JSplitPane
(JSplitPane.HORIZONTAL_SPLIT,panelLeft,panelRight);
add(split,BorderLayout.CENTER);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
setBounds(100,50,528,258);
validate();
}
public void actionPerformed(ActionEvent e){
if(e.getSource()==Button)
saveComputerProcess.();
if(e.getSource()==clearButton)
saveComputerProcess.setText(null);
if(e.getSource()==saveButton){
JFileChooser chooser=new JFileChooser();
int state=chooser.showSaveDialog(null);
File file=chooser.getSelectedFile();
if(file!=null&&state==JFileChooser.APPROVE_OPTION){
try{ String content=saveComputerProcess.getText();
StringReader read=new StringReader(content);
BufferedReader in= new BufferedReader(read);
FileWriter outOne=new FileWriter(file);
BufferedWriter out= new BufferedWriter(outOne);
String str=null;
while((str=in.readLine())!=null){
out.write(str);
out.newLine();
}
in.close();
out.close();
}
catch(IOException e1){}
}
}
}
public static void main(String args[]){
new CalculatorWindow();
}
}
⑶ 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课程设计
这是学校的课程设计么?规模不小啊......
解决这个问题应该首先先对增删改查的流程认识清楚,
不知道你们这个用不用框架,应该是不用,
先想想页面流程,先把网页的UI设计好
根据功能分出模块,
然后把各个页面打通,仔细想想各个表的关系和Sql语句怎么写
然后一个模块一个模块的解决,
如果用Javabean+jsp的模式做应该是两周时间够用了!
而且要求说的是尽可能多的实现功能!
我做一个这玩意也得2、3天的!
多了也没法帮你!