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

《Java程序設(shè)計(jì)》課程綜合性實(shí)驗(yàn)報(bào)告簡易寫字板軟件設(shè)計(jì)

上傳人:仙*** 文檔編號(hào):28048797 上傳時(shí)間:2021-08-23 格式:DOC 頁數(shù):24 大?。?88.56KB
收藏 版權(quán)申訴 舉報(bào) 下載
《Java程序設(shè)計(jì)》課程綜合性實(shí)驗(yàn)報(bào)告簡易寫字板軟件設(shè)計(jì)_第1頁
第1頁 / 共24頁
《Java程序設(shè)計(jì)》課程綜合性實(shí)驗(yàn)報(bào)告簡易寫字板軟件設(shè)計(jì)_第2頁
第2頁 / 共24頁
《Java程序設(shè)計(jì)》課程綜合性實(shí)驗(yàn)報(bào)告簡易寫字板軟件設(shè)計(jì)_第3頁
第3頁 / 共24頁

下載文檔到電腦,查找使用更方便

15 積分

下載資源

還剩頁未讀,繼續(xù)閱讀

資源描述:

《《Java程序設(shè)計(jì)》課程綜合性實(shí)驗(yàn)報(bào)告簡易寫字板軟件設(shè)計(jì)》由會(huì)員分享,可在線閱讀,更多相關(guān)《《Java程序設(shè)計(jì)》課程綜合性實(shí)驗(yàn)報(bào)告簡易寫字板軟件設(shè)計(jì)(24頁珍藏版)》請(qǐng)?jiān)谘b配圖網(wǎng)上搜索。

1、華北科技學(xué)院計(jì)算機(jī)系綜合性實(shí)驗(yàn)報(bào)告華北科技學(xué)院計(jì)算機(jī)系綜合性實(shí)驗(yàn)實(shí) 驗(yàn) 報(bào) 告 課程名稱 Java程序設(shè)計(jì) 實(shí)驗(yàn)學(xué)期 2011 至 2012 學(xué)年 第 1 學(xué)期學(xué)生所在系部 基礎(chǔ)部 年級(jí) 2009 專業(yè)班級(jí) 計(jì)算B092 學(xué)生姓名 學(xué)號(hào) 任課教師 實(shí)驗(yàn)成績 計(jì)算機(jī)系制Java程序設(shè)計(jì)課程綜合性實(shí)驗(yàn)報(bào)告開課實(shí)驗(yàn)室: 基礎(chǔ)實(shí)驗(yàn)室 2011 年 12 月 5 日實(shí)驗(yàn)題目簡易寫字板軟件設(shè)計(jì)一、 實(shí)驗(yàn)?zāi)康膇. 通過編寫Java的應(yīng)用系統(tǒng)綜合實(shí)例簡易寫字板軟件,總結(jié)、回顧和實(shí)踐面向?qū)ο蟮木幊趟枷胍约熬幊谭椒ǎ⑼ㄟ^編寫程序來掌握J(rèn)ava語言編程技巧,將學(xué)習(xí)到的知識(shí)融會(huì)貫通,同時(shí)提高調(diào)試程序的能力,養(yǎng)成良好

2、的編程習(xí)慣,并增強(qiáng)對(duì)程序設(shè)計(jì)整體思路的把握。ii. 熟悉在集成開發(fā)環(huán)境下編寫Java程序。二、 設(shè)備與環(huán)境iii. 硬件:多媒體計(jì)算機(jī)iv. 軟件:Windows 2000以上的操作系統(tǒng)、JDK開發(fā)包、集成開發(fā)環(huán)境三、 實(shí)驗(yàn)內(nèi)容v. 總體要求:程序功能基本完成,用戶界面友好,代碼的可維護(hù)性和可擴(kuò)展性較好,最好包括必要的注釋和相應(yīng)的文檔。vi. 具體要求:基本的文本錄入,字符修改,刪除,換行,粘貼,復(fù)制,剪切等功能,主要包括:2. 菜單欄設(shè)計(jì)及功能實(shí)現(xiàn):菜單欄主要包括文件、編輯、格式、幫助等常見菜單。其中文件菜單有新建、打開、保存、另存為、退出等功能;編輯菜單有剪切、復(fù)制、粘貼、等功能;格式菜單

