案例 9:简易记事本(使用 Swing)

阅读 18

05-20 09:00

import javax.swing.*;

import java.awt.*;


public class SimpleNotepad {

   public static void main(String[] args) {

       JFrame frame = new JFrame("简易记事本");

       JTextArea textArea = new JTextArea();

       JScrollPane scroll = new JScrollPane(textArea);


       frame.add(scroll, BorderLayout.CENTER);

       frame.setSize(500, 400);

       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

       frame.setVisible(true);

   }

}import javax.swing.*;

import java.awt.*;


public class SimpleNotepad {

   public static void main(String[] args) {

       JFrame frame = new JFrame("简易记事本");

       JTextArea textArea = new JTextArea();

       JScrollPane scroll = new JScrollPane(textArea);


       frame.add(scroll, BorderLayout.CENTER);

       frame.setSize(500, 400);

       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

       frame.setVisible(true);

   }

}import javax.swing.; import java.awt.;

public class SimpleNotepad { public static void main(String[] args) { JFrame frame = new JFrame("简易记事本"); JTextArea textArea = new JTextArea(); JScrollPane scroll = new JScrollPane(textArea);

frame.add(scroll, BorderLayout.CENTER);
    frame.setSize(500, 400);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
}

}

精彩评论(0)

0 0 举报