<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ~~~ package draw.a8; import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.io.*; public class Test extends JFrame implements ActionListener { JMenuBar cd; JMenu cd1,cd2; JMenuItem cdx2,cdx3; JTextArea wby; public static void main(String[] args) { Test lx=new Test(); } Test() { cd=new JMenuBar(); cd1=new JMenu("文件(F)"); cd1.setMnemonic('F'); cd2=new JMenu("編輯(E)"); cd2.setMnemonic('E'); cdx2=new JMenuItem("打開",new ImageIcon("image/dk.jpg")); cdx2.addActionListener(this);//this監聽 cdx2.setActionCommand("open");//設置鍵值 cdx3=new JMenuItem("保存",new ImageIcon("image/bc.jpg")); cdx3.addActionListener(this); cdx3.setActionCommand("save"); wby=new JTextArea(); cd1.add(cdx2); cd1.add(cdx3); cd.add(cd1); cd.add(cd2); this.setJMenuBar(cd); this.add(wby); ImageIcon tp1=new ImageIcon("image/jsb.jpg"); this.setIconImage(tp1.getImage()); this.setTitle("記事本"); this.setSize(400,300); this.setLocation(300,280); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setVisible(true); } public void actionPerformed(ActionEvent e) { if(e.getActionCommand().equals("open")) { //System.out.println("打開"); JFileChooser wjxz=new JFileChooser();//文件選擇 wjxz.setDialogTitle("文件打開");//窗口標題 wjxz.showOpenDialog(null);//默認打開方式 wjxz.setVisible(true); FileReader wjl=null;//文件流 BufferedReader hcl=null;//緩存流 try { String wjlj=wjxz.getSelectedFile().getAbsolutePath(); //這行的作用是 得到用戶選擇的全路徑 //System.out.println(wjlj); wjl=new FileReader(wjlj); hcl=new BufferedReader(wjl); String s="",zfc=""; //循環讀取輸入至TextArea這樣寫就不會浪費空間,而且快 while(true){ String content = hcl.readLine(); if(content==null) break; wby.append(content); wby.append("\n"); } /*while((s=hcl.readLine())!=null) { zfc+=(s+"\n"); } wby.setText(zfc);*/ } catch(Exception aa){} finally { try { wjl.close(); hcl.close(); } catch (Exception e1) {} } } else if(e.getActionCommand().equals("save")) { //System.out.println("保存"); JFileChooser ljxz=new JFileChooser(); ljxz.setDialogTitle("另存為"); ljxz.showSaveDialog(null);//默認保存格式 ljxz.setVisible(true); try { String bclj=ljxz.getSelectedFile().getAbsolutePath();//全路徑 PrintStream pl = new PrintStream(bclj); System.setOut(pl);//不在控制臺輸出了 System.out.println(this.wby.getText()); } catch(Exception aa){} } } } ~~~ ![](https://box.kancloud.cn/32c680a3653e38ac21820dbf13100c23_399x297.png)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看