You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello i got some issue with it
i been start coding for 3 months and im using BlueJ
im trying to write simple online bank code with a login,registering and saving there datas with it.
this is my code( i got help from chatgpt for adding interface function):
public class Burtgel extends JFrame implements ActionListener {
public static final String USER_FILENAME = "Hereglegch.ser";
public static final String ACCOUNT_FILENAME = "Account.ser";
private static final int FRAME_WIDTH = 300;
private static final int FRAME_HEIGHT = 200;
private static final int FRAME_X_ORIGIN = 150;
private static final int FRAME_Y_ORIGIN = 250;
private JButton cancelButton;
private JButton okButton;
private JTextField inputLine;
private JLabel prompt;
public Burtgel() {
Container contentPane = getContentPane();
contentPane.setLayout(new FlowLayout());
prompt = new JLabel("Нэр: "); // Initializing prompt with a default text
contentPane.add(prompt);
inputLine = new JTextField(20);
contentPane.add(inputLine);
inputLine.addActionListener(this);
okButton = new JButton("OK");
contentPane.add(okButton);
cancelButton = new JButton("CANCEL");
contentPane.add(cancelButton);
cancelButton.addActionListener(this);
okButton.addActionListener(this);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public void actionPerformed(ActionEvent e) {
if (e.getSource() == cancelButton) {
// Handle cancel button click
// For example, close the window
dispose();
} else if (e.getSource() == okButton || e.getSource() == inputLine) {
// Handle OK button click or Enter key press in the input field
String userInput = inputLine.getText();
// Process the user input further
}
}
public static void main(String[] args) {
// Assuming you want to call either login or register based on some condition
// Replace the condition with your logic
boolean isLoggedIn = false; // Set it to true if the user is already logged in
if (isLoggedIn) {
login();
} else {
register();
}
}
public static void register() {
try (Scanner scanner = new Scanner(System.in)) {
JFrame frame = new Burtgel();
frame.setSize(FRAME_WIDTH, FRAME_HEIGHT);
frame.setResizable(false);
frame.setTitle("Registration");
frame.setLocation(FRAME_X_ORIGIN, FRAME_Y_ORIGIN);
frame.setVisible(true);
} catch (Exception ex) {
ex.printStackTrace();
}
}
public static void login() {
try (Scanner scanner = new Scanner(System.in);
FileInputStream userFileIn = new FileInputStream(USER_FILENAME);
ObjectInputStream userIn = new ObjectInputStream(userFileIn);
FileInputStream haygFileIn = new FileInputStream(ACCOUNT_FILENAME);
ObjectInputStream haygIn = new ObjectInputStream(haygFileIn)) {
oftenly my coding programm shows me where i got wronged but this time it says:
Error(s) found in class. Press Ctrl+K or click right to go to next error.
And doesnt show me where i got mistake, i have no idea about where i lost.
The text was updated successfully, but these errors were encountered:
Hello i got some issue with it
i been start coding for 3 months and im using BlueJ
im trying to write simple online bank code with a login,registering and saving there datas with it.
this is my code( i got help from chatgpt for adding interface function):
import javax.swing.;
import java.awt.;
import java.awt.event.;
import java.io.;
import java.util.Scanner;
public class Burtgel extends JFrame implements ActionListener {
public static final String USER_FILENAME = "Hereglegch.ser";
public static final String ACCOUNT_FILENAME = "Account.ser";
private static final int FRAME_WIDTH = 300;
private static final int FRAME_HEIGHT = 200;
private static final int FRAME_X_ORIGIN = 150;
private static final int FRAME_Y_ORIGIN = 250;
private JButton cancelButton;
private JButton okButton;
private JTextField inputLine;
private JLabel prompt;
public static void login() {
try (Scanner scanner = new Scanner(System.in);
FileInputStream userFileIn = new FileInputStream(USER_FILENAME);
ObjectInputStream userIn = new ObjectInputStream(userFileIn);
FileInputStream haygFileIn = new FileInputStream(ACCOUNT_FILENAME);
ObjectInputStream haygIn = new ObjectInputStream(haygFileIn)) {
}
}
oftenly my coding programm shows me where i got wronged but this time it says:
Error(s) found in class. Press Ctrl+K or click right to go to next error.
And doesnt show me where i got mistake, i have no idea about where i lost.
The text was updated successfully, but these errors were encountered: