Insert into table using Java Swing Posted on: June 4, 2010 at 12:00 AM
In this section, We will insert rows into "Mysql" database using "Swing". INSERTION IN TABLE USING SWING In this section, We will insert rows into "Mysql" database using "Swing".
What is Swing? Swing is the extension to the Awt library, includes new and improved
components that enhance the look and functionality of GUIs.It's components are
light weight than Awt component. Swing can be used to build Standalone GUI
Application as well as Servlets and Applets. Swing is more portable and
more flexible than AWT. inswing.java
import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.sql.*; public class inswing implements ActionListener
{ JFrame fr;JPanel po;
JLabel l1,l2,l4,l11,main;JTextField tf1,tf2;
JComboBox S1,gender;GridBagConstraints gbc;
GridBagLayout go;JButton ok,exit; public inswing(){
fr=new JFrame("New Record Entry");Font f=new Font("Verdana",Font.BOLD,24);
po=new JPanel();fr.getContentPane().add(po);fr.setVisible(true);
fr.setSize(1024,768);fr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
po.setBackground(Color.orange);
go=new GridBagLayout();gbc=new GridBagConstraints();
po.setLayout(go);
main=new JLabel("NEW RECORD ENTRY");main.setFont(f);