Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package UILayer;
- import java.awt.BorderLayout;
- import java.awt.Color;
- import java.awt.EventQueue;
- import java.awt.Insets;
- import java.awt.Window;
- import javax.swing.JFrame;
- import javax.swing.JPanel;
- import javax.swing.border.EmptyBorder;
- import javax.swing.JLayeredPane;
- import java.awt.CardLayout;
- import javax.swing.GroupLayout;
- import javax.swing.GroupLayout.Alignment;
- import javax.swing.JButton;
- import javax.swing.LayoutStyle.ComponentPlacement;
- import java.awt.event.ActionListener;
- import java.awt.event.ActionEvent;
- import javax.swing.SpringLayout;
- import javax.swing.JList;
- import javax.swing.JComboBox;
- import javax.swing.JTextField;
- import javax.swing.JRadioButton;
- import javax.swing.JSplitPane;
- import javax.swing.JSeparator;
- import javax.swing.SwingConstants;
- import javax.swing.*;
- import java.awt.Font;
- public class MainGUI extends JFrame {
- private JPanel contentPane;
- private JTextField textField;
- /**
- * Launch the application.
- */
- public static void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- try {
- MainGUI frame = new MainGUI();
- frame.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- /**
- * Create the frame.
- */
- public MainGUI() {
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- setBounds(100, 100, 1280, 720);
- contentPane = new JPanel();
- contentPane.setBorder(new EmptyBorder(0, 0, 0, 0));
- contentPane.setLayout(new BorderLayout(0, 0));
- setContentPane(contentPane);
- JLayeredPane layeredPane = new JLayeredPane();
- contentPane.add(layeredPane, BorderLayout.CENTER);
- layeredPane.setLayout(new CardLayout(0, 0));
- JPanel panel = new JPanel();
- layeredPane.add(panel, "name_181804389288300");
- //Color color = new Color(0,0,0);
- //panel.setBackground(color);
- Icon icon = new ImageIcon("C:\\Users\\Lenovo\\Desktop\\group project 1st semester\\files for SVN\\icons\\customer.PNG");
- JButton button = new JButton(icon);
- //button.setBorder(new EmptyBorder(0, 0, 0, 0));
- button.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- CardLayout cardLayout = (CardLayout) layeredPane.getLayout();
- cardLayout.next(layeredPane);
- }
- });
- JButton btnNewButton = new JButton("New button");
- btnNewButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- panel.setVisible(false);
- }
- });
- //button.setBorder(new EmptyBorder(0, 0, 0, 0));
- GroupLayout gl_panel = new GroupLayout(panel);
- gl_panel.setHorizontalGroup(
- gl_panel.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_panel.createSequentialGroup()
- .addComponent(btnNewButton, GroupLayout.PREFERRED_SIZE, 644, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(button, GroupLayout.PREFERRED_SIZE, 668, GroupLayout.PREFERRED_SIZE)
- .addContainerGap(423, Short.MAX_VALUE))
- );
- gl_panel.setVerticalGroup(
- gl_panel.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_panel.createSequentialGroup()
- .addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
- .addComponent(btnNewButton, GroupLayout.PREFERRED_SIZE, 681, GroupLayout.PREFERRED_SIZE)
- .addGroup(Alignment.TRAILING, gl_panel.createSequentialGroup()
- .addContainerGap()
- .addComponent(button, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
- .addContainerGap())
- );
- panel.setLayout(gl_panel);
- JPanel panel_1 = new JPanel();
- layeredPane.add(panel_1, "name_181808694829500");
- JButton btnNewButton_1 = new JButton("New button");
- btnNewButton_1.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- CardLayout cardLayout = (CardLayout) layeredPane.getLayout();
- cardLayout.next(layeredPane);
- }
- });
- JButton button_1 = new JButton("New button");
- JButton button_2 = new JButton("New button");
- SpringLayout sl_panel_1 = new SpringLayout();
- sl_panel_1.putConstraint(SpringLayout.NORTH, button_1, 211, SpringLayout.NORTH, panel_1);
- sl_panel_1.putConstraint(SpringLayout.WEST, button_1, 497, SpringLayout.WEST, panel_1);
- sl_panel_1.putConstraint(SpringLayout.SOUTH, button_1, 464, SpringLayout.NORTH, panel_1);
- sl_panel_1.putConstraint(SpringLayout.EAST, button_1, -86, SpringLayout.WEST, button_2);
- sl_panel_1.putConstraint(SpringLayout.WEST, button_2, 846, SpringLayout.WEST, panel_1);
- sl_panel_1.putConstraint(SpringLayout.EAST, button_2, -150, SpringLayout.EAST, panel_1);
- sl_panel_1.putConstraint(SpringLayout.WEST, btnNewButton_1, 150, SpringLayout.WEST, panel_1);
- sl_panel_1.putConstraint(SpringLayout.NORTH, button_2, 211, SpringLayout.NORTH, panel_1);
- sl_panel_1.putConstraint(SpringLayout.SOUTH, button_2, 464, SpringLayout.NORTH, panel_1);
- sl_panel_1.putConstraint(SpringLayout.NORTH, btnNewButton_1, 211, SpringLayout.NORTH, panel_1);
- sl_panel_1.putConstraint(SpringLayout.SOUTH, btnNewButton_1, 464, SpringLayout.NORTH, panel_1);
- sl_panel_1.putConstraint(SpringLayout.EAST, btnNewButton_1, 410, SpringLayout.WEST, panel_1);
- panel_1.setLayout(sl_panel_1);
- panel_1.add(btnNewButton_1);
- panel_1.add(button_1);
- panel_1.add(button_2);
- JButton btnNewButton_4 = new JButton("BACK");
- btnNewButton_4.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- CardLayout cardLayout = (CardLayout) layeredPane.getLayout();
- cardLayout.previous(layeredPane);
- }
- });
- sl_panel_1.putConstraint(SpringLayout.NORTH, btnNewButton_4, 21, SpringLayout.NORTH, panel_1);
- sl_panel_1.putConstraint(SpringLayout.WEST, btnNewButton_4, 10, SpringLayout.WEST, panel_1);
- panel_1.add(btnNewButton_4);
- JPanel panel_2 = new JPanel();
- layeredPane.add(panel_2, "name_181820611698800");
- JList list = new JList();
- class ComboItem
- {
- private String key;
- private String value;
- public ComboItem(String key, String value)
- {
- this.key = key;
- this.value = value;
- }
- @Override
- public String toString()
- {
- return key;
- }
- public String getKey()
- {
- return key;
- }
- public String getValue()
- {
- return value;
- }
- }
- JComboBox comboBox = new JComboBox();
- comboBox.addItem(new ComboItem("barcode", "barcode"));
- comboBox.addItem(new ComboItem("item name", "item name"));
- comboBox.addItem(new ComboItem("location", "location"));
- comboBox.addItem(new ComboItem("supplier", "supplier"));
- Object item = comboBox.getSelectedItem();
- String value = ((ComboItem)item).getValue();
- textField = new JTextField();
- textField.setColumns(10);
- JTextArea textArea = new JTextArea();
- JCheckBox chckbxProductsforPurchases = new JCheckBox("PRODUCTS FOR PURCHASES");
- chckbxProductsforPurchases.setFont(new Font("Tahoma", Font.PLAIN, 13));
- JCheckBox chckbxProductsForLeases = new JCheckBox("PRODUCTS FOR LEASES");
- chckbxProductsForLeases.setFont(new Font("Tahoma", Font.PLAIN, 13));
- JCheckBox chckbxPackages = new JCheckBox("PACKAGES");
- chckbxPackages.setFont(new Font("Tahoma", Font.PLAIN, 13));
- JButton btnNewButton_2 = new JButton("\uD83D\uDD0D");
- btnNewButton_2.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- /*searchText String stores the text you insert in the searchbar*/
- String searchText = textField.getText();
- /*searchFilter String stores the option you pick from the dropbox*/
- String searchFilter = comboBox.getSelectedItem().toString();
- /*checks if the checkbox(PRODUCTS FOR PURCHASES) is checked*/
- boolean checkPProduct = chckbxProductsforPurchases.isSelected();
- }
- });
- JButton btnNewButton_3 = new JButton("Create new product");
- btnNewButton_3.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- // CreateProductGUI createProductGUI = new CreateProductGUI();
- // createProductGUI.setVisible(true);
- }
- });
- JButton button_3 = new JButton("Update product");
- button_3.setEnabled(false);
- JButton button_4 = new JButton("Delete product");
- button_4.setEnabled(false);
- JButton button_5 = new JButton("Change stock");
- button_5.setEnabled(false);
- JButton button_6 = new JButton("Move product");
- button_6.setEnabled(false);
- JButton button_7 = new JButton("Print sale");
- button_7.setEnabled(false);
- JSeparator separator = new JSeparator();
- JSeparator separator_1 = new JSeparator();
- JButton button_8 = new JButton("\uD83D\uDD19");
- button_8.setFont(new Font("Tahoma", Font.PLAIN, 16));
- button_8.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- CardLayout cardLayout = (CardLayout) layeredPane.getLayout();
- cardLayout.previous(layeredPane);
- }
- });
- GroupLayout gl_panel_2 = new GroupLayout(panel_2);
- gl_panel_2.setHorizontalGroup(
- gl_panel_2.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_panel_2.createSequentialGroup()
- .addGap(43)
- .addGroup(gl_panel_2.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_panel_2.createSequentialGroup()
- .addComponent(btnNewButton_3, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE)
- .addGap(30)
- .addComponent(button_3, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE)
- .addGap(30)
- .addComponent(button_4, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE)
- .addGap(30)
- .addComponent(button_5, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED, 34, Short.MAX_VALUE)
- .addComponent(button_6, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE))
- .addGroup(gl_panel_2.createSequentialGroup()
- .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, 288, GroupLayout.PREFERRED_SIZE)
- .addGap(30)
- .addComponent(textField, GroupLayout.PREFERRED_SIZE, 248, GroupLayout.PREFERRED_SIZE)
- .addGap(8)))
- .addGroup(gl_panel_2.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_panel_2.createSequentialGroup()
- .addGap(30)
- .addComponent(button_7, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE))
- .addGroup(gl_panel_2.createSequentialGroup()
- .addGap(18)
- .addComponent(btnNewButton_2)
- .addGap(70)
- .addComponent(textArea, GroupLayout.PREFERRED_SIZE, 223, GroupLayout.PREFERRED_SIZE)))
- .addPreferredGap(ComponentPlacement.RELATED, 67, Short.MAX_VALUE)
- .addGroup(gl_panel_2.createParallelGroup(Alignment.LEADING)
- .addComponent(separator_1, GroupLayout.PREFERRED_SIZE, 1, GroupLayout.PREFERRED_SIZE)
- .addComponent(separator, GroupLayout.PREFERRED_SIZE, 1, GroupLayout.PREFERRED_SIZE)
- .addComponent(chckbxProductsForLeases, GroupLayout.PREFERRED_SIZE, 212, GroupLayout.PREFERRED_SIZE)
- .addComponent(chckbxProductsForLeases, GroupLayout.PREFERRED_SIZE, 212, GroupLayout.PREFERRED_SIZE)
- .addComponent(chckbxPackages, GroupLayout.PREFERRED_SIZE, 212, GroupLayout.PREFERRED_SIZE))
- .addGap(18))
- .addGroup(gl_panel_2.createSequentialGroup()
- .addContainerGap()
- .addComponent(button_8, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE)
- .addContainerGap(1195, Short.MAX_VALUE))
- .addComponent(list, GroupLayout.DEFAULT_SIZE, 1268, Short.MAX_VALUE)
- );
- gl_panel_2.setVerticalGroup(
- gl_panel_2.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_panel_2.createSequentialGroup()
- .addComponent(separator, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addGroup(gl_panel_2.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_panel_2.createSequentialGroup()
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(button_8, GroupLayout.PREFERRED_SIZE, 62, GroupLayout.PREFERRED_SIZE)
- .addGap(18)
- .addGroup(gl_panel_2.createParallelGroup(Alignment.LEADING)
- .addComponent(button_3, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE)
- .addComponent(btnNewButton_3, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE)
- .addComponent(button_4, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE)
- .addGroup(gl_panel_2.createParallelGroup(Alignment.BASELINE)
- .addComponent(button_5, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE)
- .addComponent(button_6, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE)
- .addComponent(button_7, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE)))
- .addGap(72)
- .addGroup(gl_panel_2.createParallelGroup(Alignment.BASELINE)
- .addComponent(comboBox, GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE)
- .addComponent(textField, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
- .addComponent(btnNewButton_2, GroupLayout.PREFERRED_SIZE, 34, GroupLayout.PREFERRED_SIZE)
- .addComponent(textArea, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE))
- .addGap(55))
- .addGroup(gl_panel_2.createSequentialGroup()
- .addGap(191)
- .addComponent(chckbxProductsforPurchases, GroupLayout.PREFERRED_SIZE, 37, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(chckbxProductsForLeases, GroupLayout.PREFERRED_SIZE, 37, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(chckbxPackages, GroupLayout.PREFERRED_SIZE, 37, GroupLayout.PREFERRED_SIZE)))
- .addGap(15)
- .addComponent(separator_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.UNRELATED)
- .addComponent(list, GroupLayout.PREFERRED_SIZE, 319, GroupLayout.PREFERRED_SIZE)
- .addContainerGap())
- );
- panel_2.setLayout(gl_panel_2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement