九九热最新网址,777奇米四色米奇影院在线播放,国产精品18久久久久久久久久,中文有码视频,亚洲一区在线免费观看,国产91精品在线,婷婷丁香六月天

歡迎來到裝配圖網(wǎng)! | 幫助中心 裝配圖網(wǎng)zhuangpeitu.com!
裝配圖網(wǎng)
ImageVerifierCode 換一換
首頁 裝配圖網(wǎng) > 資源分類 > DOC文檔下載  

文本編輯器 java課程設(shè)計(jì)實(shí)驗(yàn)報(bào)告 完整 預(yù)覽顯示不全 含全部代碼

  • 資源ID:67640035       資源大?。?span id="24d9guoke414" class="font-tahoma">9.99MB        全文頁數(shù):24頁
  • 資源格式: DOC        下載積分:16積分
快捷下載 游客一鍵下載
會(huì)員登錄下載
微信登錄下載
三方登錄下載: 微信開放平臺(tái)登錄 支付寶登錄   QQ登錄   微博登錄  
二維碼
微信掃一掃登錄
下載資源需要16積分
郵箱/手機(jī):
溫馨提示:
用戶名和密碼都是您填寫的郵箱或者手機(jī)號(hào),方便查詢和重復(fù)下載(系統(tǒng)自動(dòng)生成)
支付方式: 支付寶    微信支付   
驗(yàn)證碼:   換一換

 
賬號(hào):
密碼:
驗(yàn)證碼:   換一換
  忘記密碼?
    
友情提示
2、PDF文件下載后,可能會(huì)被瀏覽器默認(rèn)打開,此種情況可以點(diǎn)擊瀏覽器菜單,保存網(wǎng)頁到桌面,就可以正常下載了。
3、本站不支持迅雷下載,請(qǐng)使用電腦自帶的IE瀏覽器,或者360瀏覽器、谷歌瀏覽器下載即可。
4、本站資源下載后的文檔和圖紙-無水印,預(yù)覽文檔經(jīng)過壓縮,下載后原文更清晰。
5、試題試卷類文檔,如果標(biāo)題沒有明確說明有答案則都視為沒有答案,請(qǐng)知曉。

文本編輯器 java課程設(shè)計(jì)實(shí)驗(yàn)報(bào)告 完整 預(yù)覽顯示不全 含全部代碼

淮 海 工 學(xué) 院 計(jì)算機(jī)工程學(xué)院課程設(shè)計(jì)報(bào)告設(shè)計(jì)名稱: 面向?qū)ο笳n程設(shè)計(jì) 選題名稱: 文本編輯器的設(shè)計(jì)與實(shí)現(xiàn) 姓 名: 學(xué) 號(hào): 專業(yè)班級(jí): 系 (院): 計(jì)算機(jī)工程學(xué)院 設(shè)計(jì)時(shí)間: 2010.6.212010.7.2 設(shè)計(jì)地點(diǎn): 軟件實(shí)驗(yàn)室、教室 成績:指導(dǎo)教師評(píng)語: 簽名: 年 月 日面向?qū)ο笳n程設(shè)計(jì)報(bào)告 第 24 頁,共 24 頁1設(shè)計(jì)要求設(shè)計(jì)一個(gè)類似于Windows記事本(Notepad)的Java程序??梢源蜷_、新建、保存一個(gè)文本文件;對(duì)選中的文本進(jìn)行各種編輯操作(設(shè)置字體、字號(hào)、字型、對(duì)齊方式、背景、前景色、復(fù)制、粘貼、剪切、查找、替換等);在文本中能夠插入對(duì)象。2總體設(shè)計(jì)打開保存文件另存為查找紅色退出字體顏色復(fù)制編輯藍(lán)色剪切宋體綠色文本編輯器粘貼字體仿宋楷體粗體 字形斜體常規(guī)字號(hào)3詳細(xì)設(shè)計(jì)JTextArea textarea;/建立文本 JRadioButtonMenuItem rbmi_red,rbmi_blue,rbmi_green;/鼠標(biāo)右擊改變顏色 JMenuItem menuitem_copy,menuitem_cut,menuitem_paste,menuitem_seek;/復(fù)制,剪切,粘貼 JMenuItem menuitem_song,menuitem_fang,menuitem_kai;/字體變量 JMenuItem menuitem_normal,menuitem_bold,menuitem_italic;/字形變量 JMenuItem menuitem_12,menuitem_24,menuitem_36;/字號(hào)變量 JMenuItem menuitem_exit,menuitem_infor; JPopupMenu popupmenu;/文本快捷鍵 JMenuItem menuitem_red,menuitem_green,menuitem_blue;/顏色變量 JDialog dialog;/調(diào)用對(duì)話框 JButton button_seek;/查找 JTextField textfield_seek; JLabel label_seek,label_infor;4代碼調(diào)試程序代碼:import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.io.*;import javax.swing.JColorChooser;import javax.swing.event.*;public class Notepad extends JFrame implements ActionListener,ItemListener,MouseListener File file; JTextArea textarea; JRadioButtonMenuItem rbmi_red,rbmi_blue,rbmi_green; JMenuItem menuitem_copy,menuitem_cut,menuitem_paste,menuitem_seek; JMenuItem menuitem_song,menuitem_fang,menuitem_kai;/字體變量 JMenuItem menuitem_normal,menuitem_bold,menuitem_italic;/字形變量 JMenuItem menuitem_12,menuitem_24,menuitem_36;/字號(hào)變量 JMenuItem menuitem_exit,menuitem_infor; JMenuItem menuitem_zidingyi; JPopupMenu popupmenu; JMenuItem menuitem_red,menuitem_green,menuitem_blue; JDialog dialog; JButton button_seek; JTextField textfield_seek; JLabel label_seek,label_infor; String seek; public Notepad() super("文本編輯器"); this.setSize(600,400); this.setLocation(250,150); this.setDefaultCloseOperation(HIDE_ON_CLOSE); textarea = new JTextArea(); Container ss=this.getContentPane(); JScrollPane dd=new JScrollPane(textarea); ss.add(dd); this.textarea.addMouseListener(this); this.addMenu(); this.setVisible(true); this.Dialog(); this.file = null; public Notepad(String filename) this(); if (filename!=null) this.file = new File(filename); this.setTitle(filename); this.textarea.setText(this.readFromFile(); public Notepad(File file) this(); if (file!=null) this.file = file; this.setTitle(this.file.getName(); this.textarea.setText(this.readFromFile(); public void Dialog() /建立對(duì)話框的方法 dialog=new JDialog(this,"查找",true); dialog.setLayout(new FlowLayout(); dialog.setSize(200,90); label_seek=new JLabel("關(guān)鍵字"); dialog.add(label_seek); textfield_seek=new JTextField(10); dialog.add(textfield_seek); button_seek=new JButton("查找"); dialog.add(button_seek); button_seek.addActionListener(this); public void addMenu() JMenuBar menubar = new JMenuBar(); this.setJMenuBar(menubar); JMenu menu_file = new JMenu("文件"); /文件菜單 menubar.add(menu_file); JMenuItem menuitem_open = new JMenuItem("打開"); menu_file.add(menuitem_open); menuitem_open.addActionListener(this); JMenuItem menuitem_save = new JMenuItem("保存"); menu_file.add(menuitem_save); menuitem_save.addActionListener(this); JMenuItem menuitem_saveas = new JMenuItem("另存為"); menu_file.add(menuitem_saveas); menuitem_saveas.addActionListener(this); menuitem_exit=new JMenuItem("退出" ); menu_file.add(menuitem_exit); menuitem_exit.addActionListener(this); JMenu menu_editor=new JMenu("編輯");/編輯菜單 menubar.add(menu_editor); menuitem_seek=new JMenuItem("查找"); menu_editor.add(menuitem_seek); menuitem_seek.addActionListener(this); menuitem_copy=new JMenuItem("復(fù)制"); menuitem_copy.addActionListener(this); menu_editor.add(menuitem_copy); menuitem_cut=new JMenuItem("剪切"); menu_editor.add(menuitem_cut); menuitem_cut.addActionListener(this); menuitem_paste=new JMenuItem("粘貼"); menu_editor.add(menuitem_paste); menuitem_paste.addActionListener(this); JMenuItem menu_color=new JMenu("顏色");/顏色菜單 menu_editor.add(menu_color); ButtonGroup buttongroup=new ButtonGroup(); rbmi_red=new JRadioButtonMenuItem("紅",true); buttongroup.add(rbmi_red); menu_color.add(rbmi_red); rbmi_red.addItemListener(this); rbmi_blue=new JRadioButtonMenuItem("藍(lán)",true); buttongroup.add(rbmi_blue); menu_color.add(rbmi_blue); rbmi_blue.addItemListener(this); rbmi_green=new JRadioButtonMenuItem("綠",true); buttongroup.add(rbmi_green); menu_color.add(rbmi_green); rbmi_green.addItemListener(this); JMenu menu_font=new JMenu("設(shè)置字體");/設(shè)置字體菜單 menubar.add(menu_font); menuitem_song=new JMenuItem("宋體"); menu_font.add(menuitem_song); menuitem_song.addActionListener(this); menuitem_fang=new JMenuItem("仿宋"); menu_font.add(menuitem_fang); menuitem_fang.addActionListener(this); menuitem_kai=new JMenuItem("楷體"); menu_font.add(menuitem_kai); menuitem_kai.addActionListener(this); JMenu menu_style=new JMenu("設(shè)置字形");/設(shè)置字形菜單 menubar.add(menu_style); menuitem_bold=new JMenuItem("粗體"); menu_style.add(menuitem_bold); menuitem_bold.addActionListener(this); menuitem_italic=new JMenuItem("斜體"); menu_style.add(menuitem_italic); menuitem_italic.addActionListener(this);menuitem_normal=new JMenuItem("常規(guī)");menu_style.add(menuitem_normal);menuitem_normal.addActionListener(this); JMenu menu_size=new JMenu("設(shè)置字號(hào)"); /設(shè)置字號(hào)菜單 menubar.add(menu_size); menuitem_12=new JMenuItem("12"); menu_size.add(menuitem_12); menuitem_12.addActionListener(this); menuitem_24=new JMenuItem("24"); menu_size.add(menuitem_24); menuitem_24.addActionListener(this); menuitem_36=new JMenuItem("36"); menu_size.add(menuitem_36); menuitem_36.addActionListener(this); popupmenu=new JPopupMenu(); /快捷菜單 JMenuItem menuitem_red=new JMenuItem("紅色"); popupmenu.add(menuitem_red); menuitem_red.addActionListener(this); JMenuItem menuitem_green=new JMenuItem("綠色"); popupmenu.add(menuitem_green); menuitem_green.addActionListener(this); menuitem_blue=new JMenuItem("藍(lán)色"); popupmenu.add(menuitem_blue); menuitem_blue.addActionListener(this); textarea.add(popupmenu); /向文本區(qū)內(nèi)添加快捷菜單 public void writeToFile(String lines) /寫文件 try FileWriter fout = new FileWriter(this.file); fout.write(lines+"rn"); fout.close(); catch (IOException ioex) return; public String readFromFile() /讀文件 try FileReader fin = new FileReader(this.file); BufferedReader bin = new BufferedReader(fin); String aline="", lines="" do aline = bin.readLine(); if (aline!=null) lines += aline + "rn" while (aline!=null); bin.close(); fin.close(); return lines; catch (IOException ioex) return null; public boolean openDialog() /打開對(duì)話框 FileDialog filedialog = new FileDialog(this,"Open",FileDialog.LOAD); filedialog.setVisible(true); if (filedialog.getDirectory()!=null) && (filedialog.getFile()!=null) this.file = new File(filedialog.getDirectory(), filedialog.getFile(); return true; else return false; public boolean saveDialog() /保存對(duì)話框 FileDialog filedialog = new FileDialog(this,"SaveAs",FileDialog.SAVE); filedialog.setFile(this.file.getName(); filedialog.setVisible(true); if (filedialog.getDirectory()!=null) && (filedialog.getFile()!=null) this.file = new File(filedialog.getDirectory(), filedialog.getFile()+".txt"); return true; else return false; public void actionPerformed(ActionEvent e) /事件處理 if(e.getActionCommand()="打開") if (this.openDialog() this.setTitle(this.file.getName(); this.textarea.setText(this.readFromFile(); if(e.getActionCommand()="保存" && this.file!=null) this.writeToFile(this.textarea.getText(); if(e.getActionCommand()="保存" && this.file=null | e.getActionCommand()="另存為") if (this.saveDialog() this.writeToFile(this.textarea.getText(); this.setTitle(this.file.getName(); if(e.getActionCommand()="退出") System.exit(0); if(e.getSource()=menuitem_copy) /編輯菜單的事件處理 textarea.copy(); if(e.getSource()=menuitem_paste) textarea.paste(); if(e.getSource()=menuitem_cut) textarea.cut(); if(e.getSource()=menuitem_red) /顏色菜單的事件處理 textarea.setForeground(Color.red); if(e.getSource()=menuitem_blue) textarea.setForeground(Color.blue); if(e.getSource()=menuitem_green) textarea.setForeground(Color.green); Font font=textarea.getFont(); /設(shè)置字體變量 int style=font.getStyle(); if(e.getSource()=menuitem_song) textarea.setFont(new java.awt.Font("宋體",java.awt.Font.PLAIN,font.getSize(); if(e.getSource()=menuitem_fang) textarea.setFont(new java.awt.Font("仿宋",java.awt.Font.PLAIN,font.getSize(); if(e.getSource()=menuitem_kai) textarea.setFont(new java.awt.Font("楷體",java.awt.Font.PLAIN,font.getSize(); if(e.getSource()=menuitem_bold) /設(shè)置字形菜單的事件處理 style=style1; textarea.setFont(new java.awt.Font("",style,font.getSize(); if(e.getSource()=menuitem_italic) style=style2; textarea.setFont(new java.awt.Font("",style,font.getSize(); if(e.getSource()=menuitem_normal) style=style3; textarea.setFont(new java.awt.Font("",style,font.getSize(); if(e.getSource()=menuitem_12) textarea.setFont(new java.awt.Font(font.getName(),style,12); if(e.getSource()=menuitem_24) textarea.setFont(new java.awt.Font(font.getName(),style,24); if(e.getSource()=menuitem_36) textarea.setFont(new java.awt.Font(font.getName(),style,36); if(e.getSource()=menuitem_seek) /查找菜單項(xiàng)的處理事件 dialog.setVisible(true); seek=textarea.getText(); String tseek=textfield_seek.getText(); if(e.getSource()=button_seek) int i=textfield_seek.getText().length(); int j=seek.indexOf(tseek); textarea.setSelectionStart(j); textarea.setSelectionEnd(i+j); textfield_seek.setText(""); public void itemStateChanged(ItemEvent e) /ItemListener事件處理方法 if(e.getSource()=rbmi_red) textarea.setForeground(java.awt.Color.red); if(e.getSource()=rbmi_blue) textarea.setForeground(java.awt.Color.blue); if(e.getSource()=rbmi_green) textarea.setForeground(java.awt.Color.green); public void mouseClicked(MouseEvent mec) /鼠標(biāo)處理事件 if (mec.getModifiers()=mec.BUTTON3_MASK) popupmenu.show(textarea,mec.getX(),mec.getY(); public void mousePressed(MouseEvent mep) public void mouseReleased(MouseEvent mer) public void mouseEntered(MouseEvent mee) public void mouseExited(MouseEvent mex) public void mouseDragged(MouseEvent med) public static void main(String arg) /main方法 new Notepad("文本編輯器"); 編譯代碼實(shí)現(xiàn)各種功能:打開任意目錄下一文本文件:文件目錄下“另存為”功能:編輯目錄下“查找”功能:編輯目錄下“復(fù)制”“剪切”“粘貼”功能:字體設(shè)置功能:編輯目錄下“顏色“功能:設(shè)置字型功能:設(shè)置字號(hào)功能:運(yùn)行完畢,可關(guān)閉窗口退出程序或點(diǎn)擊文件目錄下的“退出”功能5. 軟件發(fā)布首先制作Manifest文件,代碼如下;Manifest-Version:1.0Mani-Class: notepadCreated-Boy:1.6(Sun Microsystems Inc.)保存為Manifest.mf,保存在D:java打開CMD 在DOS下生成jar文件:D:javajar cmf Notepad.jar Manifest.mf notepad.class生成JAR文件,雙擊運(yùn)行。6課程小結(jié)這次JAVA課程設(shè)計(jì)給我的最大的印象就是如果自己有了興趣,就動(dòng)手去做,困難在你的勇氣和毅力下是抬不了頭的。學(xué)習(xí)面向?qū)ο笠呀?jīng)有一學(xué)期了,想想走過的路程,顯得頗為有些艱辛,走了不少彎路.但總的說來,還是有不少的成績。從vc+的面向?qū)ο箝_始,我便接受了一種全新的思維方式,一改以前在面向過程中常用的方法.通過面向?qū)ο缶幊谭椒ǎ沟梦以诰幊痰臅r(shí)候,顯得更有思路和結(jié)構(gòu),尤其是它獨(dú)有的封裝性、多態(tài)性和繼承性特征,給了我莫大的幫助,這也是面向?qū)ο鬄槟壳白盍餍械乃季S方法的原因。首先,面向?qū)ο蟮木幊谭椒? 是靠“對(duì)象”來實(shí)現(xiàn)的,所謂對(duì)象也就是對(duì)事物特點(diǎn)的一種總體抽象,在程序中,我們也可以把它看成是一個(gè)基本的程序模塊。面向?qū)ο蠛腿说乃季S比較類似,這也是優(yōu)于面向過程的地方,掌握起來要比面向過程難一些。但如果這種技術(shù)能夠用得好的話,代碼就會(huì)比使用面向過程技術(shù)寫出來的要簡潔、易修改。同時(shí),面向?qū)ο蠓椒ǚ峙淞祟?、屬性、方法、消息機(jī)制等元素,用來進(jìn)行具體化對(duì)象的操作。對(duì)于類,我是這樣理解的,類是一個(gè)對(duì)一組相似對(duì)象的一般性描述(如,模板、模式或藍(lán)圖)。而一個(gè)程序又可以包含若干個(gè)類或是其子類,每種類也即是一種類型的封裝。在此基礎(chǔ)上 ,便引出了多態(tài)性的概念,對(duì)于某個(gè)類,如果要使用其中的變量或是函數(shù)方法,但又考慮到程序的簡潔、邏輯與可讀性,我們就可以在此類的基礎(chǔ)上進(jìn)行豐富,操作方法是先繼承(根據(jù)繼承類型的不同,函數(shù)體的訪問方法也不一致,屬性的繼承、方法的繼承),這樣在以后的方法中,就可以實(shí)現(xiàn)和前一類中函數(shù)體,同樣的功能。與此同時(shí),也可以實(shí)現(xiàn)這個(gè)類的多態(tài),就可以有不同的操作功能(根據(jù)需要進(jìn)行設(shè)定)。在vc+中可以實(shí)現(xiàn)類的多繼承,也就是同一個(gè)類可以被其他多個(gè)類繼承,而每個(gè)類又可以被子類在繼承,這在程序的設(shè)計(jì)方法中,實(shí)現(xiàn)了代碼的復(fù)用,使得程序更簡潔、可讀。從做這個(gè)JAVA開始無論遇到什么困難,我都沒有一絲的放棄的念頭。出于對(duì)知識(shí)的渴望,出于對(duì)新技術(shù)的好奇,出于對(duì)一切未知的求知。我完成了這次JAVA課程設(shè)計(jì),不過這只是我學(xué)習(xí)路上的驛站,各種語言本來就是相通的,語言并不重要畢竟它僅僅是工具,用好一個(gè)工具并不是一件值得為外人道的事情,主要是了解學(xué)習(xí)思想。通過自己的不懈的努力,經(jīng)過兩周的程序課程設(shè)計(jì)讓我感受很深,很是受益匪淺。

注意事項(xiàng)

本文(文本編輯器 java課程設(shè)計(jì)實(shí)驗(yàn)報(bào)告 完整 預(yù)覽顯示不全 含全部代碼)為本站會(huì)員(少***)主動(dòng)上傳,裝配圖網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)上載內(nèi)容本身不做任何修改或編輯。 若此文所含內(nèi)容侵犯了您的版權(quán)或隱私,請(qǐng)立即通知裝配圖網(wǎng)(點(diǎn)擊聯(lián)系客服),我們立即給予刪除!

溫馨提示:如果因?yàn)榫W(wǎng)速或其他原因下載失敗請(qǐng)重新下載,重復(fù)下載不扣分。




關(guān)于我們 - 網(wǎng)站聲明 - 網(wǎng)站地圖 - 資源地圖 - 友情鏈接 - 網(wǎng)站客服 - 聯(lián)系我們

copyright@ 2023-2025  zhuangpeitu.com 裝配圖網(wǎng)版權(quán)所有   聯(lián)系電話:18123376007

備案號(hào):ICP2024067431號(hào)-1 川公網(wǎng)安備51140202000466號(hào)


本站為文檔C2C交易模式,即用戶上傳的文檔直接被用戶下載,本站只是中間服務(wù)平臺(tái),本站所有文檔下載所得的收益歸上傳人(含作者)所有。裝配圖網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)上載內(nèi)容本身不做任何修改或編輯。若文檔所含內(nèi)容侵犯了您的版權(quán)或隱私,請(qǐng)立即通知裝配圖網(wǎng),我們立即給予刪除!