How do I create multiple tables, i.e. one named "salesAccounts" and another "PurchaseAccounts" based off of the Account class?
but in sales and purchase i need to create individual user account with new table. can u help me in that i am using Sq-lite and net beans software
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */
/** * * @author Kedar */ public class roshantrades extends javax.swing.JFrame {
/**
* Creates new form roshantrades
*/
public roshantrades() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jMenuBar1 = new javax.swing.JMenuBar();
jMenu4 = new javax.swing.JMenu();
jMenu5 = new javax.swing.JMenu();
jPanel1 = new javax.swing.JPanel();
jPanel4 = new javax.swing.JPanel();
button_Purchase = new javax.swing.JButton();
button_Purchase5 = new javax.swing.JButton();
button_Purchase4 = new javax.swing.JButton();
button_Purchase3 = new javax.swing.JButton();
button_Purchase2 = new javax.swing.JButton();
jToolBar2 = new javax.swing.JToolBar();
Button_add = new javax.swing.JToggleButton();
jSeparator3 = new javax.swing.JToolBar.Separator();
jPanel2 = new javax.swing.JPanel();
jPanel3 = new javax.swing.JPanel();
panel_addons = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
table_purchase = new javax.swing.JTable();
jMenuBar2 = new javax.swing.JMenuBar();
jMenu6 = new javax.swing.JMenu();
jMenuItem2 = new javax.swing.JMenuItem();
jSeparator1 = new javax.swing.JPopupMenu.Separator();
jMenuItem1 = new javax.swing.JMenuItem();
jMenuItem3 = new javax.swing.JMenuItem();
jMenuItem4 = new javax.swing.JMenuItem();
jSeparator2 = new javax.swing.JPopupMenu.Separator();
jMenuItem5 = new javax.swing.JMenuItem();
jMenu7 = new javax.swing.JMenu();
jMenuItem6 = new javax.swing.JMenuItem();
jMenuItem7 = new javax.swing.JMenuItem();
jMenuItem8 = new javax.swing.JMenuItem();
jMenu8 = new javax.swing.JMenu();
jMenuItem9 = new javax.swing.JMenuItem();
jMenuItem10 = new javax.swing.JMenuItem();
jMenu4.setText("File");
jMenuBar1.add(jMenu4);
jMenu5.setText("Edit");
jMenuBar1.add(jMenu5);
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
jPanel1.setBackground(new java.awt.Color(255, 255, 255));
jPanel1.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true));
jPanel1.setForeground(new java.awt.Color(255, 255, 255));
jPanel4.setBackground(new java.awt.Color(153, 153, 153));
jPanel4.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 2, true));
button_Purchase.setBackground(new java.awt.Color(255, 255, 255));
button_Purchase.setFont(new java.awt.Font("Times New Roman", 2, 18)); // NOI18N
button_Purchase.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Purchase.JPG"))); // NOI18N
button_Purchase.setText("Purchase");
button_Purchase.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 204, 204), 1, true));
button_Purchase.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
button_Purchase5.setBackground(new java.awt.Color(255, 255, 255));
button_Purchase5.setFont(new java.awt.Font("Times New Roman", 2, 18)); // NOI18N
button_Purchase5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/search.JPG"))); // NOI18N
button_Purchase5.setText("Search");
button_Purchase5.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 204, 204), 1, true));
button_Purchase5.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
button_Purchase4.setBackground(new java.awt.Color(255, 255, 255));
button_Purchase4.setFont(new java.awt.Font("Times New Roman", 2, 18)); // NOI18N
button_Purchase4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Other Exp.JPG"))); // NOI18N
button_Purchase4.setText("Other Exp");
button_Purchase4.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 204, 204), 1, true));
button_Purchase4.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
button_Purchase3.setBackground(new java.awt.Color(255, 255, 255));
button_Purchase3.setFont(new java.awt.Font("Times New Roman", 2, 18)); // NOI18N
button_Purchase3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Sales.JPG"))); // NOI18N
button_Purchase3.setText(" Sales");
button_Purchase3.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 204, 204), 1, true));
button_Purchase3.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
button_Purchase2.setBackground(new java.awt.Color(255, 255, 255));
button_Purchase2.setFont(new java.awt.Font("Times New Roman", 2, 18)); // NOI18N
button_Purchase2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Banks.JPG"))); // NOI18N
button_Purchase2.setText("Banks");
button_Purchase2.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 204, 204), 1, true));
button_Purchase2.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(button_Purchase5, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(button_Purchase4, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(button_Purchase3, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(button_Purchase2, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(button_Purchase, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addComponent(button_Purchase)
.addGap(18, 18, 18)
.addComponent(button_Purchase3, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(button_Purchase4, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(button_Purchase2, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(button_Purchase5, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(23, 23, 23)
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(29, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jToolBar2.setRollover(true);
Button_add.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N
Button_add.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Add.JPG"))); // NOI18N
Button_add.setText("Add ");
Button_add.setFocusable(false);
Button_add.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
Button_add.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jToolBar2.add(Button_add);
jToolBar2.add(jSeparator3);
jPanel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
jPanel2.setLayout(new java.awt.CardLayout());
jPanel3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
jPanel3.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
panel_addons.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
javax.swing.GroupLayout panel_addonsLayout = new javax.swing.GroupLayout(panel_addons);
panel_addons.setLayout(panel_addonsLayout);
panel_addonsLayout.setHorizontalGroup(
panel_addonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 1138, Short.MAX_VALUE)
);
panel_addonsLayout.setVerticalGroup(
panel_addonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 118, Short.MAX_VALUE)
);
jPanel3.add(panel_addons, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1140, 120));
table_purchase.setAutoCreateRowSorter(true);
table_purchase.setFont(new java.awt.Font("Times New Roman", 0, 11)); // NOI18N
table_purchase.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
table_purchase.getTableHeader().setReorderingAllowed(false);
jScrollPane1.setViewportView(table_purchase);
jPanel3.add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 120, 1140, 520));
jPanel2.add(jPanel3, "card2");
jMenu6.setText("File");
jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK));
jMenuItem2.setText("New File");
jMenu6.add(jMenuItem2);
jMenu6.add(jSeparator1);
jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
jMenuItem1.setText("Save");
jMenu6.add(jMenuItem1);
jMenuItem3.setText("Print View");
jMenu6.add(jMenuItem3);
jMenuItem4.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.CTRL_MASK));
jMenuItem4.setText("Print");
jMenu6.add(jMenuItem4);
jMenu6.add(jSeparator2);
jMenuItem5.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.CTRL_MASK));
jMenuItem5.setText("Exit");
jMenu6.add(jMenuItem5);
jMenuBar2.add(jMenu6);
jMenu7.setText("Edit");
jMenuItem6.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
jMenuItem6.setText("Cut");
jMenu7.add(jMenuItem6);
jMenuItem7.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK));
jMenuItem7.setText("Copy");
jMenu7.add(jMenuItem7);
jMenuItem8.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_V, java.awt.event.InputEvent.CTRL_MASK));
jMenuItem8.setText("Paste");
jMenu7.add(jMenuItem8);
jMenuBar2.add(jMenu7);
jMenu8.setText("Help");
jMenuItem9.setText("Check for Update");
jMenu8.add(jMenuItem9);
jMenuItem10.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.event.InputEvent.CTRL_MASK));
jMenuItem10.setText("About");
jMenu8.add(jMenuItem10);
jMenuBar2.add(jMenu8);
setJMenuBar(jMenuBar2);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(jToolBar2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jToolBar2, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 756, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(0, 0, Short.MAX_VALUE))
);
pack();
setLocationRelativeTo(null);
}// </editor-fold>
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(roshantrades.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(roshantrades.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(roshantrades.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(roshantrades.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new roshantrades().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JToggleButton Button_add;
private javax.swing.JButton button_Purchase;
private javax.swing.JButton button_Purchase2;
private javax.swing.JButton button_Purchase3;
private javax.swing.JButton button_Purchase4;
private javax.swing.JButton button_Purchase5;
private javax.swing.JMenu jMenu4;
private javax.swing.JMenu jMenu5;
private javax.swing.JMenu jMenu6;
private javax.swing.JMenu jMenu7;
private javax.swing.JMenu jMenu8;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuBar jMenuBar2;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JMenuItem jMenuItem10;
private javax.swing.JMenuItem jMenuItem2;
private javax.swing.JMenuItem jMenuItem3;
private javax.swing.JMenuItem jMenuItem4;
private javax.swing.JMenuItem jMenuItem5;
private javax.swing.JMenuItem jMenuItem6;
private javax.swing.JMenuItem jMenuItem7;
private javax.swing.JMenuItem jMenuItem8;
private javax.swing.JMenuItem jMenuItem9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JPopupMenu.Separator jSeparator1;
private javax.swing.JPopupMenu.Separator jSeparator2;
private javax.swing.JToolBar.Separator jSeparator3;
private javax.swing.JToolBar jToolBar2;
private javax.swing.JPanel panel_addons;
private javax.swing.JTable table_purchase;
// End of variables declaration
}
Aucun commentaire:
Enregistrer un commentaire