Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * www.mediatutorial.web.id
- */
- import java.awt.*;
- import java.awt.event.KeyEvent;
- import javax.swing.JFrame;
- import javax.swing.UIManager;
- import javax.swing.UnsupportedLookAndFeelException;
- //kita menggunakan awt dan swing
- //swing diawali dengan "J"
- public class NotepadApp extends JFrame{
- private TextArea textarea = new TextArea("",0,0,TextArea.SCROLLBARS_VERTICAL_ONLY);
- //kita meunggunakan widht dan height 0 untuk supaya fit dengan window
- private MenuBar menubar = new MenuBar();
- private Menu file = new Menu();
- /*
- [[DAN LAIN LAIN LIHAT VIDEO]]
- */
- //contructor
- public NotepadApp(){
- setSize(500, 400);
- setTitle(title);
- setDefaultCloseOperation(EXIT_ON_CLOSE);
- textarea.setFont(new Font("Arial", Font.PLAIN, 12));
- add(textarea);
- //mari kita tambahan menu
- setMenuBar(menubar);
- menubar.add(file);
- file.setLabel("File");
- //mari kita tambahkan new item
- /*
- [[DAN LAIN LAIN LIHAT VIDEO]]
- */
- //mari kita tambahkan new item
- close.setLabel("Close");
- close.setShortcut(new MenuShortcut(KeyEvent.VK_F4, false));
- file.add(close);
- }
- public static void main(String args[]){
- NotepadApp notepad = new NotepadApp();
- notepad.setVisible(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment