0% found this document useful (0 votes)
4 views3 pages

Java Employee CRUD Application

The document is a Java program that implements a simple GUI application for performing CRUD operations on a database using AWT and JDBC. It includes buttons for inserting, updating, deleting, and selecting data, and displays query results in a JTable. The application connects to a MySQL database and handles actions through an ActionListener interface.

Uploaded by

22co53
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Java Employee CRUD Application

The document is a Java program that implements a simple GUI application for performing CRUD operations on a database using AWT and JDBC. It includes buttons for inserting, updating, deleting, and selecting data, and displays query results in a JTable. The application connects to a MySQL database and handles actions through an ActionListener interface.

Uploaded by

22co53
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

import [Link].

*;

import [Link].*;

import [Link].*;

import [Link].*;

import [Link];

public class EMPCRUD2 extends Frame implements ActionListener

{ static String USER ;

static String PASS;

static String driver;

static String DB_URL;

Button jButton1;

Button jButton2;

Button jButton3;

Button jButton4;

ScrollPane jScrollPane1;

TextArea jTextArea1;

public EMPCRUD2()

{ addWindowListener(new WindowAdapter()

{ public void windowClosing(WindowEvent we)

{ [Link](0); }

});

Font myFont=new Font("Tahoma", 1, 26); // NOI18N

setLayout(new FlowLayout());

jButton1 = new Button("insert data");

jButton2 = new Button("update data");

jButton3 = new Button("delete data");

jButton4 = new Button("select");

[Link](myFont);

[Link](myFont);

[Link](myFont);
[Link](myFont);

jScrollPane1 = new ScrollPane();

jTextArea1 = new TextArea(500,600);

// [Link](500);

//[Link](500);

[Link](myFont);

[Link](500, 500);

[Link](jTextArea1);

add(jButton1);

add(jButton2);

add(jButton3);

add(jButton4);

add(jScrollPane1);

[Link](this);

[Link](this);

[Link](this);

[Link](this);

[Link]();

static void initconnectionData()

{ USER ="root";

PASS="";

driver="[Link]";

DB_URL = "jdbc:mysql://localhost/EMP";

public void actionPerformed(ActionEvent e)

{ String g=[Link]();

if([Link]("select"))

{ try

{ [Link](driver);

[Link]
("Connecting to database...");

Connection conn =

[Link]

(DB_URL, USER, PASS);

String s=[Link]();

Statement stmt = [Link]();

ResultSet rs=[Link](s);

JTable jTable1=new JTable();

Font myFont=new Font("Tahoma", 1, 16);

[Link](myFont);

[Link]

([Link](rs));

JFrame j1=new JFrame();

JScrollPane pg = new JScrollPane(jTable1);

[Link](myFont);

[Link](pg);

[Link](500, 300);

[Link](true);

[Link]();

catch(ClassNotFoundException | SQLException y){}

public static void main(String args[])

{ EMPCRUD2 e=new EMPCRUD2();

[Link](new Dimension(370, 700));

[Link]("GraphicsDemo");

[Link](true);

You might also like