0% found this document useful (0 votes)
7 views7 pages

Megaproject 1

The document states that the training data is current up to October 2023. It implies that any information or events occurring after this date are not included. This sets a temporal limitation on the relevance of the data.

Uploaded by

Paras Okate
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views7 pages

Megaproject 1

The document states that the training data is current up to October 2023. It implies that any information or events occurring after this date are not included. This sets a temporal limitation on the relevance of the data.

Uploaded by

Paras Okate
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 7

/*

* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to
change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this
template
*/

/**
*
* @author HP
*/
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import java.awt.*;

public class InventoryManager {


public static void main(String[] args) {
// Create the main frame
JFrame frame = new JFrame("Inventory Manager");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(1366, 786);
frame.setLayout(null);

// Create a side menu panel


JPanel sideMenu = new JPanel();
sideMenu.setBounds(0, 0, 200, 786);
sideMenu.setBackground(new Color(36, 36, 36));
sideMenu.setLayout(null);

// Add menu buttons


String[] menuItems = {"Department", "Products", "Current Stock",
"Suppliers", "Purchase"};
int yOffset = 50;
for (String item : menuItems) {
JButton button = new JButton(item);
button.setBounds(10, yOffset, 180, 40);
button.setBackground(new Color(64, 64, 64));
button.setForeground(Color.WHITE);
button.setFocusPainted(false);
sideMenu.add(button);
yOffset += 50;
}

frame.add(sideMenu);

// Create a top panel


JPanel topPanel = new JPanel();
topPanel.setBounds(200, 0, 1166, 50);
topPanel.setBackground(new Color(36, 36, 36));
topPanel.setLayout(null);

JLabel userLabel = new JLabel("User: Trial Admin (ADMINISTRATOR)");


userLabel.setForeground(Color.WHITE);
userLabel.setBounds(900, 15, 250, 20);
topPanel.add(userLabel);

JButton signOutButton = new JButton("Sign out");


signOutButton.setBounds(1150, 10, 100, 30);
signOutButton.setBackground(new Color(255, 69, 0));
signOutButton.setForeground(Color.WHITE);
signOutButton.setFocusPainted(false);
topPanel.add(signOutButton);

frame.add(topPanel);

// Create the main content panel


JPanel mainContent = new JPanel();
mainContent.setBounds(200, 50, 1166, 736);
mainContent.setBackground(new Color(48, 48, 48));
mainContent.setLayout(null);

// Add "Products" label


JLabel productsLabel = new JLabel("PRODUCTS");
productsLabel.setFont(new Font("Arial", Font.BOLD, 24));
productsLabel.setForeground(Color.WHITE);
productsLabel.setBounds(20, 20, 200, 30);
mainContent.add(productsLabel);

// Add search bar


JLabel searchLabel = new JLabel("Search:");
searchLabel.setForeground(Color.WHITE);
searchLabel.setBounds(800, 20, 50, 30);
mainContent.add(searchLabel);

JTextField searchField = new JTextField();


searchField.setBounds(850, 20, 200, 30);
mainContent.add(searchField);

JButton refreshButton = new JButton("REFRESH");


refreshButton.setBounds(1060, 20, 100, 30);
refreshButton.setBackground(new Color(64, 64, 64));
refreshButton.setForeground(Color.WHITE);
refreshButton.setFocusPainted(false);
mainContent.add(refreshButton);
// Add table for products
String[] productsColumnNames = {"PRODUCT CODE", "PRODUCT NAME", "COST PRICE",
"QUANTITY","BRAND"};
Object[][] productsData = {
{"prod1", "Laptop", 85000.0, "10","Dell"},
{"prod2", "Laptop", 70000.0, "10","HP"},
{"prod3", "Mobile", 60000.0, "10","Apple"},
{"prod4", "Mobile", 50000.0, "10","Samsung"},
{"prod5", "Charger", 2000.0, "10","Apple"},
{"prod6", "Mouse", 1700.0, "10","Dell"},
{"prod7", "Power Adapter", 3000.0,"10", "Dell"},
{"prod8", "Smart Watch", 15000.0, "10","Apple"}
};

JTable productsTable = new JTable(new DefaultTableModel(productsData,


productsColumnNames));
JScrollPane productsScrollPane = new JScrollPane(productsTable);
productsScrollPane.setBounds(20, 70, 750, 400);
mainContent.add(productsScrollPane);

// Add product details section


JPanel productDetailsPanel = new JPanel();
productDetailsPanel.setBounds(800, 70, 350, 400);
productDetailsPanel.setBackground(new Color(36, 36, 36));
productDetailsPanel.setLayout(null);

JLabel productDetailsLabel = new JLabel("Enter Product Details");


productDetailsLabel.setFont(new Font("Arial", Font.BOLD, 16));
productDetailsLabel.setForeground(Color.WHITE);
productDetailsLabel.setBounds(90, 10, 200, 30);
productDetailsPanel.add(productDetailsLabel);

JLabel[] productFieldLabels = {new JLabel("Product Code:"), new JLabel("Product


Name:"),
new JLabel("Cost Price:"), new JLabel("Quantity"), new JLabel("Brand:")};

int productLabelY = 50;


for (JLabel label : productFieldLabels) {
label.setForeground(Color.WHITE);
label.setBounds(20, productLabelY, 120, 25);
productDetailsPanel.add(label);
productLabelY += 40;
}

JTextField[] productFields = new JTextField[5];


int productFieldY = 50;
for (int i = 0; i < productFields.length; i++) {
productFields[i] = new JTextField();
productFields[i].setBounds(150, productFieldY, 180, 25);
productDetailsPanel.add(productFields[i]);
productFieldY += 40;
}

JButton productAddButton = new JButton("Add");


productAddButton.setBounds(20, 300, 80, 30);
productAddButton.setBackground(new Color(0, 128, 0));
productAddButton.setForeground(Color.WHITE);
productDetailsPanel.add(productAddButton);

JButton productEditButton = new JButton("Edit");


productEditButton.setBounds(120, 300, 80, 30);
productEditButton.setBackground(new Color(255, 165, 0));
productEditButton.setForeground(Color.WHITE);
productDetailsPanel.add(productEditButton);

JButton productDeleteButton = new JButton("Delete");


productDeleteButton.setBounds(220, 300, 80, 30);
productDeleteButton.setBackground(new Color(255, 69, 0));
productDeleteButton.setForeground(Color.WHITE);
productDetailsPanel.add(productDeleteButton);

JButton productClearButton = new JButton("Clear");


productClearButton.setBounds(120, 340, 100, 30);
productClearButton.setBackground(new Color(64, 64, 64));
productClearButton.setForeground(Color.WHITE);
productDetailsPanel.add(productClearButton);

mainContent.add(productDetailsPanel);

// Add table for products


String[] columnNames = {"PRODUCTCODE",
"PRODUCTNAME","QUANTITY" ,"COSTPRICE", "BRAND"};
Object[][] data = {
{"prod1", "Laptop", "10" ,"85000.0" ,"Dell"},
{"prod2", "Laptop","10" , 70000.0,"HP"},
{"prod3", "Mobile", "10" ,60000.0,"Apple"},
{"prod4", "Mobile", "10" ,50000.0,"Samsung"},
{"prod5", "Charger", "10" ,2000.0,"Apple"},
{"prod6", "Mouse", "10" ,1700.0,"Dell"},
{"prod7", "Power Adapter", "10" ,3000.0,"Dell"},
{"prod8", "Smart Watch", "10" ,15000.0,"Apple"}
};

JTable productTable = new JTable(new DefaultTableModel(data, columnNames));


JScrollPane tableScrollPane = new JScrollPane(productTable);
tableScrollPane.setBounds(20, 70, 750, 400);
mainContent.add(tableScrollPane);

// Add "Department" dropdown menu


JPanel departmentContent = new JPanel();
departmentContent.setBounds(200, 50, 1166, 736);
departmentContent.setBackground(new Color(48, 48, 48));
departmentContent.setLayout(null);

JLabel departmentLabel = new JLabel("DEPARTMENT");


departmentLabel.setFont(new Font("Arial", Font.BOLD, 24));
departmentLabel.setForeground(Color.WHITE);
departmentLabel.setBounds(20, 20, 200, 30);
departmentContent.add(departmentLabel);

JLabel dropdownLabel = new JLabel("Select an Option:");


dropdownLabel.setForeground(Color.WHITE);
dropdownLabel.setBounds(20, 70, 150, 30);
departmentContent.add(dropdownLabel);

String[] departmentOptions = {"Computer", "IT", "Civil", "Electronics",


"Mechanical"};
JComboBox<String> departmentDropdown = new JComboBox<>(departmentOptions);
departmentDropdown.setBounds(180, 70, 200, 30);
departmentContent.add(departmentDropdown);

// Add "Current Stock" section


JPanel stockContent = new JPanel();
stockContent.setBounds(200, 50, 1166, 736);
stockContent.setBackground(new Color(48, 48, 48));
stockContent.setLayout(null);

JLabel stockLabel = new JLabel("CURRENT STOCK");


stockLabel.setFont(new Font("Arial", Font.BOLD, 24));
stockLabel.setForeground(Color.WHITE);
stockLabel.setBounds(20, 20, 200, 30);
stockContent.add(stockLabel);

String[] stockColumnNames = {"PRODUCTCODE", "PRODUCTNAME", "QUANTITY",


"COSTPRICE", };
Object[][] stockData = {
{"prod1", "Laptop", 146, 85000.0},
{"prod2", "Laptop", 100, 70000.0},
{"prod3", "Mobile", 202, 60000.0},
{"prod4", "Mobile", 172, 50000.0},
{"prod5", "Charger", 500, 2000.0},
{"prod6", "Mouse", 500, 1700.0},
{"prod7", "Power Adapter", 10, 3000.0, 3500.0},
{"prod8", "Smart Watch", 20, 15000.0, 17000.0}
};

JTable stockTable = new JTable(new DefaultTableModel(stockData,


stockColumnNames));
JScrollPane stockScrollPane = new JScrollPane(stockTable);
stockScrollPane.setBounds(20, 70, 1120, 400);
stockContent.add(stockScrollPane);

// Add "Suppliers" section


JPanel suppliersContent = new JPanel();
suppliersContent.setBounds(200, 50, 1166, 736);
suppliersContent.setBackground(new Color(48, 48, 48));
suppliersContent.setLayout(null);

JLabel suppliersLabel = new JLabel("SUPPLIERS");


suppliersLabel.setFont(new Font("Arial", Font.BOLD, 24));
suppliersLabel.setForeground(Color.WHITE);
suppliersLabel.setBounds(20, 20, 200, 30);
suppliersContent.add(suppliersLabel);

JLabel suppliersSearchLabel = new JLabel("Search:");


suppliersSearchLabel.setForeground(Color.WHITE);
suppliersSearchLabel.setBounds(800, 20, 50, 30);
suppliersContent.add(suppliersSearchLabel);

JTextField suppliersSearchField = new JTextField();


suppliersSearchField.setBounds(850, 20, 200, 30);
suppliersContent.add(suppliersSearchField);

String[] suppliersColumnNames = {"SUPPLIERCODE", "FULLNAME", "LOCATION",


"MOBILE", "PRODUCTNAME", "PRODUCTCODE" ,"QUANTITY"};
Object[][] suppliersData = {
{"sup1", "Dell Inc.", "Gurugram",
"1800560001" ,"Laptop" ,"prod1","10"},
{"sup2", "iWorld Stores", "New Delhi", "1800560041"},
{"sup3", "Samsung Appliances", "New Delhi", "6546521234"},
{"sup4", "Hewlett-Packard", "Mumbai", "8555202215"},
{"sup5", "Hewlett-Packard Ltd.", "Mumbai", "8555203300"},
{"sup6", "Shelby Company Ltd.", "Birmingham", "9696969696"}
};

JTable suppliersTable = new JTable(new DefaultTableModel(suppliersData,


suppliersColumnNames));
JScrollPane suppliersScrollPane = new JScrollPane(suppliersTable);
suppliersScrollPane.setBounds(20, 70, 750, 400);
suppliersContent.add(suppliersScrollPane);

JPanel supplierDetailsPanel = new JPanel();


supplierDetailsPanel.setBounds(800, 70, 350, 400);
supplierDetailsPanel.setBackground(new Color(36, 36, 36));
supplierDetailsPanel.setLayout(null);

JLabel supplierDetailsLabel = new JLabel("Enter Supplier Details");


supplierDetailsLabel.setFont(new Font("Arial", Font.BOLD, 16));
supplierDetailsLabel.setForeground(Color.WHITE);
supplierDetailsLabel.setBounds(90, 10, 200, 30);
supplierDetailsPanel.add(supplierDetailsLabel);
JLabel[] supplierFieldLabels = {new JLabel("Supplier Code:"), new
JLabel("Full Name:"),
new JLabel("Location:"), new JLabel("Contact:"),
new JLabel("PRODUCT NAME:"), new JLabel("PRODUCT CODE:")};

int supplierLabelY = 50;


for (JLabel label : supplierFieldLabels) {
label.setForeground(Color.WHITE);
label.setBounds(20, supplierLabelY, 120, 25);
supplierDetailsPanel.add(label);
supplierLabelY += 40;
}

JTextField[] supplierFields = new JTextField[6];


int supplierFieldY = 50;
for (int i = 0; i < supplierFields.length; i++) {
supplierFields[i] = new JTextField();
supplierFields[i].setBounds(150, supplierFieldY, 180, 25);
supplierDetailsPanel.add(supplierFields[i]);
supplierFieldY += 40;
}

JButton supplierAddButton = new JButton("Add");


supplierAddButton.setBounds(20, 300, 80, 30);
supplierAddButton.setBackground(new Color(0, 128, 0));
supplierAddButton.setForeground(Color.WHITE);
supplierDetailsPanel.add(supplierAddButton);

JButton supplierEditButton = new JButton("Edit");


supplierEditButton.setBounds(120, 300, 80, 30);
supplierEditButton.setBackground(new Color(255, 165, 0));
supplierEditButton.setForeground(Color.WHITE);
supplierDetailsPanel.add(supplierEditButton);

JButton supplierDeleteButton = new JButton("Delete");


supplierDeleteButton.setBounds(220, 300, 80, 30);
supplierDeleteButton.setBackground(new Color(255, 69, 0));
supplierDeleteButton.setForeground(Color.WHITE);
supplierDetailsPanel.add(supplierDeleteButton);

JButton supplierClearButton = new JButton("CLEAR");


supplierClearButton.setBounds(120, 340, 100, 30);
supplierClearButton.setBackground(new Color(64, 64, 64));
supplierClearButton.setForeground(Color.WHITE);
supplierDetailsPanel.add(supplierClearButton);

suppliersContent.add(supplierDetailsPanel);

// Initially display "Products" section


mainContent.setVisible(false);
departmentContent.setVisible(true);
stockContent.setVisible(false);
suppliersContent.setVisible(false);

// Add action listeners to menu buttons


((JButton) sideMenu.getComponent(0)).addActionListener(e -> {
departmentContent.setVisible(true);
mainContent.setVisible(false);
stockContent.setVisible(false);
suppliersContent.setVisible(false);
});

((JButton) sideMenu.getComponent(1)).addActionListener(e -> {


departmentContent.setVisible(false);
mainContent.setVisible(true);
stockContent.setVisible(false);
suppliersContent.setVisible(false);
});

((JButton) sideMenu.getComponent(2)).addActionListener(e -> {


departmentContent.setVisible(false);
mainContent.setVisible(false);
stockContent.setVisible(true);
suppliersContent.setVisible(false);
});

((JButton) sideMenu.getComponent(3)).addActionListener(e -> {


departmentContent.setVisible(false);
mainContent.setVisible(false);
stockContent.setVisible(false);
suppliersContent.setVisible(true);
});

frame.add(mainContent);
frame.add(departmentContent);
frame.add(stockContent);
frame.add(suppliersContent);

// Set frame visibility


frame.setVisible(true);
}
}

You might also like