/*
* 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.
*/
package dom;
import java.awt.Color;
import java.awt.Desktop;
import java.util.logging.Level;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import java.awt.Insets;
import java.awt.Point;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.SwingWorker;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.table.DefaultTableModel;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JLabel;
/**
*
* @author Bilal
*/
//private String userDefaultImagePath=new File("").getAbsolutePath()+"\\test\\user.png";
/**
* Creates new form Menu
*/
int i = 0;
int r=212;
int g=230;
int b=241;
DataBaseManager dbm = new DataBaseManager();
initComponents();
jPanel1.
setBackground(new Color(212,
230,
241));
jPanel2.
setBackground(new Color(0,
78,
164));
txtLeder.
setBackground(new Color(0,
78,
164));
ArrayList<String> arrayStr = new ArrayList<>();
arrayStr = dbm.getFromLedger();
for (int j = 0; j < arrayStr.size(); j++) {
txtLeder.append(arrayStr.get(j).toString() + "\n\n");
}
}
/**
* 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() {
jPanel1
= new javax.
swing.
JPanel();
jPanel2
= new javax.
swing.
JPanel();
jLabel2
= new javax.
swing.
JLabel();
btnClose
= new javax.
swing.
JButton();
lblName
= new javax.
swing.
JLabel();
lblPassword
= new javax.
swing.
JLabel();
btnLogin
= new javax.
swing.
JButton();
btnRegister
= new javax.
swing.
JButton();
lblUser
= new javax.
swing.
JLabel();
jPanel2.
setForeground(new java.
awt.
Color(0,
0,
255));
txtLeder.setEditable(false);
txtLeder.setColumns(20);
txtLeder.setRows(5);
jScrollPane1.setViewportView(txtLeder);
jLabel2.
setIcon(new javax.
swing.
ImageIcon("C:\\Users\\Bilal\\Desktop\\splash_2.png")); // NOI18N
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.
addComponent(jScrollPane1, javax.
swing.
GroupLayout.
Alignment.
TRAILING, javax.
swing.
GroupLayout.
DEFAULT_SIZE,
445,
Short.
MAX_VALUE)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel2)
.
addGap(0,
0,
Short.
MAX_VALUE)))
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel2)
.
addPreferredGap(javax.
swing.
LayoutStyle.
ComponentPlacement.
RELATED, javax.
swing.
GroupLayout.
DEFAULT_SIZE,
Short.
MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 201, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
btnClose.setText("Close");
public void actionPerformed
(java.
awt.
event.
ActionEvent evt
) {
btnCloseActionPerformed(evt);
}
});
lblName.setText("User name");
lblPassword.setText("Password");
btnLogin.setText("Login");
btnRegister.setText("Register");
public void actionPerformed
(java.
awt.
event.
ActionEvent evt
) {
btnRegisterActionPerformed(evt);
}
});
jToggleButton1.setText("theme");
jToggleButton1.
addActionListener(new java.
awt.
event.
ActionListener() {
public void actionPerformed
(java.
awt.
event.
ActionEvent evt
) {
jToggleButton1ActionPerformed(evt);
}
});
lblUser.
setIcon(new javax.
swing.
ImageIcon("C:\\Users\\Bilal\\Desktop\\user_2.png")); // NOI18N
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jToggleButton1)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(61, 61, 61)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblPassword)
.addComponent(lblName))
.addGap(36, 36, 36)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(btnRegister, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
.
addPreferredGap(javax.
swing.
LayoutStyle.
ComponentPlacement.
RELATED,
21,
Short.
MAX_VALUE)
.addComponent(btnLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(txtPassword, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtName, javax.swing.GroupLayout.Alignment.LEADING)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(338, 338, 338)
.addComponent(btnClose, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lblUser)
.addGap(139, 139, 139)))))
.
addContainerGap(20,
Short.
MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGap(14, 14, 14)
.addComponent(jToggleButton1)
.
addPreferredGap(javax.
swing.
LayoutStyle.
ComponentPlacement.
RELATED, javax.
swing.
GroupLayout.
DEFAULT_SIZE,
Short.
MAX_VALUE)
.addComponent(lblUser)
.addGap(16, 16, 16)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblName)
.addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblPassword)
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnLogin)
.addComponent(btnRegister))
.addGap(120, 120, 120)
.addComponent(btnClose)
.addGap(27, 27, 27))
.
addComponent(jPanel2, javax.
swing.
GroupLayout.
DEFAULT_SIZE, javax.
swing.
GroupLayout.
DEFAULT_SIZE,
Short.
MAX_VALUE)
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.
addComponent(jPanel1, javax.
swing.
GroupLayout.
DEFAULT_SIZE, javax.
swing.
GroupLayout.
DEFAULT_SIZE,
Short.
MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
pack();
}// </editor-fold>
private void btnCloseActionPerformed
(java.
awt.
event.
ActionEvent evt
) {
// TODO add your handling code here:
dispose();
}
private void jToggleButton1ActionPerformed
(java.
awt.
event.
ActionEvent evt
) {
// TODO add your handling code here:
if (i == 0) {
r=202;
g=207;
b=210;
jPanel1.
setBackground(new Color(202,
207,
210));
jPanel2.
setBackground(new Color(98,
101,
103));
txtLeder.
setBackground(new Color(98,
101,
103));
i++;
} else {
r=212;
g=230;
b=241;
jPanel1.
setBackground(new Color(212,
230,
241));
jPanel2.
setBackground(new Color(0,
78,
164));
txtLeder.
setBackground(new Color(0,
78,
164));
i = 0;
}
}
private void btnRegisterActionPerformed
(java.
awt.
event.
ActionEvent evt
) {
// TODO add your handling code here:
Register reg=new Register(r,g,b);
reg.setVisible(true);
// lblName.setVisible(false);
// lblPassword.setVisible(false);
// lblUser.setVisible(false);
// txtName.setVisible(false);
// txtPassword.setVisible(false);
// btnLogin.setVisible(false);
// btnRegister.setVisible(false);
}
/**
* @param args the command line arguments
*/
/* 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 {
Logger.
getLogger(Menu.
class.
getName()).
log(Level.
SEVERE,
null, ex
);
}
//</editor-fold>
/* Create and display the form */
public void run() {
try {
new Menu().
setVisible(true);
Logger.
getLogger(Menu.
class.
getName()).
log(Level.
SEVERE,
null, ex
);
Logger.
getLogger(Menu.
class.
getName()).
log(Level.
SEVERE,
null, ex
);
}
}
});
}
// Variables declaration - do not modify
private javax.
swing.
JButton btnClose
;
private javax.
swing.
JButton btnLogin
;
private javax.
swing.
JButton btnRegister
;
private javax.
swing.
JLabel jLabel2
;
private javax.
swing.
JPanel jPanel1
;
private javax.
swing.
JPanel jPanel2
;
private javax.
swing.
JLabel lblName
;
private javax.
swing.
JLabel lblPassword
;
private javax.
swing.
JLabel lblUser
;
// End of variables declaration
}