Home Discussion Discuss: Java Swing

  • notepad demoStephen May 24, 2011 at 1:11 PM

    A new window is getting opened but i'm unable to get the output. This is my code: import java.awt.BorderLayout; import java.awt.Font; import java.awt.TextArea; import java.awt.event.*; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; public class NotepadDemo implements ActionListener { JFrame f=new JFrame(); JMenuBar mb=new JMenuBar(); JMenu file=new JMenu(); JMenu edit=new JMenu(); JMenu format=new JMenu(); JMenu view=new JMenu(); JMenu help=new JMenu(); private TextArea textArea = new TextArea("", 0,0, TextArea.SCROLLBARS_VERTICAL_ONLY); public static void main(String args[]){ NotepadDemo ntpd=new NotepadDemo(); } public NotepadDemo() { f.setTitle("Untitled - Notepad"); f.setSize(500,400); f.setResizable(true); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); textArea.setFont(new Font("Century Gothic", Font.BOLD, 12)); f.getContentPane().setLayout(new BorderLayout()); f.getContentPane().add(textArea); JMenuItem f1=new JMenuItem("New"); file.add(f1); JMenuItem f2=new JMenuItem("Open..."); file.add(f2); JMenuItem f3=new JMenuItem("Save"); file.add(f3); JMenuItem f4=new JMenuItem("Save As..."); file.add(f4); file.addSeparator(); JMenuItem f5=new JMenuItem("Page Setup"); file.add(f5); JMenuItem f6=new JMenuItem("Print..."); file.add(f6); file.addSeparator(); JMenuItem f7=new JMenuItem("Exit"); file.add(f7); mb.add(file); JMenuItem e1=new JMenuItem("Undo"); edit.add(e1); edit.addSeparator(); JMenuItem e2=new JMenuItem("Cut"); edit.add(e2); JMenuItem e3=new JMenuItem("Copy"); edit.add(e3); JMenuItem e4=new JMenuItem("Paste"); edit.add(e4); JMenuItem e5=new JMenuItem("Delete"); edit.add(e5); edit.addSeparator(); JMenuItem e6=new JMenuItem("Find..."); edit.add(e6); JMenuItem e7=new JMenuItem("Find Next"); edit.add(e7); JMenuItem e8=new JMenuItem("Replace"); edit.add(e8); JMenuItem e9=new JMenuItem("Go To..."); edit.add(e9); edit.addSeparator(); JMenuItem e10=new JMenuItem("Select All"); edit.add(e10); JMenuItem e11=new JMenuItem("Time/Date"); edit.add(e11); mb.add(edit); JMenuItem fm1=new JMenuItem("Word Wrap"); format.add(fm1); JMenuItem fm2=new JMenuItem("Font..."); format.add(fm2); mb.add(format); JMenuItem v1=new JMenuItem("Status Bar"); view.add(v1); mb.add(view); JMenuItem h1=new JMenuItem("View Help"); help.add(h1); help.addSeparator(); JMenuItem h2=new JMenuItem("About Notepad"); help.add(h2); mb.add(help); f.getContentPane().add(mb); f.setVisible(true); } public void actionPerformed(ActionEvent e) { } }

  • ttttttM.Dineshkumar June 2, 2011 at 11:47 AM

    thank u

  • Referencerajasekar July 11, 2011 at 9:12 AM

    how use it text box and label box,check box and other useful information send

  • QuestionKamlesh Yadav August 26, 2011 at 10:01 PM

    diffrence between String class and JButton class

  • swing detailmanmath eklare November 21, 2011 at 12:32 PM

    how develop gui with swong

  • jjmanu December 21, 2011 at 3:40 PM

    i like it.bt need 2 improve

  • jjmanu December 21, 2011 at 3:42 PM

    i like it.bt need 2 improve

  • acountRoz Gerhardth V. Estrada May 12, 2012 at 5:50 AM

    for just an exampled

  • java swingrajagopal June 20, 2012 at 2:34 PM

    thank you

  • core javasaara August 28, 2012 at 3:59 PM

    need ur guidance more

  • swing and awtsandeep singh November 4, 2012 at 1:23 PM

    does the swing overlap the awt which is advanced work tool and the animation of both these field relate to each other or not?

  • swingsanthosh December 3, 2012 at 12:14 PM

    send me sample program of employeement registration form

  • javavikas pal November 7, 2011 at 4:49 PM

    tis site is very useful.

