Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
use EventQueue instead
Browse files Browse the repository at this point in the history
  • Loading branch information
jhdcruz committed Dec 14, 2022
1 parent 761878d commit 9d1f90f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ jobs:
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Test
run: mvn test

- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/com/pharmacy/views/Dashboard.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import com.pharmacy.controllers.UserController;
import com.pharmacy.models.UserModel;

import javax.swing.JOptionPane;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.time.LocalDateTime;
import javax.swing.JOptionPane;

public class Dashboard extends javax.swing.JFrame {

Expand Down Expand Up @@ -36,7 +36,8 @@ public Dashboard(String username, String userType, UserModel userModel) {
notForEmployee();
}

id = new UserController(id).getUserId(username);
// TODO: Inherit `id` from login instead
EventQueue.invokeLater(() -> id = new UserController(id).getUserId(username));

// Panel Layout set to Card Layout to allow switching between different sections
displayPanel.setLayout(layout);
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/com/pharmacy/views/LoginPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

import com.pharmacy.database.DatabaseInstance;
import com.pharmacy.models.UserModel;

import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import java.awt.EventQueue;
import java.time.LocalDateTime;
import javax.swing.JOptionPane;

public class LoginPage extends javax.swing.JFrame {

Expand Down Expand Up @@ -161,7 +160,7 @@ private void loginButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F

dispose();

SwingUtilities.invokeLater(() -> new Dashboard(username, userType, userModel));
EventQueue.invokeLater(() -> new Dashboard(username, userType, userModel));
} else {
JOptionPane.showMessageDialog(
null,
Expand Down

0 comments on commit 9d1f90f

Please sign in to comment.