Access Millions of academic & study documents

Add edit delete search with java gui

Content type
User Generated
Showing Page:
1/9
Navoa, Ronin Kristien S. May 19, 2021
BSIT 2Y2 - 1
Creating a database
Main.java
package RecordManagement;
public class Main {
public static void main(String[] args) {
new RecordWindow("select * from final_table order by prodid asc");
}
}
RecordWindow.java
package RecordManagement;
import javax.swing.*;

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/9
Navoa, Ronin Kristien S. May 19, 2021
BSIT 2Y2 - 1
import javax.swing.border.Border;
import java.awt.*;
import java.sql.*;
public class RecordWindow extends JFrame {
RecordWindow(String query){
this.setTitle("Record Management");
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setLayout(null);
this.setSize(920, 560);
this.setResizable(false);
this.setLocationRelativeTo(null);
WrapLayout layout = new WrapLayout();
layout.setHgap(0);
layout.setVgap(0);
JPanel tablePanel = new JPanel(layout);
JTextField searchField = new JTextField();
searchField.setBounds(0,0, 820,30);
searchField.addActionListener(e -> Search(searchField));
JButton searchButton = new JButton("search");
searchButton.setBounds(820,0, 90,30);
searchButton.addActionListener(e -> Search(searchField));
String instruction = "<html>Use the syntax fieldname:data ex:
prodid:1<br>Fields:<br>" +
"-prodid = Product ID<br>" +
"-prodname = Product Name<br>" +
"-proddesc = Product Description<br>" +
"-prodqty = Product Quantity<br>" +
"-price = Price<br>" +
"-category = Category</html>";
JButton addButton = new JButton("Add");
addButton.setBounds(730, 35, 90, 30);
addButton.addActionListener(e -> {
new EditWindow();
this.dispose();
});
// tablePanel.setBounds(0, 70, 920, 500);
// Table Headers
Border blackline = BorderFactory.createLineBorder(Color.black);
int cellWidth = 140;
JLabel prodidLabel = new JLabel("Product ID", SwingConstants.CENTER);
prodidLabel.setBorder(blackline);
prodidLabel.setPreferredSize(new Dimension(cellWidth,20));
JLabel prodnameLabel = new JLabel("Product Name",
SwingConstants.CENTER);
prodnameLabel.setBorder(blackline);
prodnameLabel.setPreferredSize(new Dimension(cellWidth,20));
JLabel proddescLabel = new JLabel("Product Description",
SwingConstants.CENTER);
proddescLabel.setBorder(blackline);
proddescLabel.setPreferredSize(new Dimension(cellWidth,20));
JLabel prodqtyLabel = new JLabel("Product Quantity",

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/9

Sign up to view the full document!

lock_open Sign Up
End of Preview - Want to read all 9 pages?
Access Now
Unformatted Attachment Preview
Navoa, Ronin Kristien S. BSIT 2Y2 - 1 May 19, 2021 Creating a database Main.java package RecordManagement; public class Main { public static void main(String[] args) { new RecordWindow("select * from final_table order by prodid asc"); } } RecordWindow.java package RecordManagement; import javax.swing.*; Navoa, Ronin Kristien S. BSIT 2Y2 - 1 May 19, 2021 import javax.swing.border.Border; import java.awt.*; import java.sql.*; public class RecordWindow extends JFrame { RecordWindow(String query){ this.setTitle("Record Management"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLayout(null); this.setSize(920, 560); this.setResizable(false); this.setLocationRelativeTo(null); WrapLayout layout = new WrapLayout(); layout.setHgap(0); layout.setVgap(0); JPanel tablePanel = new JPanel(layout); JTextField searchField = new JTextField(); searchField.setBounds(0,0, 820,30); searchField.addActionListener(e -> Search(searchField)); JButton searchButton = new JButton("search"); searchButton.setBounds(820,0, 90,30); searchButton.addActionListener(e -> Search(searchField)); String instruction = "Use the syntax fieldname:data ex: prodid:1Fields:" + "-prodid = Product ID" + "-prodname = Product Name" + "-proddesc = Product Description" + "-prodqty = Product Quantity" + "-price = Price" + "-category = Category"; JButton addButton = new JButton("Add"); addButton.setBounds(730, 35, 90, 30); addButton.addActionListener(e -> { new EditW ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.
Studypool
4.7
Indeed
4.5
Sitejabber
4.4

Similar Documents