Post your Comment



Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Related Articles
Java3D Questions

SWING
SWING  A JAVA CODE OF MOVING TRAIN IN SWING 

Swing AWT

swing
swing  How to make swing component auto-resizable when JFrame resize 

Swing AWT

swing
swing  Write a java swing program to delete a selected record from a table 

Swing AWT

Swing
Swing  Write a java swing program to search the details of the students. Searching is performed on studentā??s first name. The details of all those students having same name as in given in searching criterion will be displayed 

Swing AWT

Swing
Swing  Write a java swing program to search the details of the students. Searching is performed on studentā??s first name. The details of all those students having same name as in given in searching criterion will be displayed 

Swing AWT

swing
 

Swing AWT

swing
 

Swing AWT

Swing
 

Java Beginners

swing
 

Swing AWT

swing-awt - Swing AWT
swing-awt  Hi, Thanks for replying to my question...I'm getting some confusion to add action events in my application(Rich Text Editor).How to add action events? Thank U 

Swing AWT

java swing - Swing AWT
java swing  how i can insert multiple cive me exampleolumn and row in one JList in swing?plz g  Hi Friend, Please clarify your question. Thanks 

Swing AWT

swing/awt - Swing AWT
swing/awt  How to create richtexteditor using swings...?I'm very much new to swings....It's urgent.....Thank u...   hello read this book you get idea; JFC Swing Tutorial, The: A Guide to Constructing GUIs, Second 

Swing AWT

Swing paint - Swing AWT
the Swing Applet, use html file with the following code: Java Applet Demo...Swing paint  hi, i want to print something on window using swing applet.. m doing dis.. protected void paintComponent(Graphics g 

Design concepts & design patterns Questions

SWING FRMES
SWING FRMES  hai SIR? HOW TO DESIGN swing Frames send source code 

Design concepts & design patterns Questions

SWING FRMES
SWING FRMES  hai SIR? HOW TO DESIGN swing Frames send source code 

Swing AWT

Swing Program
Swing Program  Write a java swing program to calculate the age from given date of birth 

Swing AWT

swing sms
swing sms  HOW TO SEND SMS MESSAGE FROM SWING USING SQL DATABASE 

Swing AWT

java swing - Swing AWT
java swing  how to add image in JPanel in Swing?  Hi Friend, Try the following code: import java.awt.*; import java.awt.image....: http://www.roseindia.net/java/example/java/swing/ Thanks 

Swing AWT

java swing - Swing AWT
java swing   how i can insert in JFrame in swing?  Hi Friend, Try the following code: import java.awt.*; import javax.swing.*; import java.awt.event.*; class FormDemo extends JFrame { JButton ADD; JPanel 

Swing AWT

java swing - Swing AWT
java swing   Iam developing a java web browser.Actually my code works fine ie. i can load a web page without proxy.But in my place i have only proxy... a proxy or how to make my java web browser to listen to proxy setting??? please help 

Swing AWT

SWING - Swing AWT
SWING  how can i insert image in Jpanel by extending class with JFrame in swing?  Hi Friend, Try the following code: import java.awt.*; import java.awt.image.*; import java.io.*; import javax.imageio.*; import 

Java Beginners

Jva swing
Jva swing   How to create the model form like "Notepad 

Java Beginners

printing in swing
printing in swing  How can i print payslip in swing 

Framework Questions

java swing
java swing  view the book details using swing 

Java Interview Questions

AWT & SWING
AWT & SWING  What is diffennce between AWT & SWING 

Java Interview Questions

Java swing
Java swing  Does Swing contains any heavy weight component 

Java Interview Questions

Java swing
Java swing  what are the root classes of all classes in swing 

Swing AWT

swing program
swing program  Write a java swing program to getname and email id. Display the message if email id contains the name of theuser 

Swing AWT

Swing question - Swing AWT
Swing question  I want to move a string in JFrame similarily as done by marquee tag in HTML.The string should move from right to left. How can I do this?  Hi Friend, Try the following code: import java.awt. 

Swing AWT

swing - Swing AWT
swing   how to create JTabbedPane.when i choose one jtabbedpane it will appear JTextField,resultMessages.pls give me any examples  Hi Friend, Try the following code: import javax.swing.*; import java.awt. 

DMCA.com