Swing

October 14th, 2006 Admin Posted in JFC/Swing No Comments »

Class JLabel

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JLabel

Constructor Summary

* JLabel()
* JLabel(Icon image)
* JLabel(Icon image, int horizontalAlignment)
* JLabel(String text)
* JLabel(String text, Icon icon, int horizontalAlignment)
* JLabel(String text, int horizontalAlignment)
*JButton()
Creates a button with no set text or icon.
*JButton(Icon icon)
Creates a button with an icon.
*JButton(String text)
Creates a button with text.
*JButton(String text, Icon icon)
Creates a button with initial text and an icon.

Border Classes(implements Border interface)

1. EmptyBorder
2. EtchedBorder
3. TitledBorder
4. SoftBevelBorder
5. MatteBorder
6. CompoundBorder

Class JOptionPane

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JOptionPane

JOptionPane Dialog types

showConfirmDialog
Asks a confirming question, like yes/no/cancel.
showInputDialog
Prompt for some input.
showMessageDialog
Tell the user about something that has happened.
showOptionDialog
The Grand Unification of the above three.

showMessageDialog Methods
1. showMessageDialog(Component parentComponent,Object message)
2. showMessageDialog(Component parentComponent,Object message, String title,int messageType)
3.showMessageDialog(Component parentComponent,Object message, String title,int messageType, Icon icon)
message type can be ERROR_MESSAGE,INFORMATION_MESSAGE,
WARNING_MESSAGE,QUESTION_MESSAGE,PLAIN_MESSAGE.

showInputDialog Methods

1.showInputDialog(Component parentComponent,Object message)
2.showInputDialog(Component parentComponent,Object message, String title,int messageType)
3.showInputDialog(Object message)

AddThis Social Bookmark Button

JFC/Swing

October 14th, 2006 Admin Posted in Home, JFC/Swing No Comments »

Java Foundation Classes also known as JFC are set of java packages consisting of
the following API

*AWT
*Swing components
*Java2D
*Drag and Drop
*Accessibility

A GUI presents a pictorial interface to a program. A GUI gives a program a distinctive ‘Look’ and ‘Feel’
If we look at a button on different machines it looks different. This concept is called ‘look and feel’
GUIs allow user to spend less time to learn the application and remember the things easily.

AWT: provides

*Provides Heavy weight components
*Delegation event model
*Printing

AWT  uses native OS’s Peers.
Peers are native GUI components that are manipulated by the AWT classes.

The Swing components are light weight components that offer replacements for heavyweight AWT components
Swing components include many other useful components like Separators, Image Buttons, Document
choosers, Color choosers, Progress bars,Tree structures and many more.

The Swing components are not implemented by platform-specific code.
They are entirely written in Java.
Swing provides greater level prortability and flexibility than AWT components.
All Swing components are present in the package javax.swing
All Swing components are java beans

AddThis Social Bookmark Button