Home Java Example Java Swing Java Swing
Questions:Ask|Latest

 
 

Share on Google+Share on Google+

Java Swing

Advertisement
After learning AWT, lets now see what's Swing? Well, Swing is important to develop Java programs with a graphical user interface (GUI).

Java Swing

     


After learning AWT, lets now see what's Swing? Well, Swing is important to develop Java programs with a graphical user interface (GUI). There are many components which are used for the building of GUI in Swing. The Swing Toolkit consists of many components for the building of GUI. These components are also helpful in providing interactivity to Java applications. Following are components which are included in Swing toolkit:

  • list controls
  • buttons
  • labels
  • tree controls
  • table controls

All AWT flexible components can be handled by the Java Swing. Swing toolkit contains far more components than the simple component toolkit. It is unique to any other toolkit in the way that it supports integrated internationalization, a highly customizable text package, rich undo support etc. Not only this you can also create your own look and feel using Swing other than the ones that are supported by it. The customized look and feel can be created using Synth which is specially designed. Not to forget that Swing also contains the basic user interface such as customizable painting, event handling, drag and drop etc.

The Java Foundation Classes (JFC) which supports many more features important to a GUI program comprises of Swing as well. The features which are supported by Java Foundation Classes (JFC) are the ability to create a program that can work in different languages, the ability to add rich graphics functionality etc.

The features which are provided by Swing and the Java Foundation Classes are as follows:

Swing GUI Components 

There are several components contained in Swing toolkit such as check boxes, buttons, tables, text etc. Some very simple components also provide sophisticated functionality. For instance, text fields provide formatted text input or password field behavior. Furthermore, the file browsers and dialogs can be used according to one's need and can even be customized.

 

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: May 22, 2009

Related Tutorials

Ask Questions?    Discuss: Java Swing   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
Stephen
May 24, 2011
notepad demo

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) { } }
M.Dineshkumar
June 2, 2011
tttttt

thank u
rajasekar
July 11, 2011
Reference

how use it text box and label box,check box and other useful information send
Kamlesh Yadav
August 26, 2011
Question

diffrence between String class and JButton class
soneia
September 25, 2011
scribble cut and paste program

can u pls send me the code of scribble cut and paste program in java
Rakesh Raushan
September 29, 2011
Discuss Question

problem in swing
manmath eklare
November 21, 2011
swing detail

how develop gui with swong
manu
December 21, 2011
jj

i like it.bt need 2 improve
manu
December 21, 2011
jj

i like it.bt need 2 improve
Deepak Kumar yadav
January 31, 2012
All Swing components with example

I want to learn all Swings component with example
Roz Gerhardth V. Estrada
May 12, 2012
acount

for just an exampled
rajagopal
June 20, 2012
java swing

thank you
nitin
August 14, 2012
great tutorials

nice one
saara
August 28, 2012
core java

need ur guidance more
sandeep singh
November 4, 2012
swing and awt

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

send me sample program of employeement registration form
vikas pal
November 7, 2011
java

tis site is very useful.
DMCA.com