Easy Employee ID and Name Badge Generator by Braden EvansEasy Employee ID and Name Badge Generator by Braden Evans

Easy Employee ID and Name Badge Generator

Braden Evans

Braden Evans

Create employee badges with corresponding colors and levels with an interactive graphic user interface
public Main() {
        super("Employee Badge Generator");

        setLayout(new BorderLayout());

        JPanel topPanel = new JPanel(new FlowLayout());
        numBadgesLabel = new JLabel("How many badges? Up to five:");
        topPanel.add(numBadgesLabel);
        numBadgesField = new JTextField(5);
        topPanel.add(numBadgesField);
        generateButton = new JButton("Generate Badges");
        generateButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                int numBadges = Integer.parseInt(numBadgesField.getText());
                if (numBadges > 0 && numBadges <= 5) {
                    createBadgeTabs(numBadges);
                    topPanel.setVisible(false); // Hide badge number selection fields
                } else {
                    JOptionPane.showMessageDialog(Main.this, "Invalid number of badges. Please enter a number between 1 and 5.");
                }
            }
        });
        topPanel.add(generateButton);
        add(topPanel, BorderLayout.NORTH);

        tabbedPane = new JTabbedPane();
        add(tabbedPane, BorderLayout.CENTER);

        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setSize(600, 400);
        setLocationRelativeTo(null);
        setVisible(true);
    }
Like this project

Posted Jul 11, 2024

Allows anyone to create employee badges and ID numbers with just a few simple keystrokes

Likes

0

Views

3