online tutorials, website development, web application development

   

Java - Swings

AWT - Active Window Toolkit [Javax -> Swings Package]
  1. Swings is a special feature. It provides a set of powerful classes to design GUI. The classes available in swing will not depend on the operating system.
  2. Methods in swings classes are written purely in JAVA. The methods in swings classes can be used to create strings with a same look at field of the screens in different packages.

Subclasses of JComponent
  • JComponent [Abstract Button]
    • JButton
    • JMenu Item
      • JCheck Box Menu Item
      • JMenu
      • JRadio Button Menu Item
    • JToggle Button
      • JCheck Box
      • JRadio Button
    • JCombo Box
    • JInternel Frame
    • JLabel
      • Default Table Cell Renderer
    • JLayered Pane
      • JDesktop Pane
    • JList
    • JMenubar
    • JOption Pane
    • JPanel
      • Color Chooser Panel
    • JPopup Menu
      • JProgress Bar
      • JRoot Pane
      • JScroll Pane
      • JSeperator
      • JSlider
      • JSplit Pane
      • JTabbed Pane
      • JTable
      • JTable Header
      • JText Component
        • JEditor Pane
          • JText Pane
        • JText Area
        • JText Field
          • JPassword Field
      • JTool Bar
      • JTool Tip
      • JTree
      • JView Report
Containers - It is used to hold all the components
For Eg:
Container con = get ContentPane();
con.add(comp);

JButton:
JButton obj = new JButton(String);
JButton obj = new JButton();
ImageIcon i = new ImageIcon("imagefill");
JButton obj = new JButton(i);
JButton obj = new JButton(str, i);

How to set boundary to the JButtons:
obj.setBounds(10,10,100,30);

How to add:
con.add(obj);

To display the value in the textbox:
setText(String);

To retrive the value from the text box:
String s1 = t1.getText();
int n = Integer.parseInt(t1.getText());

Prepared Statement:
The application programs prepares a SQL statement using the java.sql.connection.prepare statement. It can handle n type of parameters.