Source code for owner of the project.
package RMSystems;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import net.proteanit.sql.DbUtils;
import java.awt.Toolkit;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.JScrollPane;
import java.awt.Font;
import javax.swing.border.LineBorder;
import java.awt.Color;
import javax.swing.JButton;
import javax.swing.ImageIcon;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Owner extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L;
private JPanel contentPane;
private JTable table;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Owner frame = new Owner();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
Connection con = null;
/**
* Create the frame.
*/
public void Refresh(){
try {
String query = “select Total from Total”;
PreparedStatement pst = con.prepareStatement(query);
ResultSet rs = pst.executeQuery();
table.setModel(DbUtils.resultSetToTableModel(rs));
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public Owner() {
con = sqliteConnection.dbConnector();
setTitle(“Owner”);
setIconImage(Toolkit.getDefaultToolkit().getImage(Owner.class.getResource(“/imgs/FoodPICCC.png”)));
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 573, 386);
contentPane = new JPanel();
contentPane.setBackground(new Color(0, 128, 128));
contentPane.setBorder(new LineBorder(Color.MAGENTA));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel lblNewLabel = new JLabel(“Total Amount”);
lblNewLabel.setForeground(Color.WHITE);
lblNewLabel.setBackground(Color.WHITE);
lblNewLabel.setFont(new Font(“Harlow Solid Italic”, Font.BOLD, 30));
lblNewLabel.setBounds(160, 92, 233, 38);
contentPane.add(lblNewLabel);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(160, 157, 233, 52);
contentPane.add(scrollPane);
table = new JTable();
scrollPane.setViewportView(table);
JButton btnExit = new JButton(“Exit”);
btnExit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
System.exit(0);
}
});
btnExit.setIcon(new ImageIcon(Owner.class.getResource(“/imgs/Exit.png”)));
btnExit.setBackground(Color.WHITE);
btnExit.setForeground(new Color(255, 0, 0));
btnExit.setFont(new Font(“Harlow Solid Italic”, Font.BOLD, 15));
btnExit.setBounds(423, 298, 124, 38);
contentPane.add(btnExit);
JButton btnBack = new JButton(“Back”);
btnBack.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
RAdmin RB = new RAdmin();
RB.setVisible(true);
}
});
btnBack.setIcon(new ImageIcon(Owner.class.getResource(“/imgs/back1.png”)));
btnBack.setBackground(Color.WHITE);
btnBack.setForeground(new Color(0, 255, 0));
btnBack.setFont(new Font(“Harlow Solid Italic”, Font.BOLD, 15));
btnBack.setBounds(10, 11, 124, 38);
contentPane.add(btnBack);
Refresh();
}
}
One Comment
Nice Bolg…