0% found this document useful (0 votes)
2 views4 pages

Cement Distributor Guide

The document is a guide for setting up a Cement Distribution Java project using NetBeans, detailing the creation of a login page, sign-up page, and main application functionalities. It includes code snippets for the LoginPage class, which handles user authentication, and outlines future enhancements such as database integration and UI improvements. The application starts with the LoginPage and transitions to the main CementDistributor interface upon successful login.

Uploaded by

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

Cement Distributor Guide

The document is a guide for setting up a Cement Distribution Java project using NetBeans, detailing the creation of a login page, sign-up page, and main application functionalities. It includes code snippets for the LoginPage class, which handles user authentication, and outlines future enhancements such as database integration and UI improvements. The application starts with the LoginPage and transitions to the main CementDistributor interface upon successful login.

Uploaded by

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

Cement Distribution Java Project Guide

1. Project Setup:

- Open NetBeans.

- Create a new project: File > New Project > Java with Ant > Java Application.

- Name the project "CementDistributor" and set the main class as cement.CementDistributor.

2. Login Page (LoginPage.java):

- This page handles user login functionality.

- Code:

------------------------------------------------------------

package cement;

import javax.swing.*;

import java.awt.*;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

public class LoginPage extends JFrame {

private JTextField usernameField;

private JPasswordField passwordField;

public LoginPage() {

setTitle("Login Page");

setSize(400, 300);

setDefaultCloseOperation(EXIT_ON_CLOSE);
setLayout(new GridLayout(3, 2, 10, 10));

JLabel usernameLabel = new JLabel("Username:");

usernameField = new JTextField();

JLabel passwordLabel = new JLabel("Password:");

passwordField = new JPasswordField();

JButton loginButton = new JButton("Login");

JButton signUpButton = new JButton("Sign Up");

loginButton.addActionListener(new LoginAction());

signUpButton.addActionListener(e -> {

new SignUpPage().setVisible(true);

dispose();

});

add(usernameLabel);

add(usernameField);

add(passwordLabel);

add(passwordField);

add(loginButton);

add(signUpButton);

private class LoginAction implements ActionListener {

@Override

public void actionPerformed(ActionEvent e) {


String username = usernameField.getText();

String password = new String(passwordField.getPassword());

if (username.equals("admin") && password.equals("admin")) {

JOptionPane.showMessageDialog(null, "Login Successful!");

new CementDistributor().setVisible(true);

dispose();

} else {

JOptionPane.showMessageDialog(null, "Invalid credentials. Try again.");

public static void main(String[] args) {

new LoginPage().setVisible(true);

------------------------------------------------------------

3. Sign-Up Page (SignUpPage.java):

- This page allows users to create accounts.

- Code provided in the detailed explanation.

4. Main Application (CementDistributor.java):

- Manages the Cement Distribution functionality, including Add, Update, Search, and Delete.

5. Running the Application:


- Start with LoginPage.java.

- After successful login, navigate to CementDistributor.

6. Future Enhancements:

- Connect the application to a database (e.g., SQLite or MySQL).

- Add form validation for user input.

- Enhance UI using JavaFX.

For more details, refer to the provided source code examples.

You might also like