3、含有對(duì)文字字體、字型、字號(hào)及顏色等的設(shè)置功能,根據(jù)情況可在編輯菜單添加查找和查找替換功能。3. 編輯區(qū)設(shè)計(jì):對(duì)文本的編輯處理區(qū)。4. 工具欄設(shè)計(jì):可根據(jù)需要增加該項(xiàng)功能。5. 其他功能設(shè)計(jì)。四、 實(shí)驗(yàn)結(jié)果及分析1 主界面的設(shè)計(jì)與實(shí)現(xiàn)a) 整個(gè)界面共包括四個(gè)部分,包括:標(biāo)題欄、菜單欄、編輯區(qū)、狀態(tài)欄以及滾動(dòng)條,如圖1所示。b)6. 圖表 1記事本的整體布局menuBar=new JMenuBar();setJMenuBar(menuBar);menu=new JMenu5;menuItem=new JMenuItemmenu.length;menu0=new JMenu(文件(F);menu0.

4、setMnemonic(F);menu1=new JMenu(編輯(E);menu1.setMnemonic(E);menu2=new JMenu(格式(O);menu2.setMnemonic(O);menu3=new JMenu(查看(V);menu3.setMnemonic(V);menu4=new JMenu(幫助(H);menu4.setMnemonic(H);7. 菜單的設(shè)計(jì)a) 本程序共設(shè)計(jì)四個(gè)菜單,分別是文件、編輯、格式、幫助四個(gè)菜單的功能, b) 針對(duì)記事本的需求,文件菜單欄實(shí)現(xiàn)了新建、打開、保存、另存為、退出的功能。如圖二所示。c)8. 圖表 2文件菜單欄menuItem0

5、=new JMenuItem5;menuItem1=new JMenuItem7;menuItem2=new JMenuItem2;menuItem3=new JMenuItem1;menuItem4=new JMenuItem1;menuItem00=new JMenuItem(新建(N);menuItem00.setMnemonic(N);menuItem01=new JMenuItem(打開(O) .);menuItem01.setMnemonic(O);menuItem02=new JMenuItem(保存(S);menuItem02.setMnemonic(S);menuItem03

6、=new JMenuItem(另存為(A) .);menuItem03.setMnemonic(A); menuItem04=new JMenuItem(關(guān)閉(C);menuItem04.setMnemonic(C);a) 編輯欄中實(shí)現(xiàn)了常見的剪切、復(fù)制、粘貼、查找與替換、全選以及時(shí)間/日期的功能。如圖三所示。b)9. 圖表 3編輯菜單欄menuItem10=new JMenuItem(剪切(X);menuItem10.setMnemonic(X);menuItem11=new JMenuItem(復(fù)制(C);menuItem11.setMnemonic(C);menuItem12=new J

7、MenuItem(粘貼(P);menuItem12.setMnemonic(P);menuItem13=new JMenuItem(查找(F);menuItem13.setMnemonic(F);menuItem14=new JMenuItem(替換(R);menuItem14.setMnemonic(R);menuItem15=new JMenuItem(全選(A);menuItem15.setMnemonic(A);menuItem16=new JMenuItem(時(shí)間/日期(T);menuItem16.setMnemonic(T);a) 格式欄中實(shí)現(xiàn)了自動(dòng)換行以及字體設(shè)置功能。如圖四所示

8、b)10. 圖表 4格式菜單欄menuItem20=new JCheckBoxMenuItem(自動(dòng)換行(W);menuItem20.setMnemonic(T);i. 在字體設(shè)置中實(shí)現(xiàn)了字體,字號(hào)、字形三個(gè)功能,如圖五所示。11.12.13. 圖表 5字體設(shè)置選項(xiàng)JTextArea ta;JScrollPane scr;JMenuBar menuBar;JMenu menu;JMenuItem menuItem, popupMenuItem;JPopupMenu popupMenu;JLabel lblStatus;JComboBox cbFont, cbSize, cbStyle;bool

9、ean changed;String curFileName;String schText=new String2;String strFonts;String strSize=8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72;String strStyle=常規(guī),粗體,斜體,粗斜體;Container ctn;SchInfo schInfo;GraphicsEnvironment ge;Font defaultFont=new Font(宋體, Font.PLAIN, 12), fonts;public zhaoliyang514()super(無標(biāo)

10、題 - 記事本);changed=false;curFileName=;lblStatus=new JLabel(就緒);ta=new JTextArea();scr=new JScrollPane(ta);ctn=getContentPane();ge=GraphicsEnvironment.getLocalGraphicsEnvironment();strFonts=ge.getAvailableFontFamilyNames();cbFont=new JComboBox(strFonts);cbFont.setFont(defaultFont);cbFont.setSelectedIte

11、m(宋體);cbSize=new JComboBox(strSize);cbSize.setFont(defaultFont);cbSize.setSelectedItem(12);cbStyle=new JComboBox(strStyle);cbFont.setSelectedItem(常規(guī));cbStyle.setFont(defaultFont);cbFont.addItemListener(new ItemListener()public void itemStateChanged(ItemEvent ie)int size, style;String fontName;fontNa

12、me=(String)cbFont.getSelectedItem();style=cbStyle.getSelectedIndex();size=Integer.parseInt(String)cbSize.getSelectedItem();Font font=new Font(fontName, style, size);ta.setFont(font););i. 幫助欄實(shí)現(xiàn)了關(guān)于記事本的介紹功能,如圖六所示。14.15. 圖表 6幫助欄選項(xiàng)if (ae.getSource()=menuItem40)JOptionPane.showMessageDialog(null,基礎(chǔ)部,計(jì)算B09

13、2 趙禮陽,關(guān)于 記事本,JOptionPane.INFORMATION_MESSAGE);16. 編輯區(qū)設(shè)計(jì)i. 在編輯區(qū)中通過getContentPane().add(new JScrollPane(text)成功實(shí)現(xiàn)了將要輸入的文本成功輸入到編輯區(qū)中,并且這句還增加了文本的滾動(dòng)條,增加了記事本的實(shí)用性。2 文件菜單中各項(xiàng)功能的實(shí)現(xiàn)ii. 在設(shè)計(jì)記事本中成功完成了文件欄中的新建、打開、保存、另存為、退出的功能。17.18. 圖表 7打開功能public void open()JFileChooser fc=new JFileChooser();if (fc.showOpenDialog(t

14、his)=JFileChooser.APPROVE_OPTION)String _curFileName=fc.getSelectedFile().getAbsolutePath();File file=new File(_curFileName);if (file.exists()curFileName=_curFileName;File f=new File(curFileName);setTitle(f.getName()+ - 記事本);changed=false;readFile(file);elseJOptionPane.showMessageDialog(null,file.ge

15、tAbsolutePath()+n找不到文件。n請(qǐng)檢查所給的文件名是否正確。n,打開失敗,JOptionPane.ERROR_MESSAGE);19.20. 圖表 8保存及另存為功能public void saveAs()JFileChooser fc=new JFileChooser();fc.setDialogTitle(另存為);if (fc.showSaveDialog(this)=JFileChooser.APPROVE_OPTION)boolean overwrite=false;String _curFileName=fc.getSelectedFile().getAbsolut

16、ePath();File file=new File(_curFileName);if (file.exists()int exit;exit=JOptionPane.showConfirmDialog(this,file.getAbsolutePath()+已存在。n要覆蓋它嗎? ,另存為,JOptionPane.YES_NO_OPTION);if (exit=JOptionPane.YES_OPTION)overwrite=true;elseoverwrite=true;if (overwrite)changed=false;saveFile(file);curFileName=_curF

17、ileName;File f=new File(curFileName);setTitle(f.getName()+ - 記事本);21. 3、格式菜單中各項(xiàng)功能的實(shí)現(xiàn)i. 在設(shè)計(jì)記事本的格式欄中成功完成了自動(dòng)換行以及字體的設(shè)置功能。其中在字體中包括了字體、字號(hào)、字形三個(gè)設(shè)置,達(dá)到了對(duì)字體設(shè)置的基本要求。22. 4、程序源代碼import java.io.*;import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.event.*;import java.util.*;class Sear

18、cher extends JDialogprivate JLabel Sample = new JLabel();private int curRow, curCol;private JTextField tfS;private JCheckBox chkCaseSensible;private JButton btnOK;private JButton btnCancel;private Searcher dlg;public static SchInfo schInfo;private JTextArea ta;public Searcher(Frame parent, boolean m

19、odal, JTextArea _ta)super(parent,modal);schInfo=new SchInfo();ta=_ta;Container ctn=getContentPane();JPanel ctn1=new JPanel();JPanel ctn2=new JPanel();JPanel ctn3=new JPanel();JPanel ctn4=new JPanel();btnOK=new JButton(查找下一個(gè));btnCancel=new JButton(取消);initAll();chkCaseSensible=new JCheckBox(區(qū)分大小寫, fa

20、lse);tfS=new JTextField(10);ctn.setLayout(new FlowLayout();ctn.add(ctn1);ctn.add(ctn2);ctn1.setLayout(new GridLayout(2, 1);ctn1.add(ctn3);ctn1.add(ctn4);ctn3.setLayout(new FlowLayout();ctn4.setLayout(new FlowLayout();ctn3.add(new JLabel(查找內(nèi)容:);ctn3.add(tfS);ctn4.add(chkCaseSensible);ctn2.setLayout(n

21、ew GridLayout(2, 1);ctn2.add(btnOK);ctn2.add(btnCancel);setTitle(查找);btnOK.addActionListener(new ActionListener()public void actionPerformed(ActionEvent ae)schInfo.str=tfS.getText();schInfo.caseSensible=chkCaseSensible.isSelected();String str=ta.getText();int index;if (schInfo.caseSensible)index=str

22、.indexOf(schInfo.str, ta.getCaretPosition();elseindex=str.toUpperCase().indexOf(schInfo.str.toUpperCase(), ta.getCaretPosition();if (index!=-1)ta.select(index, index+schInfo.str.length();elseJOptionPane.showMessageDialog(null,找不到+schInfo.str+,記事本,JOptionPane.INFORMATION_MESSAGE););btnCancel.addActio

23、nListener(new ActionListener()public void actionPerformed(ActionEvent ae)schInfo.str=;schInfo.caseSensible=false;setVisible(false););setVisible(true);private void initAll()setSize(400,140);setLocation(350,150);addWindowListener(new WindowAdapter()public void windowClosing(java.awt.event.WindowEvent

24、e)setVisible (false););class SchInfopublic String str;public boolean caseSensible;class Replacer extends JDialogprivate JLabel Sample = new JLabel();private int curRow, curCol;private JTextField tfS, tfR;private JCheckBox chkCaseSensible;private JButton btnOK, btnReplace;private JButton btnCancel;pr

25、ivate Replacer dlg;public static RplInfo schInfo;private JTextArea ta;public Replacer(Frame parent, boolean modal, JTextArea _ta)super(parent,modal);schInfo=new RplInfo();ta=_ta;Container ctn=getContentPane();JPanel ctn1=new JPanel();JPanel ctn2=new JPanel();JPanel ctn3=new JPanel();JPanel ctn4=new

26、JPanel();JPanel ctn5=new JPanel();btnOK=new JButton(查找下一個(gè));btnReplace=new JButton(替換);btnCancel=new JButton(取消);initAll();chkCaseSensible=new JCheckBox(區(qū)分大小寫, false);tfS=new JTextField(10);tfR=new JTextField(10);ctn.setLayout(new FlowLayout();ctn.add(ctn1);ctn.add(ctn2);ctn1.setLayout(new GridLayout

27、(3,1);ctn1.add(ctn3);ctn1.add(ctn4);ctn1.add(ctn5);ctn3.setLayout(new FlowLayout();ctn4.setLayout(new FlowLayout();ctn5.setLayout(new FlowLayout();ctn3.add(new JLabel(查找內(nèi)容:);ctn3.add(tfS);ctn4.add(new JLabel(替換為:);ctn4.add(tfR);ctn5.add(chkCaseSensible);ctn2.setLayout(new GridLayout(3, 1);ctn2.add(b

28、tnOK);ctn2.add(btnReplace);ctn2.add(btnCancel);setTitle(替換);btnOK.addActionListener(new ActionListener()public void actionPerformed(ActionEvent ae)schInfo.str=tfS.getText();schInfo.caseSensible=chkCaseSensible.isSelected();String str=ta.getText();int index;if (schInfo.caseSensible)index=str.indexOf(

29、schInfo.str, ta.getCaretPosition();elseindex=str.toUpperCase().indexOf(schInfo.str.toUpperCase(), ta.getCaretPosition();if (index!=-1)ta.select(index, index+schInfo.str.length();elseJOptionPane.showMessageDialog(null,找不到+schInfo.str+,記事本,JOptionPane.INFORMATION_MESSAGE););btnReplace.addActionListene

30、r(new ActionListener()public void actionPerformed(ActionEvent ae)String str=ta.getSelectedText();int index;schInfo.str=tfS.getText();if (str!=null & str.equals(tfS.getText()index=ta.getCaretPosition()-tfS.getText().length();elseschInfo.caseSensible=chkCaseSensible.isSelected();str=ta.getText();if (s

31、chInfo.caseSensible)index=str.indexOf(schInfo.str, ta.getCaretPosition();elseindex=str.toUpperCase().indexOf(schInfo.str.toUpperCase(), ta.getCaretPosition();str=ta.getText();if (index!=-1)str.replaceFirst(tfS.getText(), tfR.getText();String strTemp=str.substring(0, index)+tfR.getText()+str.substrin

32、g(index+tfS.getText().length(), str.length();str=strTemp;ta.setText(str);ta.setCaretPosition(index+tfR.getText().length();elseJOptionPane.showMessageDialog(null,找不到+schInfo.str+,記事本,JOptionPane.INFORMATION_MESSAGE););btnCancel.addActionListener(new ActionListener()public void actionPerformed(ActionE

33、vent ae)schInfo.str=;schInfo.caseSensible=false;setVisible(false););setVisible(true);private void initAll()setSize(400,140);setLocation(350,150);addWindowListener(new WindowAdapter()public void windowClosing(java.awt.event.WindowEvent e)setVisible (false););class RplInfo extends SchInfopublic String

34、 strR;public class zhaoliyang514 extends JFrame implements ActionListenerJTextArea ta;JScrollPane scr;JMenuBar menuBar;JMenu menu;JMenuItem menuItem, popupMenuItem;JPopupMenu popupMenu;JLabel lblStatus;JComboBox cbFont, cbSize, cbStyle;boolean changed;String curFileName;String schText=new String2;St

35、ring strFonts;String strSize=8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72;String strStyle=常規(guī),粗體,斜體,粗斜體;Container ctn;SchInfo schInfo;GraphicsEnvironment ge;Font defaultFont=new Font(宋體, Font.PLAIN, 12), fonts;public zhaoliyang514()super(無標(biāo)題 - 記事本);changed=false;curFileName=;lblStatus=new JLabel(就緒)

36、;ta=new JTextArea();scr=new JScrollPane(ta);ctn=getContentPane();ge=GraphicsEnvironment.getLocalGraphicsEnvironment();strFonts=ge.getAvailableFontFamilyNames();cbFont=new JComboBox(strFonts);cbFont.setFont(defaultFont);cbFont.setSelectedItem(宋體);cbSize=new JComboBox(strSize);cbSize.setFont(defaultFo

37、nt);cbSize.setSelectedItem(12);cbStyle=new JComboBox(strStyle);cbFont.setSelectedItem(常規(guī));cbStyle.setFont(defaultFont);cbFont.addItemListener(new ItemListener()public void itemStateChanged(ItemEvent ie)int size, style;String fontName;fontName=(String)cbFont.getSelectedItem();style=cbStyle.getSelecte

38、dIndex();size=Integer.parseInt(String)cbSize.getSelectedItem();Font font=new Font(fontName, style, size);ta.setFont(font););cbSize.addItemListener(new ItemListener()public void itemStateChanged(ItemEvent ie)int size, style;String fontName;fontName=(String)cbFont.getSelectedItem();style=cbStyle.getSe

39、lectedIndex();size=Integer.parseInt(String)cbSize.getSelectedItem();Font font=new Font(fontName, style, size);ta.setFont(font););cbStyle.addItemListener(new ItemListener()public void itemStateChanged(ItemEvent ie)int size, style;String fontName;fontName=(String)cbFont.getSelectedItem();style=cbStyle

40、.getSelectedIndex();size=Integer.parseInt(String)cbSize.getSelectedItem();Font font=new Font(fontName, style, size);ta.setFont(font););cbFont.setToolTipText(在這里設(shè)置字體);cbSize.setToolTipText(在這里設(shè)置字體大小);cbStyle.setToolTipText(在這里設(shè)置字體風(fēng)格);JPanel panel=new JPanel();panel.add(cbFont);panel.add(cbSize);panel

41、.add(cbStyle);ctn.setLayout(new BorderLayout();ctn.add(panel, BorderLayout.NORTH);ctn.add(scr, BorderLayout.CENTER);ctn.add(lblStatus, BorderLayout.SOUTH);showMenu();schText0=new String();schText1=new String();lblStatus.setFont(defaultFont);ta.setFont(defaultFont);ta.getDocument().addDocumentListene

42、r(new DocumentListener()public void changedUpdate(DocumentEvent de)lblStatus.setText(行數(shù):+ta.getLineCount();changed=true;public void insertUpdate(DocumentEvent de)lblStatus.setText(行數(shù):+ta.getLineCount();changed=true;public void removeUpdate(DocumentEvent de)lblStatus.setText(行數(shù):+ta.getLineCount();cha

43、nged=true;);addWindowListener(new WindowAdapter()public void windowClosing(WindowEvent we)closeAndSave();System.exit(0););ta.addMouseListener(new MouseAdapter()public void mouseReleased(MouseEvent me)if (me.isPopupTrigger()popupMenu.show(zhaoliyang514.this, me.getX()+10, me.getY()+80););public void

44、showMenu()menuBar=new JMenuBar();setJMenuBar(menuBar);menu=new JMenu5;menuItem=new JMenuItemmenu.length;menu0=new JMenu(文件(F);menu0.setMnemonic(F);menu1=new JMenu(編輯(E);menu1.setMnemonic(E);menu2=new JMenu(格式(O);menu2.setMnemonic(O);menu3=new JMenu(查看(V);menu3.setMnemonic(V);menu4=new JMenu(幫助(H);me

45、nu4.setMnemonic(H);menuItem0=new JMenuItem5;menuItem1=new JMenuItem7;menuItem2=new JMenuItem2;menuItem3=new JMenuItem1;menuItem4=new JMenuItem1;menuItem00=new JMenuItem(新建(N);menuItem00.setMnemonic(N);menuItem01=new JMenuItem(打開(O) .);menuItem01.setMnemonic(O);menuItem02=new JMenuItem(保存(S);menuItem

46、02.setMnemonic(S);menuItem03=new JMenuItem(另存為(A) .);menuItem03.setMnemonic(A);menuItem04=new JMenuItem(關(guān)閉(C);menuItem04.setMnemonic(C);menuItem10=new JMenuItem(剪切(X);menuItem10.setMnemonic(X);menuItem11=new JMenuItem(復(fù)制(C);menuItem11.setMnemonic(C);menuItem12=new JMenuItem(粘貼(P);menuItem12.setMnemo

47、nic(P);menuItem13=new JMenuItem(查找(F);menuItem13.setMnemonic(F);menuItem14=new JMenuItem(替換(R);menuItem14.setMnemonic(R);menuItem15=new JMenuItem(全選(A);menuItem15.setMnemonic(A);menuItem16=new JMenuItem(時(shí)間/日期(T);menuItem16.setMnemonic(T);menuItem20=new JCheckBoxMenuItem(自動(dòng)換行(W);menuItem20.setMnemoni

48、c(T);menuItem21=new JMenuItem(字體.);menuItem21.setEnabled(false);menuItem30=new JCheckBoxMenuItem(狀態(tài)欄(S), true);menuItem30.setMnemonic(S);menuItem40=new JMenuItem(關(guān)于(A) .);menuItem40.setMnemonic(S);popupMenuItem=new JMenuItem4;popupMenuItem0=new JMenuItem(剪切(X);popupMenuItem0.setMnemonic(X);popupMenu

49、Item1=new JMenuItem(復(fù)制(C);popupMenuItem1.setMnemonic(C);popupMenuItem2=new JMenuItem(粘貼(P);popupMenuItem2.setMnemonic(P);popupMenuItem3=new JMenuItem(全選(A);popupMenuItem3.setMnemonic(A);popupMenu=new JPopupMenu();for(int i=0; imenu.length; i+)menuBar.add(menui);menui.setFont(defaultFont);for (int j=

50、0; jmenuItemi.length; j+)menui.add(menuItemij);menuItemij.addActionListener(this);menuItemij.setFont(defaultFont);if (i=0 & j=3 | i=1 & j=2 | i=1 & j=4)menui.addSeparator();for (int i=0; ipopupMenuItem.length; i+)popupMenu.add(popupMenuItemi);popupMenuItemi.addActionListener(this);popupMenuItemi.set

51、Font(defaultFont);if (i=2)popupMenu.addSeparator();public void readFile(File file)ta.setText();tryBufferedReader in=new BufferedReader(new FileReader(file);String read;char readBuf=new char20480;int n=0;while (true)n=in.read(readBuf, 0, 20480);if (n=-1)break;read=new String(readBuf, 0, n);ta.append(

52、read);in.close();ta.setCaretPosition(0);catch (IOException ioe)JOptionPane.showMessageDialog(null,I/O 錯(cuò)誤:+ioe+。n,打開失敗,JOptionPane.ERROR_MESSAGE);public void saveFile(File file)tryFileWriter fw_out=new FileWriter(file);PrintWriter out=new PrintWriter(new BufferedWriter(fw_out);String outData=ta.getText();String outLine;outLine=outData.spli

展開閱讀全文
溫馨提示:
1: 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
2: 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
3.本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
5. 裝配圖網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

相關(guān)資源

更多
正為您匹配相似的精品文檔
關(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),我們立即給予刪除!