導航:首頁 > 編程語言 > java日歷課程設計

java日歷課程設計

發布時間:2025-05-11 19:17:31

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天的!
多了也沒法幫你!

閱讀全文

與java日歷課程設計相關的資料

熱點內容
程序員公園采訪 瀏覽:801
程序員實戰教程要多長時間 瀏覽:964
企業數據加密技巧 瀏覽:125
租雲伺服器開發 瀏覽:804
程序員告白媽媽不同意 瀏覽:327
攻城掠地怎麼查看伺服器 瀏覽:592
android開機黑屏 瀏覽:568
mc純生存伺服器是什麼意思 瀏覽:440
樹莓派火焰蜂鳴器python 瀏覽:898
我的世界伺服器強制疾跑怎麼開 瀏覽:277
用什麼app看施工圖紙 瀏覽:493
張三學python函數 瀏覽:379
女子程序員照片 瀏覽:307
武漢c程序員招聘 瀏覽:684
csk跟蹤演算法 瀏覽:26
數據挖掘中用到的演算法 瀏覽:845
更改ubuntu伺服器地址 瀏覽:504
學做燒菜用什麼app 瀏覽:704
程序框圖怎麼加密 瀏覽:374
文件自解壓失敗怎麼辦 瀏覽:901