/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
*/
package emrekumas;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.FontFormatException;
import java.awt.Image;
import java.awt.Point;
import java.awt.Toolkit;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
/**
*
* @author selec
*/
public final class DashBoard extends javax.swing.JFrame {
//disable all the buttons and turn it on when commands give access
private boolean isHomeBtnClicked = false;
private boolean isShopBtnClicked = false;
private boolean isEditProBtnClicked = false;
private boolean isLogBtnClicked = false;
private boolean isSettingsBtnClicked = false;
private boolean isCashBtnClicked = false;
private boolean isCreditCardBtnClicked = false;
private boolean isHavaleBtnClicked = false;
private boolean isAddShopBtnClicked = false;
//Variable definition (تعريف القيم)
private double initialPrice;
private double totalPrice;
private int quantity = 0;
//get the cursorNotAllowed icon and add it to the default cursors
Image cursor = Toolkit.getDefaultToolkit().getImage("src/icons/cursorNotAllowed.png");
Cursor notAllowedCursor = Toolkit.getDefaultToolkit().createCustomCursor(cursor, new Point(0, 0), "not allowed");
//Products in the basket is 0
int a = 0;
public DashBoard() throws FontFormatException, IOException {
initComponents();
DashBoard();
init();
//set the value of the variable
initialPrice = 0.0;
totalPrice = 0.0;
//to make the mainface (Home)========================================================
isHomeBtnClicked = true;
homeIconLabel.setIcon(new ImageIcon("src/iconsSelected/iconHomeOrange.png"));
homePanel.setVisible(true);
shopPanel.setVisible(false);
editProPanel.setVisible(false);
logPanel.setVisible(false);
settingsPanel.setVisible(false);
//===================================================================================
//Hide the menus when open the app (they will be showed when the commands below giving accsess)
//Hide rest button
restButton.setVisible(false);
//Hide the products from the basket (right bar)
basketPro.setVisible(false);
//Hide product remover button
removeProButton.setVisible(false);
//===================================================================================
//set the default cursor of the Pay Button is notAllowedCursor (red circle with line inside it)
payButton.setCursor(notAllowedCursor);
//set the default colors of the Pay Button (disable colors)
payButton.setBackground(new Color(236,236,236));
payText.setForeground(new Color(255,255,255));
}
public void DashBoard(){
}
public void init(){
SetImage();
}
public void SetImage(){
//get the photo from it loaction and add it to "icon" variable
ImageIcon icon = new ImageIcon(getClass().getResource("/fabricphotos/Screenshot_1.png"));
//make the "icon" variable size fit to the size of the label that you add
Image img = icon.getImage().getScaledInstance(productPhoto.getWidth(), productPhoto.getHeight(), Image.SCALE_SMOOTH);
//set the icon of the label to the icon you add and maked the sizes fit to the label
productPhoto.setIcon(new ImageIcon(img));
}
public void AddOne(){
//increese "a" variable 1 time (+1)
a = 1;
System.out.println(a);
//Show rest button when "a" variable = 1 or more
restButton.setVisible(true);
}
public void payButton(){
if((isCashBtnClicked || isCreditCardBtnClicked || isHavaleBtnClicked) && a == 1){
payButton.setBackground(new Color(255,138,0));
payText.setForeground(new Color(236,236,236));
payButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
}
/**
* 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() {
menuBar = new javax.swing.JPanel();
logoIcon = new javax.swing.JLabel();
line = new javax.swing.JPanel();
homeBtn = new javax.swing.JPanel();
homeIconLabel = new javax.swing.JLabel();
shopBtn = new javax.swing.JPanel();
shopIconLabel = new javax.swing.JLabel();
editProBtn = new javax.swing.JPanel();
editProIconLabel = new javax.swing.JLabel();
logBtn = new javax.swing.JPanel();
logIconLabel = new javax.swing.JLabel();
settingsBtn = new javax.swing.JPanel();
settingsIconLabel = new javax.swing.JLabel();
exitBtn = new javax.swing.JPanel();
exitIconLabel = new javax.swing.JLabel();
shopPanel = new javax.swing.JPanel();
basketBar = new javax.swing.JPanel();
welcomeText = new javax.swing.JLabel();
totalPanel = new javax.swing.JPanel();
jLabel6 = new javax.swing.JLabel();
priceText = new javax.swing.JLabel();
cashButton = new javax.swing.JPanel();
cashLabel = new javax.swing.JLabel();
creditCardButton = new javax.swing.JPanel();
creditCardLabel = new javax.swing.JLabel();
havaleButton = new javax.swing.JPanel();
havaleLabel = new javax.swing.JLabel();
payButton = new javax.swing.JPanel();
payText = new javax.swing.JLabel();
restButton = new javax.swing.JPanel();
restIcon = new javax.swing.JLabel();
havaleText = new javax.swing.JLabel();
cashText = new javax.swing.JLabel();
krediKartText = new javax.swing.JLabel();
basketPro = new javax.swing.JPanel();
removeProButton = new javax.swing.JPanel();
removePro = new javax.swing.JLabel();
basketProIcon = new javax.swing.JLabel();
basketProName = new javax.swing.JLabel();
basketProPrice = new javax.swing.JLabel();
quantityText = new javax.swing.JTextField();
plusBtn = new javax.swing.JPanel();
plusLabel = new javax.swing.JLabel();
minusBtn = new javax.swing.JPanel();
minusLabel = new javax.swing.JLabel();
product = new javax.swing.JPanel();
productPhoto = new javax.swing.JLabel();
productName = new javax.swing.JLabel();
productInfo = new javax.swing.JLabel();
productPrice = new javax.swing.JLabel();
productType = new javax.swing.JLabel();
addShopButton = new javax.swing.JPanel();
addShopLabel = new javax.swing.JLabel();
welcomeText2 = new javax.swing.JLabel();
welcomeText1 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
homePanel = new javax.swing.JPanel();
editProPanel = new javax.swing.JPanel();
logPanel = new javax.swing.JPanel();
settingsPanel = new javax.swing.JPanel();
jPanel3 = new javax.swing.JPanel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
setLocation(new java.awt.Point(300, 130));
setResizable(false);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
menuBar.setBackground(new java.awt.Color(255, 255, 255));
menuBar.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
logoIcon.setFont(new java.awt.Font("Segoe UI", 0, 3)); // NOI18N
logoIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/Loogooo.png"))); // NOI18N
logoIcon.setLabelFor(menuBar);
logoIcon.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
logoIcon.setMaximumSize(new java.awt.Dimension(120, 120));
logoIcon.setMinimumSize(new java.awt.Dimension(120, 120));
logoIcon.setPreferredSize(new java.awt.Dimension(120, 120));
menuBar.add(logoIcon, new org.netbeans.lib.awtextra.AbsoluteConstraints(14, 10, 60, 60));
line.setBackground(new java.awt.Color(204, 204, 204));
menuBar.add(line, new org.netbeans.lib.awtextra.AbsoluteConstraints(12, 73, 55, 1));
homeBtn.setBackground(new java.awt.Color(255, 255, 255));
homeBtn.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
homeBtn.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
homeBtnMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
homeBtnMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
homeBtnMouseExited(evt);
}
});
homeIconLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
homeIconLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/iconHome.png"))); // NOI18N
homeIconLabel.setName(""); // NOI18N
homeIconLabel.setPreferredSize(new java.awt.Dimension(70, 55));
homeBtn.add(homeIconLabel);
homeIconLabel.getAccessibleContext().setAccessibleName("");
menuBar.add(homeBtn, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 190, 60, 60));
shopBtn.setBackground(new java.awt.Color(255, 255, 255));
shopBtn.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
shopBtn.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
shopBtnMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
shopBtnMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
shopBtnMouseExited(evt);
}
});
shopIconLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
shopIconLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/iconShop.png"))); // NOI18N
shopIconLabel.setPreferredSize(new java.awt.Dimension(70, 55));
shopBtn.add(shopIconLabel);
menuBar.add(shopBtn, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 260, 60, 60));
editProBtn.setBackground(new java.awt.Color(255, 255, 255));
editProBtn.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
editProBtn.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
editProBtnMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
editProBtnMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
editProBtnMouseExited(evt);
}
});
editProIconLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
editProIconLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/iconEditPro.png"))); // NOI18N
editProIconLabel.setPreferredSize(new java.awt.Dimension(70, 55));
editProBtn.add(editProIconLabel);
menuBar.add(editProBtn, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 330, 60, 60));
logBtn.setBackground(new java.awt.Color(255, 255, 255));
logBtn.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
logBtn.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
logBtnMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
logBtnMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
logBtnMouseExited(evt);
}
});
logIconLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
logIconLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/iconLog.png"))); // NOI18N
logIconLabel.setPreferredSize(new java.awt.Dimension(70, 55));
logBtn.add(logIconLabel);
menuBar.add(logBtn, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 400, 60, 60));
settingsBtn.setBackground(new java.awt.Color(255, 255, 255));
settingsBtn.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
settingsBtn.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
settingsBtnMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
settingsBtnMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
settingsBtnMouseExited(evt);
}
});
settingsIconLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
settingsIconLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/iconSettings.png"))); // NOI18N
settingsIconLabel.setPreferredSize(new java.awt.Dimension(70, 55));
settingsBtn.add(settingsIconLabel);
menuBar.add(settingsBtn, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 630, 60, 60));
exitBtn.setBackground(new java.awt.Color(255, 255, 255));
exitBtn.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
exitBtn.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
exitBtnMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
exitBtnMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
exitBtnMouseExited(evt);
}
});
exitIconLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
exitIconLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/iconExit.png"))); // NOI18N
exitIconLabel.setPreferredSize(new java.awt.Dimension(70, 55));
exitBtn.add(exitIconLabel);
menuBar.add(exitBtn, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 700, 60, 60));
getContentPane().add(menuBar, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 80, 770));
shopPanel.setBackground(new java.awt.Color(236, 236, 236));
shopPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
basketBar.setBackground(new java.awt.Color(255, 255, 255));
basketBar.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
welcomeText.setFont(new java.awt.Font("Yu Gothic UI Semibold", 1, 18)); // NOI18N
welcomeText.setText("Sepete Eklenenler");
basketBar.add(welcomeText, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 20, 260, 30));
totalPanel.setBackground(new java.awt.Color(243, 243, 243));
jLabel6.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
jLabel6.setText("Total:");
priceText.setFont(new java.awt.Font("Segoe UI", 1, 19)); // NOI18N
priceText.setText("$0.0");
javax.swing.GroupLayout totalPanelLayout = new javax.swing.GroupLayout(totalPanel);
totalPanel.setLayout(totalPanelLayout);
totalPanelLayout.setHorizontalGroup(
totalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(totalPanelLayout.createSequentialGroup()
.addGap(25, 25, 25)
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 107, Short.MAX_VALUE)
.addComponent(priceText)
.addGap(21, 21, 21))
);
totalPanelLayout.setVerticalGroup(
totalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, totalPanelLayout.createSequentialGroup()
.addContainerGap(18, Short.MAX_VALUE)
.addGroup(totalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(priceText))
.addGap(16, 16, 16))
);
basketBar.add(totalPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 570, 240, 60));
cashButton.setBackground(new java.awt.Color(243, 243, 243));
cashButton.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
cashButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
cashButton.setPreferredSize(new java.awt.Dimension(60, 60));
cashButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
cashButtonMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
cashButtonMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
cashButtonMouseExited(evt);
}
});
cashLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/iconCash.png"))); // NOI18N
cashLabel.setMaximumSize(new java.awt.Dimension(50, 50));
cashLabel.setMinimumSize(new java.awt.Dimension(30, 55));
javax.swing.GroupLayout cashButtonLayout = new javax.swing.GroupLayout(cashButton);
cashButton.setLayout(cashButtonLayout);
cashButtonLayout.setHorizontalGroup(
cashButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(cashButtonLayout.createSequentialGroup()
.addComponent(cashLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
);
cashButtonLayout.setVerticalGroup(
cashButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, cashButtonLayout.createSequentialGroup()
.addComponent(cashLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
);
basketBar.add(cashButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(85, 640, 60, 50));
creditCardButton.setBackground(new java.awt.Color(243, 243, 243));
creditCardButton.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
creditCardButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
creditCardButton.setPreferredSize(new java.awt.Dimension(60, 60));
creditCardButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
creditCardButtonMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
creditCardButtonMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
creditCardButtonMouseExited(evt);
}
});
creditCardLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/iconCreditCard.png"))); // NOI18N
creditCardLabel.setMaximumSize(new java.awt.Dimension(50, 50));
creditCardLabel.setMinimumSize(new java.awt.Dimension(30, 55));
javax.swing.GroupLayout creditCardButtonLayout = new javax.swing.GroupLayout(creditCardButton);
creditCardButton.setLayout(creditCardButtonLayout);
creditCardButtonLayout.setHorizontalGroup(
creditCardButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(creditCardLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 58, Short.MAX_VALUE)
);
creditCardButtonLayout.setVerticalGroup(
creditCardButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, creditCardButtonLayout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(creditCardLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE))
);
basketBar.add(creditCardButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 640, -1, 50));
havaleButton.setBackground(new java.awt.Color(243, 243, 243));
havaleButton.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
havaleButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
havaleButton.setPreferredSize(new java.awt.Dimension(60, 60));
havaleButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
havaleButtonMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
havaleButtonMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
havaleButtonMouseExited(evt);
}
});
havaleLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/iconQrCode.png"))); // NOI18N
havaleLabel.setMaximumSize(new java.awt.Dimension(50, 50));
havaleLabel.setMinimumSize(new java.awt.Dimension(30, 55));
javax.swing.GroupLayout havaleButtonLayout = new javax.swing.GroupLayout(havaleButton);
havaleButton.setLayout(havaleButtonLayout);
havaleButtonLayout.setHorizontalGroup(
havaleButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(havaleLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 58, Short.MAX_VALUE)
);
havaleButtonLayout.setVerticalGroup(
havaleButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, havaleButtonLayout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(havaleLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE))
);
basketBar.add(havaleButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(235, 640, -1, 50));
payButton.setBackground(new java.awt.Color(236, 236, 236));
payButton.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
payButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
payButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
payButtonMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
payButtonMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
payButtonMouseExited(evt);
}
});
payText.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
payText.setForeground(new java.awt.Color(255, 255, 255));
payText.setText("Ödeme Yap");
javax.swing.GroupLayout payButtonLayout = new javax.swing.GroupLayout(payButton);
payButton.setLayout(payButtonLayout);
payButtonLayout.setHorizontalGroup(
payButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(payButtonLayout.createSequentialGroup()
.addGap(69, 69, 69)
.addComponent(payText)
.addContainerGap(71, Short.MAX_VALUE))
);
payButtonLayout.setVerticalGroup(
payButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, payButtonLayout.createSequentialGroup()
.addContainerGap()
.addComponent(payText, javax.swing.GroupLayout.PREFERRED_SIZE, 20, Short.MAX_VALUE)
.addContainerGap())
);
basketBar.add(payButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 710, 240, 30));
restButton.setBackground(new java.awt.Color(236, 236, 236));
restButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
restButton.setPreferredSize(new java.awt.Dimension(25, 25));
restButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
restButtonMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
restButtonMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
restButtonMouseExited(evt);
}
});
restIcon.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
restIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/iconRest.png"))); // NOI18N
restIcon.setPreferredSize(new java.awt.Dimension(45, 48));
javax.swing.GroupLayout restButtonLayout = new javax.swing.GroupLayout(restButton);
restButton.setLayout(restButtonLayout);
restButtonLayout.setHorizontalGroup(
restButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(restButtonLayout.createSequentialGroup()
.addComponent(restIcon, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
);
restButtonLayout.setVerticalGroup(
restButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(restButtonLayout.createSequentialGroup()
.addComponent(restIcon, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
);
basketBar.add(restButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 712, 25, 25));
havaleText.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
havaleText.setText("Havale");
basketBar.add(havaleText, new org.netbeans.lib.awtextra.AbsoluteConstraints(243, 690, -1, -1));
cashText.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
cashText.setText("Cash");
basketBar.add(cashText, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 690, -1, -1));
krediKartText.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
krediKartText.setText("Kredi Kart");
basketBar.add(krediKartText, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 690, -1, -1));
basketPro.setBackground(new java.awt.Color(255, 255, 255));
basketPro.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
removeProButton.setBackground(new java.awt.Color(243, 243, 243));
removeProButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
removePro.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/iconRemove.png"))); // NOI18N
javax.swing.GroupLayout removeProButtonLayout = new javax.swing.GroupLayout(removeProButton);
removeProButton.setLayout(removeProButtonLayout);
removeProButtonLayout.setHorizontalGroup(
removeProButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(removeProButtonLayout.createSequentialGroup()
.addGap(14, 14, 14)
.addComponent(removePro)
.addContainerGap(16, Short.MAX_VALUE))
);
removeProButtonLayout.setVerticalGroup(
removeProButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(removeProButtonLayout.createSequentialGroup()
.addGap(15, 15, 15)
.addComponent(removePro)
.addContainerGap(15, Short.MAX_VALUE))
);
basketPro.add(removeProButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(15, 15, -1, -1));
basketProIcon.setBackground(new java.awt.Color(51, 255, 0));
basketProIcon.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
basketProIconMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
basketProIconMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
basketProIconMouseExited(evt);
}
});
basketPro.add(basketProIcon, new org.netbeans.lib.awtextra.AbsoluteConstraints(15, 15, 80, 80));
basketProName.setFont(new java.awt.Font("Segoe UI", 1, 15)); // NOI18N
basketProName.setText("Unknown Product");
basketPro.add(basketProName, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 15, -1, -1));
basketProPrice.setFont(new java.awt.Font("Segoe UI", 1, 17)); // NOI18N
basketProPrice.setForeground(new java.awt.Color(255, 138, 0));
basketProPrice.setText("Unknown Price");
basketPro.add(basketProPrice, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 70, -1, -1));
quantityText.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N
quantityText.setForeground(new java.awt.Color(136, 136, 136));
quantityText.setHorizontalAlignment(javax.swing.JTextField.CENTER);
quantityText.setText("1");
quantityText.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
quantityTextActionPerformed(evt);
}
});
basketPro.add(quantityText, new org.netbeans.lib.awtextra.AbsoluteConstraints(260, 65, 33, -1));
plusBtn.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
plusBtn.setPreferredSize(new java.awt.Dimension(20, 20));
plusBtn.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
plusBtnMouseClicked(evt);
}
});
plusLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/iconPlus.png"))); // NOI18N
javax.swing.GroupLayout plusBtnLayout = new javax.swing.GroupLayout(plusBtn);
plusBtn.setLayout(plusBtnLayout);
plusBtnLayout.setHorizontalGroup(
plusBtnLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(plusLabel)
);
plusBtnLayout.setVerticalGroup(
plusBtnLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(plusLabel)
);
basketPro.add(plusBtn, new org.netbeans.lib.awtextra.AbsoluteConstraints(304, 70, -1, -1));
minusBtn.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
minusBtn.setPreferredSize(new java.awt.Dimension(20, 20));
minusBtn.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
minusBtnMouseClicked(evt);
}
});
minusLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/iconMinus.png"))); // NOI18N
javax.swing.GroupLayout minusBtnLayout = new javax.swing.GroupLayout(minusBtn);
minusBtn.setLayout(minusBtnLayout);
minusBtnLayout.setHorizontalGroup(
minusBtnLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(minusBtnLayout.createSequentialGroup()
.addComponent(minusLabel)
.addGap(0, 0, Short.MAX_VALUE))
);
minusBtnLayout.setVerticalGroup(
minusBtnLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(minusBtnLayout.createSequentialGroup()
.addComponent(minusLabel)
.addGap(0, 0, Short.MAX_VALUE))
);
basketPro.add(minusBtn, new org.netbeans.lib.awtextra.AbsoluteConstraints(230, 70, -1, -1));
basketBar.add(basketPro, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 70, 340, -1));
shopPanel.add(basketBar, new org.netbeans.lib.awtextra.AbsoluteConstraints(860, 0, 360, 770));
product.setBackground(new java.awt.Color(255, 255, 255));
productPhoto.setIcon(new javax.swing.ImageIcon(getClass().getResource("/fabricphotos/Screenshot_1.png"))); // NOI18N
productPhoto.setAlignmentY(0.0F);
productPhoto.setIconTextGap(1);
productPhoto.setMaximumSize(new java.awt.Dimension(10, 10));
productPhoto.setMinimumSize(new java.awt.Dimension(10, 10));
productPhoto.setPreferredSize(new java.awt.Dimension(150, 100));
productName.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N
productName.setText("Waffle Pike");
productInfo.setFont(new java.awt.Font("Segoe UI", 0, 10)); // NOI18N
productInfo.setForeground(new java.awt.Color(134, 134, 134));
productInfo.setText("- En: 240 cm (2.4 metre)
- %100 pamuklu olmasıyla “Oeko-Tex” Sertifikasına sahiptir.");
productPrice.setFont(new java.awt.Font("Segoe UI", 1, 16)); // NOI18N
productPrice.setForeground(new java.awt.Color(255, 138, 0));
productPrice.setText("$199.90");
productType.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N
productType.setForeground(new java.awt.Color(134, 134, 134));
productType.setText("/ 1 mtr");
addShopButton.setBackground(new java.awt.Color(255, 138, 0));
addShopButton.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
addShopButton.setPreferredSize(new java.awt.Dimension(25, 25));
addShopButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
addShopButtonMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
addShopButtonMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
addShopButtonMouseExited(evt);
}
});
addShopLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/iconAddShop.png"))); // NOI18N
addShopLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
javax.swing.GroupLayout addShopButtonLayout = new javax.swing.GroupLayout(addShopButton);
addShopButton.setLayout(addShopButtonLayout);
addShopButtonLayout.setHorizontalGroup(
addShopButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(addShopButtonLayout.createSequentialGroup()
.addComponent(addShopLabel)
.addGap(0, 0, Short.MAX_VALUE))
);
addShopButtonLayout.setVerticalGroup(
addShopButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(addShopButtonLayout.createSequentialGroup()
.addComponent(addShopLabel)
.addGap(0, 0, Short.MAX_VALUE))
);
javax.swing.GroupLayout productLayout = new javax.swing.GroupLayout(product);
product.setLayout(productLayout);
productLayout.setHorizontalGroup(
productLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(productLayout.createSequentialGroup()
.addGap(15, 15, 15)
.addGroup(productLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(productLayout.createSequentialGroup()
.addComponent(productPrice)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(productType)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(addShopButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(productName)
.addComponent(productPhoto, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(productInfo, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
.addContainerGap(15, Short.MAX_VALUE))
);
productLayout.setVerticalGroup(
productLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(productLayout.createSequentialGroup()
.addGap(17, 17, 17)
.addComponent(productPhoto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(productName)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(productInfo, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(productLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(productLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(productPrice)
.addComponent(productType))
.addComponent(addShopButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(10, Short.MAX_VALUE))
);
shopPanel.add(product, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 170, 180, 260));
welcomeText2.setFont(new java.awt.Font("Yu Gothic UI Semibold", 1, 24)); // NOI18N
welcomeText2.setText("Merhaba, EmreKumas");
shopPanel.add(welcomeText2, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 30, 450, 30));
welcomeText1.setFont(new java.awt.Font("Yu Gothic UI Semibold", 0, 12)); // NOI18N
welcomeText1.setForeground(new java.awt.Color(134, 134, 134));
welcomeText1.setText("Kaliteli ve uygun fiyatla kumaşlar.");
shopPanel.add(welcomeText1, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 60, 270, 20));
jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/iconSearch.png"))); // NOI18N
jLabel5.setText("jLabel5");
shopPanel.add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(615, 37, 40, 40));
jTextField1.setForeground(new java.awt.Color(134, 134, 134));
jTextField1.setText(" Ürün Ara...");
jTextField1.setDisabledTextColor(new java.awt.Color(134, 134, 134));
jTextField1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField1ActionPerformed(evt);
}
});
shopPanel.add(jTextField1, new org.netbeans.lib.awtextra.AbsoluteConstraints(610, 42, 190, 30));
getContentPane().add(shopPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 0, 1220, 770));
homePanel.setBackground(new java.awt.Color(236, 236, 236));
homePanel.setOpaque(false);
homePanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
getContentPane().add(homePanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 0, 1220, 770));
editProPanel.setBackground(new java.awt.Color(236, 236, 236));
editProPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
getContentPane().add(editProPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 0, 1220, 770));
logPanel.setBackground(new java.awt.Color(236, 236, 236));
logPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
getContentPane().add(logPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 0, 1220, 770));
settingsPanel.setBackground(new java.awt.Color(236, 236, 236));
settingsPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
getContentPane().add(settingsPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 0, 1220, 770));
jPanel3.setBackground(new java.awt.Color(236, 236, 236));
jPanel3.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
getContentPane().add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1300, 770));
pack();
setLocationRelativeTo(null);
}//
private void shopBtnMouseEntered(java.awt.event.MouseEvent evt) {
shopIconLabel.setIcon(new ImageIcon("src/iconsSelected/iconShopOrange.png"));
}
private void shopBtnMouseClicked(java.awt.event.MouseEvent evt) {
//When click.. it will show Shop Panel and hide the other panels
homePanel.setVisible(false);
shopPanel.setVisible(true);
editProPanel.setVisible(false);
logPanel.setVisible(false);
settingsPanel.setVisible(false);
isShopBtnClicked = true;
shopIconLabel.setIcon(new ImageIcon("src/iconsSelected/iconShopOrange.png"));
isHomeBtnClicked = false;
isEditProBtnClicked = false;
isLogBtnClicked = false;
isSettingsBtnClicked = false;
//Change the other panels icons to the default color (not orange)
homeIconLabel.setIcon(new ImageIcon("src/icons/iconHome.png"));
editProIconLabel.setIcon(new ImageIcon("src/icons/iconEditPro.png"));
logIconLabel.setIcon(new ImageIcon("src/icons/iconLog.png"));
settingsIconLabel.setIcon(new ImageIcon("src/icons/iconSettings.png"));
}
private void shopBtnMouseExited(java.awt.event.MouseEvent evt) {
if (!isShopBtnClicked){
shopIconLabel.setIcon(new ImageIcon("src/icons/iconShop.png"));
}
}
private void editProBtnMouseEntered(java.awt.event.MouseEvent evt) {
editProIconLabel.setIcon(new ImageIcon("src/iconsSelected/iconEditProOrange.png"));
}
private void editProBtnMouseClicked(java.awt.event.MouseEvent evt) {
homePanel.setVisible(false);
shopPanel.setVisible(false);
editProPanel.setVisible(true);
logPanel.setVisible(false);
settingsPanel.setVisible(false);
isEditProBtnClicked = true;
editProIconLabel.setIcon(new ImageIcon("src/iconsSelected/iconEditProOrange.png"));
isShopBtnClicked = false;
isHomeBtnClicked = false;
isLogBtnClicked = false;
isSettingsBtnClicked = false;
//editProIconLabel.setIcon(new ImageIcon("src/iconsSelected/iconEditProOrange.png"));
homeIconLabel.setIcon(new ImageIcon("src/icons/iconHome.png"));
shopIconLabel.setIcon(new ImageIcon("src/icons/iconShop.png"));
logIconLabel.setIcon(new ImageIcon("src/icons/iconLog.png"));
settingsIconLabel.setIcon(new ImageIcon("src/icons/iconSettings.png"));
}
private void editProBtnMouseExited(java.awt.event.MouseEvent evt) {
if (!isEditProBtnClicked){
editProIconLabel.setIcon(new ImageIcon("src/icons/iconEditPro.png"));
}
}
private void logBtnMouseEntered(java.awt.event.MouseEvent evt) {
logIconLabel.setIcon(new ImageIcon("src/iconsSelected/iconLogOrange.png"));
}
private void logBtnMouseClicked(java.awt.event.MouseEvent evt) {
homePanel.setVisible(false);
shopPanel.setVisible(false);
editProPanel.setVisible(false);
logPanel.setVisible(true);
settingsPanel.setVisible(false);
isLogBtnClicked = true;
logIconLabel.setIcon(new ImageIcon("src/iconsSelected/iconLogOrange.png"));
isShopBtnClicked = false;
isEditProBtnClicked = false;
isHomeBtnClicked = false;
isSettingsBtnClicked = false;
//isLogBtnClicked = true;
//logIconLabel.setIcon(new ImageIcon("src/iconsSelected/iconLogOrange.png"));
homeIconLabel.setIcon(new ImageIcon("src/icons/iconHome.png"));
shopIconLabel.setIcon(new ImageIcon("src/icons/iconShop.png"));
editProIconLabel.setIcon(new ImageIcon("src/icons/iconEditPro.png"));
settingsIconLabel.setIcon(new ImageIcon("src/icons/iconSettings.png"));
}
private void logBtnMouseExited(java.awt.event.MouseEvent evt) {
if (!isLogBtnClicked){
logIconLabel.setIcon(new ImageIcon("src/icons/iconLog.png"));
}
}
private void settingsBtnMouseEntered(java.awt.event.MouseEvent evt) {
settingsIconLabel.setIcon(new ImageIcon("src/iconsSelected/iconSettingsOrange.png"));
}
private void settingsBtnMouseClicked(java.awt.event.MouseEvent evt) {
homePanel.setVisible(false);
shopPanel.setVisible(false);
editProPanel.setVisible(false);
logPanel.setVisible(false);
settingsPanel.setVisible(true);
isSettingsBtnClicked = true;
settingsIconLabel.setIcon(new ImageIcon("src/iconsSelected/iconSettingsOrange.png"));
isShopBtnClicked = false;
isEditProBtnClicked = false;
isLogBtnClicked = false;
isHomeBtnClicked = false;
//settingsIconLabel.setIcon(new ImageIcon("src/iconsSelected/iconSettingsOrange.png"));
homeIconLabel.setIcon(new ImageIcon("src/icons/iconHome.png"));
shopIconLabel.setIcon(new ImageIcon("src/icons/iconShop.png"));
logIconLabel.setIcon(new ImageIcon("src/icons/iconLog.png"));
editProIconLabel.setIcon(new ImageIcon("src/icons/iconEditPro.png"));
}
private void settingsBtnMouseExited(java.awt.event.MouseEvent evt) {
if (!isSettingsBtnClicked){
settingsIconLabel.setIcon(new ImageIcon("src/icons/iconSettings.png"));
}
}
private void exitBtnMouseEntered(java.awt.event.MouseEvent evt) {
exitIconLabel.setIcon(new ImageIcon("src/iconsSelected/iconExitOrange.png"));
}
private void exitBtnMouseClicked(java.awt.event.MouseEvent evt) {
System.exit(0);
}
private void exitBtnMouseExited(java.awt.event.MouseEvent evt) {
exitIconLabel.setIcon(new ImageIcon("src/icons/iconExit.png"));
}
private void addShopButtonMouseEntered(java.awt.event.MouseEvent evt) {
addShopLabel.setIcon(new ImageIcon("src/iconsSelected/iconAddShopOrange.png"));
}
private void addShopButtonMouseExited(java.awt.event.MouseEvent evt) {
if (!isAddShopBtnClicked){
addShopLabel.setIcon(new ImageIcon("src/icons/iconAddShop.png"));
}
}
private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void cashButtonMouseEntered(java.awt.event.MouseEvent evt) {
if(a == 0){
cashButton.setCursor(notAllowedCursor);
}else{
cashButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
cashLabel.setIcon(new ImageIcon("src/iconsSelected/iconCashOrange.png"));
}
}
private void cashButtonMouseExited(java.awt.event.MouseEvent evt) {
if (!isCashBtnClicked){
cashLabel.setIcon(new ImageIcon("src/icons/iconCash.png"));
}
}
private void havaleButtonMouseEntered(java.awt.event.MouseEvent evt) {
if(a == 0){
havaleButton.setCursor(notAllowedCursor);
}else{
havaleButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
havaleLabel.setIcon(new ImageIcon("src/iconsSelected/iconQrCodeOrange.png"));
}
}
private void havaleButtonMouseExited(java.awt.event.MouseEvent evt) {
if (!isHavaleBtnClicked){
havaleLabel.setIcon(new ImageIcon("src/icons/iconQrCode.png"));
}
}
private void creditCardButtonMouseEntered(java.awt.event.MouseEvent evt) {
if(a == 0){
creditCardButton.setCursor(notAllowedCursor);
}else{
creditCardButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
creditCardLabel.setIcon(new ImageIcon("src/iconsSelected/iconCreditCardOrange.png"));
}
}
private void creditCardButtonMouseExited(java.awt.event.MouseEvent evt) {
if (!isCreditCardBtnClicked){
creditCardLabel.setIcon(new ImageIcon("src/icons/iconCreditCard.png"));
}
}
private void addShopButtonMouseClicked(java.awt.event.MouseEvent evt) {
isAddShopBtnClicked = true;
addShopLabel.setIcon(new ImageIcon("src/iconsSelected/iconAddShopOrange.png"));
//Show the product in the basket
basketPro.setVisible(true);
//get product name and show it in the basket
basketProName.setText(productName.getText());
//get the price of the product and show it in the basket
basketProPrice.setText(productPrice.getText());
//get the icon of the product and show it in the basket
ImageIcon icon = (ImageIcon) productPhoto.getIcon(); //get the icon of productPhoto and give it a variable called "icon"
Image img = icon.getImage().getScaledInstance(basketProIcon.getWidth(), basketProIcon.getHeight(), Image.SCALE_SMOOTH); //change "icon" variable sizes to match basketProIcon sizes
basketProIcon.setIcon(new ImageIcon(img)); //apply the icon on the basketProIcon label after the changes
String priceString = productPrice.getText();
priceString = priceString.replace("$", ""); // remove the dollar sign
double price = Double.parseDouble(priceString);
try {
int newQuantity = (int) Double.parseDouble(quantityText.getText());
if(newQuantity <= 0) {
JOptionPane.showMessageDialog(null, "Miktar 0'dan büyük olmalıdır");
quantityText.setText("1");
return;
}
//if(initialPrice == 0.0) {
initialPrice = price;
totalPrice = initialPrice * newQuantity;
quantity = newQuantity;
quantityText.setText(String.valueOf(quantity));
priceText.setText(String.format("$%.2f", totalPrice));
basketProPrice.setText(String.format("$%.2f", totalPrice));
//} else {
// totalPrice += initialPrice * newQuantity;
// quantity += newQuantity;
// quantityText.setText(String.valueOf(quantity));
// priceText.setText(String.format("$%.2f", totalPrice));
// basketProPrice.setText(String.format("$%.2f", totalPrice));
//}
} catch (NumberFormatException ex) {
JOptionPane.showMessageDialog(null, "Geçersiz miktar");
quantityText.setText("1");
quantityText.transferFocus();
}
//Give AddOne variable value to tell the rest button show
AddOne();
payButton();
if(a==1){
addShopLabel.setCursor(notAllowedCursor);
}
}
private void payButtonMouseClicked(java.awt.event.MouseEvent evt) {
//if you click on pay button and you didn't add product to the basket ("a" variable is 0) it will show error massage
if(a==0){
JOptionPane.showMessageDialog(null, "Lutfen Urun Ekleyin");
};
}
private void restButtonMouseClicked(java.awt.event.MouseEvent evt) {
//When click on rest button.. make "a(AddOne)" variable 0 (Remove products from the basket)
a = 0;
System.out.println("0");
//When click on rest button.. back the addShopLabel cursor to Hand Cursor again
addShopLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
//When click on rest button.. back the payButton cursor to notAllowedCursor again
payButton.setCursor(notAllowedCursor);
//When click on rest button.. back button color to the default if it was selected
isAddShopBtnClicked = false;
addShopLabel.setIcon(new ImageIcon("src/icons/iconAddShop.png"));
//When click on rest button.. remove the products that in the basket bar
basketPro.setVisible(false);
//When click on rest button.. remove selected pay methmods
isCashBtnClicked = false;
cashLabel.setIcon(new ImageIcon("src/icons/iconCash.png"));
isCreditCardBtnClicked = false;
creditCardLabel.setIcon(new ImageIcon("src/icons/iconCreditCard.png"));
isHavaleBtnClicked = false;
havaleLabel.setIcon(new ImageIcon("src/icons/iconQrCode.png"));
//When click on rest button.. rest pay button color
payButton.setBackground(new Color(236,236,236));
payText.setForeground(new Color(255,255,255));
//When click on rest button.. the text of the total price will change to $0.0
priceText.setText("$0.0");
quantityText.setText("1");
//When click on rest button.. the variable of the total price will change to $0.0
totalPrice = 0.0;
initialPrice = 0.0;
quantity = 0;
//When click on rest button.. Hide rest button (Because there aren't products in the basket)
restButton.setVisible(false);
}
private void restButtonMouseEntered(java.awt.event.MouseEvent evt) {
restIcon.setIcon(new ImageIcon("src/iconsSelected/iconRestOrange.png"));
}
private void restButtonMouseExited(java.awt.event.MouseEvent evt) {
restIcon.setIcon(new ImageIcon("src/icons/iconRest.png"));
}
private void payButtonMouseEntered(java.awt.event.MouseEvent evt) {
//if Cash or crediCard or Havale buttons are clicked.. change the color of the button
if (isCashBtnClicked || isCreditCardBtnClicked || isHavaleBtnClicked){
payButton.setBackground(new Color(236,236,236));
payText.setForeground(new Color(255,138,0));
}
}
private void payButtonMouseExited(java.awt.event.MouseEvent evt) {
if (isCashBtnClicked || isCreditCardBtnClicked || isHavaleBtnClicked){
payButton.setBackground(new Color(255,138,0));
payText.setForeground(new Color(236,236,236));
}
}
private void cashButtonMouseClicked(java.awt.event.MouseEvent evt) {
if (a >= 1){
isCashBtnClicked = true;
cashLabel.setIcon(new ImageIcon("src/iconsSelected/iconCashOrange.png"));
}
isCreditCardBtnClicked = false;
creditCardLabel.setIcon(new ImageIcon("src/icons/iconCreditCard.png"));
isHavaleBtnClicked = false;
havaleLabel.setIcon(new ImageIcon("src/icons/iconQrCode.png"));
payButton();
//payButton.setBackground(new Color(255,138,0));
//payText.setForeground(new Color(236,236,236));
}
private void creditCardButtonMouseClicked(java.awt.event.MouseEvent evt) {
if (a >= 1){
isCreditCardBtnClicked = true;
creditCardLabel.setIcon(new ImageIcon("src/iconsSelected/iconCreditCardOrange.png"));
}
isCashBtnClicked = false;
cashLabel.setIcon(new ImageIcon("src/icons/iconCash.png"));
isHavaleBtnClicked = false;
havaleLabel.setIcon(new ImageIcon("src/icons/iconQrCode.png"));
}
private void havaleButtonMouseClicked(java.awt.event.MouseEvent evt) {
if (a >= 1){
isHavaleBtnClicked = true;
havaleLabel.setIcon(new ImageIcon("src/iconsSelected/iconQrCodeOrange.png"));
}
isCashBtnClicked = false;
cashLabel.setIcon(new ImageIcon("src/icons/iconCash.png"));
isCreditCardBtnClicked = false;
creditCardLabel.setIcon(new ImageIcon("src/icons/iconCreditCard.png"));
}
private void quantityTextActionPerformed(java.awt.event.ActionEvent evt) {
try {
double newQuantity = Double.parseDouble(quantityText.getText());
if(newQuantity <= 0) {
JOptionPane.showMessageDialog(null, "Miktar 0'dan büyük olmalıdır");
quantityText.setText("1");
} else {
totalPrice = initialPrice * newQuantity;
priceText.setText(String.format("$%.2f", totalPrice));
basketProPrice.setText(String.format("$%.2f", totalPrice));
quantityText.transferFocus();
}
} catch (NumberFormatException ex) {
JOptionPane.showMessageDialog(null, "Geçersiz miktar");
quantityText.setText("1");
quantityText.transferFocus();
}
}
private void homeBtnMouseExited(java.awt.event.MouseEvent evt) {
if (!isHomeBtnClicked){
homeIconLabel.setIcon(new ImageIcon("src/icons/iconHome.png"));
//homeBtn.setBackground(Color.white);
}
}
private void homeBtnMouseClicked(java.awt.event.MouseEvent evt) {
homePanel.setVisible(true);
shopPanel.setVisible(false);
editProPanel.setVisible(false);
logPanel.setVisible(false);
settingsPanel.setVisible(false);
isHomeBtnClicked = true;
homeIconLabel.setIcon(new ImageIcon("src/iconsSelected/iconHomeOrange.png"));
isShopBtnClicked = false;
isEditProBtnClicked = false;
isLogBtnClicked = false;
isSettingsBtnClicked = false;
//homeIconLabel.setIcon(new ImageIcon("src/iconsSelected/iconHomeOrange.png"));
//setBackground(Color.gray);
//homeBtn.setBackground(highlightColor);
shopIconLabel.setIcon(new ImageIcon("src/icons/iconShop.png"));
editProIconLabel.setIcon(new ImageIcon("src/icons/iconEditPro.png"));
logIconLabel.setIcon(new ImageIcon("src/icons/iconLog.png"));
settingsIconLabel.setIcon(new ImageIcon("src/icons/iconSettings.png"));
}
private void homeBtnMouseEntered(java.awt.event.MouseEvent evt) {
homeIconLabel.setIcon(new ImageIcon("src/iconsSelected/iconHomeOrange.png"));
//homeBtn.setBackground(highlightColor);
}
private void plusBtnMouseClicked(java.awt.event.MouseEvent evt) {
try {
double newQuantity = Double.parseDouble(quantityText.getText());
newQuantity += 1;
quantityText.setText(String.valueOf(newQuantity));
totalPrice = initialPrice * newQuantity;
priceText.setText(String.format("$%.2f", totalPrice));
basketProPrice.setText(String.format("$%.2f", totalPrice));
} catch (NumberFormatException ex) {
JOptionPane.showMessageDialog(null, "Geçersiz miktar");
quantityText.setText("1");
quantityText.transferFocus();
}
}
private void minusBtnMouseClicked(java.awt.event.MouseEvent evt) {
try {
double newQuantity = Double.parseDouble(quantityText.getText());
if(newQuantity > 1) {
newQuantity -= 1;
quantityText.setText(String.valueOf(newQuantity));
totalPrice = initialPrice * newQuantity;
priceText.setText(String.format("$%.2f", totalPrice));
basketProPrice.setText(String.format("$%.2f", totalPrice));
}
} catch (NumberFormatException ex) {
JOptionPane.showMessageDialog(null, "Geçersiz miktar");
quantityText.setText("1");
quantityText.transferFocus();
}
}
private void basketProIconMouseEntered(java.awt.event.MouseEvent evt) {
removeProButton.setVisible(true);
}
private void basketProIconMouseExited(java.awt.event.MouseEvent evt) {
removeProButton.setVisible(false);
}
private void basketProIconMouseClicked(java.awt.event.MouseEvent evt) {
a --;
removeProButton.setVisible(false);
basketPro.setVisible(false);
double newQuantity;
newQuantity = 0;
totalPrice = initialPrice * newQuantity;
priceText.setText(String.format("$%.2f", totalPrice));
isAddShopBtnClicked = false;
addShopLabel.setIcon(new ImageIcon("src/icons/iconAddShop.png"));
addShopLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
quantityText.setText("1");
//When click on rest button.. rest pay button color
payButton.setBackground(new Color(236,236,236));
payText.setForeground(new Color(255,255,255));
//When click on rest button.. back the payButton cursor to notAllowedCursor again
if(a == 0){
payButton.setCursor(notAllowedCursor);
}
if(a == 0){
restButton.setVisible(false);
//When click on rest button.. remove selected pay methmods
isCashBtnClicked = false;
cashLabel.setIcon(new ImageIcon("src/icons/iconCash.png"));
isCreditCardBtnClicked = false;
creditCardLabel.setIcon(new ImageIcon("src/icons/iconCreditCard.png"));
isHavaleBtnClicked = false;
havaleLabel.setIcon(new ImageIcon("src/icons/iconQrCode.png"));
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//
/* 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(DashBoard.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(DashBoard.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(DashBoard.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(DashBoard.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
try {
new DashBoard().setVisible(true);
} catch (FontFormatException ex) {
Logger.getLogger(DashBoard.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(DashBoard.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
}
// Variables declaration - do not modify
private javax.swing.JPanel addShopButton;
private javax.swing.JLabel addShopLabel;
private javax.swing.JPanel basketBar;
private javax.swing.JPanel basketPro;
private javax.swing.JLabel basketProIcon;
private javax.swing.JLabel basketProName;
private javax.swing.JLabel basketProPrice;
private javax.swing.JPanel cashButton;
private javax.swing.JLabel cashLabel;
private javax.swing.JLabel cashText;
private javax.swing.JPanel creditCardButton;
private javax.swing.JLabel creditCardLabel;
private javax.swing.JPanel editProBtn;
private javax.swing.JLabel editProIconLabel;
private javax.swing.JPanel editProPanel;
private javax.swing.JPanel exitBtn;
private javax.swing.JLabel exitIconLabel;
private javax.swing.JPanel havaleButton;
private javax.swing.JLabel havaleLabel;
private javax.swing.JLabel havaleText;
private javax.swing.JPanel homeBtn;
private javax.swing.JLabel homeIconLabel;
private javax.swing.JPanel homePanel;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JPanel jPanel3;
private javax.swing.JTextField jTextField1;
private javax.swing.JLabel krediKartText;
private javax.swing.JPanel line;
private javax.swing.JPanel logBtn;
private javax.swing.JLabel logIconLabel;
private javax.swing.JPanel logPanel;
private javax.swing.JLabel logoIcon;
private javax.swing.JPanel menuBar;
private javax.swing.JPanel minusBtn;
private javax.swing.JLabel minusLabel;
private javax.swing.JPanel payButton;
private javax.swing.JLabel payText;
private javax.swing.JPanel plusBtn;
private javax.swing.JLabel plusLabel;
private javax.swing.JLabel priceText;
private javax.swing.JPanel product;
private javax.swing.JLabel productInfo;
private javax.swing.JLabel productName;
private javax.swing.JLabel productPhoto;
private javax.swing.JLabel productPrice;
private javax.swing.JLabel productType;
private javax.swing.JTextField quantityText;
private javax.swing.JLabel removePro;
private javax.swing.JPanel removeProButton;
private javax.swing.JPanel restButton;
private javax.swing.JLabel restIcon;
private javax.swing.JPanel settingsBtn;
private javax.swing.JLabel settingsIconLabel;
private javax.swing.JPanel settingsPanel;
private javax.swing.JPanel shopBtn;
private javax.swing.JLabel shopIconLabel;
private javax.swing.JPanel shopPanel;
private javax.swing.JPanel totalPanel;
private javax.swing.JLabel welcomeText;
private javax.swing.JLabel welcomeText1;
private javax.swing.JLabel welcomeText2;
// End of variables declaration
}