Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void displayLoadDbScreen() {
- getContentPane().removeAll();
- JLabel welcomeMsg = new JLabel("Database setup");
- welcomeMsg.setFont(new Font("Arial", Font.PLAIN, 18));
- welcomeMsg.setBounds(30,30, 400,20);
- add(welcomeMsg);
- JLabel dbUrlMsg = new JLabel("Database URL: ");
- dbUrlMsg .setFont(new Font("Arial", Font.PLAIN, 12));
- dbUrlMsg .setBounds(30,75, 400,20);
- add(dbUrlMsg);
- JTextField dbUrlInput = new JTextField("jdbc:mysql://localhost:3306");
- dbUrlInput.setBounds(150,71, 200,30);
- add(dbUrlInput);
- JLabel userNameMsg = new JLabel("User name: ");
- userNameMsg.setFont(new Font("Arial", Font.PLAIN, 12));
- userNameMsg.setBounds(30,115, 400,20);
- add(userNameMsg);
- JTextField userNameInput = new JTextField("root");
- userNameInput.setBounds(150,111, 200,30);
- add(userNameInput);
- JLabel passwordMsg = new JLabel("Password: ");
- passwordMsg.setFont(new Font("Arial", Font.PLAIN, 12));
- passwordMsg.setBounds(30,155, 400,20);
- add(passwordMsg);
- JPasswordField passwordInput = new JPasswordField ("");
- passwordInput.setBounds(150,151, 200,30);
- add(passwordInput);
- JLabel dbNameMsg = new JLabel("Database name: ");
- dbNameMsg.setFont(new Font("Arial", Font.PLAIN, 12));
- dbNameMsg.setBounds(30,195, 400,20);
- add(dbNameMsg);
- JTextField dbNameInput = new JTextField("quizzes");
- dbNameInput.setBounds(150,191, 200,30);
- add(dbNameInput);
- JLabel errMsg = new JLabel("");
- errMsg.setFont(new Font("Arial", Font.PLAIN, 10));
- errMsg.setBounds(30,233, 400,10);
- errMsg.setForeground(new Color(255, 0, 0));
- add(errMsg);
- JButton nextBtn = new JButton("next");
- nextBtn.setFont(new Font("Arial", Font.PLAIN, 11));
- nextBtn.setBounds(400,200,60, 30);
- nextBtn.addActionListener(ae -> {
- try {
- validateLoadDbInputs(dbUrlInput.getText(), userNameInput.getText(), new String(passwordInput.getPassword()), dbNameInput.getText());
- dbUrl_ = dbUrlInput.getText();
- dbUserName_ = userNameInput.getText();
- dbPassword_ = new String(passwordInput.getPassword());
- dbName_ = dbNameInput.getText();
- displaySettingsScreen();
- }
- catch(Exception e) {
- errMsg.setText(e.getMessage());
- repaint();
- }
- });
- add(nextBtn);
- JLabel nextMsg = new JLabel("Press 'next' to continue.");
- nextMsg.setFont(new Font("Arial", Font.PLAIN, 10));
- nextMsg.setBounds(350,233, 120,10);
- add(nextMsg);
- repaint();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement