package supplier;
import javax.swing.*;
import java.awt.*;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* @author Dell
*/
public class SupplierDashboard extends javax.swing.JFrame {
/**
* Creates new form SupplierDashboard
*/
public SupplierDashboard() {
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")
private void initComponents() {
jPanel2 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
jLabel16 = new javax.swing.JLabel();
pnMenu = new javax.swing.JPanel();
jPanel14 = new javax.swing.JPanel();
jLabel15 = new javax.swing.JLabel();
jPanel7 = new javax.swing.JPanel();
jLabel6 = new javax.swing.JLabel();
jPanel8 = new javax.swing.JPanel();
jPanel9 = new javax.swing.JPanel();
jPanel10 = new javax.swing.JPanel();
jLabel17 = new javax.swing.JLabel();
jPanel11 = new javax.swing.JPanel();
jLabel8 = new javax.swing.JLabel();
jPanel12 = new javax.swing.JPanel();
jLabel7 = new javax.swing.JLabel();
jLabel18 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
home = new javax.swing.JPanel();
jLabel14 = new javax.swing.JLabel();
jLabel19 = new javax.swing.JLabel();
accout = new javax.swing.JPanel();
jLabel9 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel2.setBackground(new java.awt.Color(64, 194, 150));
jPanel2.setPreferredSize(new java.awt.Dimension(1184, 64));
jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 30)); // NOI18N
jLabel1.setForeground(new java.awt.Color(255, 255, 255));
jLabel1.setText("ONLINE SHOPPING");
jLabel2.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
jLabel2.setForeground(new java.awt.Color(255, 255, 255));
jLabel2.setText("logout");
jLabel2.setPreferredSize(new java.awt.Dimension(50, 30));
jLabel3.setFont(new java.awt.Font("Times New Roman", 0, 16)); // NOI18N
jLabel3.setForeground(new java.awt.Color(255, 255, 255));
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel3.setText("[email protected]");
jLabel3.setPreferredSize(new java.awt.Dimension(120, 30));
jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/icons8-express-shopping-
48.png"))); // NOI18N
jLabel11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/user.png"))); // NOI18N
jLabel12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/logout.png"))); //
NOI18N
jLabel16.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/trolley-cart
(1).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()
.addGap(34, 34, 34)
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 316,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(57, 57, 57)
.addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 43,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(100, 100, 100)
.addComponent(jLabel11)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 159,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 150,
Short.MAX_VALUE)
.addComponent(jLabel12)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(145, 145, 145))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addContainerGap(23, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel16)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 34,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel11, javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAIL
ING)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel12)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addContainerGap())
);
getContentPane().add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
pnMenu.setBackground(new java.awt.Color(42, 58, 73));
pnMenu.setPreferredSize(new java.awt.Dimension(251, 640));
pnMenu.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel14.setBackground(new java.awt.Color(51, 102, 255));
jLabel15.setBackground(new java.awt.Color(238, 77, 45));
jLabel15.setFont(new java.awt.Font("Times New Roman", 1, 28)); // NOI18N
jLabel15.setForeground(new java.awt.Color(255, 255, 255));
jLabel15.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel15.setText(" DASHBOARD");
javax.swing.GroupLayout jPanel14Layout = new javax.swing.GroupLayout(jPanel14);
jPanel14.setLayout(jPanel14Layout);
jPanel14Layout.setHorizontalGroup(
jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
jPanel14Layout.createSequentialGroup()
.addContainerGap(59, Short.MAX_VALUE)
.addComponent(jLabel15)
.addContainerGap())
);
jPanel14Layout.setVerticalGroup(
jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
jPanel14Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 44,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(10, 10, 10))
);
pnMenu.add(jPanel14, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 40, 250, 50));
jPanel7.setBackground(new java.awt.Color(42, 58, 73));
jPanel7.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel6.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
jLabel6.setForeground(new java.awt.Color(102, 120, 138));
jLabel6.setText("My Account");
jPanel7.add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 0, 170, 50));
jPanel8.setBackground(new java.awt.Color(42, 58, 73));
javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
jPanel8.setLayout(jPanel8Layout);
jPanel8Layout.setHorizontalGroup(
jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 10, Short.MAX_VALUE)
);
jPanel8Layout.setVerticalGroup(
jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 50, Short.MAX_VALUE)
);
jPanel7.add(jPanel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 10, -1));
pnMenu.add(jPanel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 230, 250, 50));
jPanel9.setBackground(new java.awt.Color(42, 58, 73));
jPanel9.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel10.setBackground(new java.awt.Color(42, 58, 73));
javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
jPanel10.setLayout(jPanel10Layout);
jPanel10Layout.setHorizontalGroup(
jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 10, Short.MAX_VALUE)
);
jPanel10Layout.setVerticalGroup(
jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 50, Short.MAX_VALUE)
);
jPanel9.add(jPanel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 10, -1));
jLabel17.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
jLabel17.setForeground(new java.awt.Color(102, 120, 138));
jLabel17.setText("Delivery");
jPanel9.add(jLabel17, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 0, 170, 50));
pnMenu.add(jPanel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 130, 250, 50));
jPanel11.setBackground(new java.awt.Color(42, 58, 73));
jPanel11.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel8.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
jLabel8.setForeground(new java.awt.Color(102, 120, 138));
jLabel8.setText("My Delivery");
jPanel11.add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 0, 170, 50));
jPanel12.setBackground(new java.awt.Color(42, 58, 73));
javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
jPanel12.setLayout(jPanel12Layout);
jPanel12Layout.setHorizontalGroup(
jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 10, Short.MAX_VALUE)
);
jPanel12Layout.setVerticalGroup(
jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 50, Short.MAX_VALUE)
);
jPanel11.add(jPanel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 10, -1));
pnMenu.add(jPanel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 180, 250, 50));
jLabel7.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
jLabel7.setForeground(new java.awt.Color(102, 120, 138));
jLabel7.setText("Delivery");
pnMenu.add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 330, 170, 50));
jLabel18.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
jLabel18.setForeground(new java.awt.Color(102, 120, 138));
jLabel18.setText("Delivery");
pnMenu.add(jLabel18, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 280, 170, 50));
jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/close (1).png"))); //
NOI18N
jLabel4.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel4MouseClicked(evt);
});
pnMenu.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, -1, 20));
getContentPane().add(pnMenu, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 60, 0, 629));
jButton1.setBackground(new java.awt.Color(51, 102, 255));
jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/icons8-playlist-
48.png"))); // NOI18N
jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton1MouseClicked(evt);
});
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
});
getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 70, 51, 41));
jPanel1.setLayout(new java.awt.CardLayout());
jLabel14.setIcon(new javax.swing.ImageIcon(getClass().getResource("/supplier/6.jpg"))); // NOI18N
jLabel19.setIcon(new javax.swing.ImageIcon(getClass().getResource("/supplier/6.jpg"))); // NOI18N
javax.swing.GroupLayout homeLayout = new javax.swing.GroupLayout(home);
home.setLayout(homeLayout);
homeLayout.setHorizontalGroup(
homeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(homeLayout.createSequentialGroup()
.addGroup(homeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel14)
.addComponent(jLabel19))
.addGap(0, 935, Short.MAX_VALUE))
);
homeLayout.setVerticalGroup(
homeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(homeLayout.createSequentialGroup()
.addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 83,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 98,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 367, Short.MAX_VALUE))
);
jPanel1.add(home, "card2");
jLabel9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/supplier/6.jpg"))); // NOI18N
jLabel9.setText("jLabel9");
jLabel10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/supplier/6.jpg"))); // NOI18N
jLabel10.setText("jLabel10");
jLabel13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/supplier/6.jpg"))); // NOI18N
javax.swing.GroupLayout accoutLayout = new javax.swing.GroupLayout(accout);
accout.setLayout(accoutLayout);
accoutLayout.setHorizontalGroup(
accoutLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(accoutLayout.createSequentialGroup()
.addGroup(accoutLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel13)
.addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 195,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 171,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 758, Short.MAX_VALUE))
);
accoutLayout.setVerticalGroup(
accoutLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(accoutLayout.createSequentialGroup()
.addGroup(accoutLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 151,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 151,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 119,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 284, Short.MAX_VALUE))
);
jPanel1.add(accout, "card3");
getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 120, 1160,
560));
pack();
}// </editor-fold>
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// Drawer.getInstance().showDrawer();
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {
openMenuBar();
private void jLabel4MouseClicked(java.awt.event.MouseEvent evt) {
closeMenuBar();
/**
* @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(SupplierDashboard.class.getName()).log(java.util.logging.Level.SEVERE
, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(SupplierDashboard.class.getName()).log(java.util.logging.Level.SEVERE
, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(SupplierDashboard.class.getName()).log(java.util.logging.Level.SEVERE
, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(SupplierDashboard.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 SupplierDashboard().setVisible(true);
});
// Variables declaration - do not modify
private javax.swing.JPanel accout;
private javax.swing.JPanel home;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel19;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel10;
private javax.swing.JPanel jPanel11;
private javax.swing.JPanel jPanel12;
private javax.swing.JPanel jPanel14;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel7;
private javax.swing.JPanel jPanel8;
private javax.swing.JPanel jPanel9;
private javax.swing.JPanel pnMenu;
// End of variables declaration
int width = 210;
int height = 629;
private void openMenuBar() {
// tạo luồng chạy song song với luồng chính(Main)
new Thread(new Runnable() {
@Override
public void run() {
for (int i=0;i<width;i++){
try {
pnMenu.setSize(i, height);
// mở từ từ
Thread.sleep(2);
} catch (InterruptedException ex) {
Logger.getLogger(SupplierAccount.class.getName()).log(Level.SEVERE, null, ex);
}
}).start();
//Phương thức đóng menu
private void closeMenuBar() {
// tạo luồng chạy song song với luồng chính(Main)
new Thread(new Runnable() {
@Override
public void run() {
for (int i=width;i>0;i--){
try {
pnMenu.setSize(i, height);
// mở từ từ
Thread.sleep(2);
} catch (InterruptedException ex) {
Logger.getLogger(SupplierAccount.class.getName()).log(Level.SEVERE, null, ex);
}).start();
} (có cách nào giúp tui để nó có thể làm pnMenu di chuyển ra thì Jpanel1 cũng di chuyển theo hướng
pnMenu đang di chuyển)