This is my ide program for a highsum gui game.
"import GUIExample.GameTableFrame;
import Model.*;
import GUIExample.LoginDialog;

public class GUIExample {

    private Dealer dealer;
    private Player player;
    private GameTableFrame app;

    public GUIExample() {
    }

    public void run() {
        dealer.shuffleCards();
        app = new GameTableFrame(dealer, player);
        app.setVisible(true); // Replace app.run(); with this line
    }

    public static void main(String[] args) {
        LoginDialog loginDialog = new LoginDialog(null);
        loginDialog.setVisible(true);

        if (loginDialog.isLoggedIn()) {
            String login = loginDialog.getLogin();
            String password = loginDialog.getPassword();

            GUIExample example = new GUIExample();
            example.dealer = new Dealer();
            example.player = new Player(login, password, 10000);
            example.run();
        }
    }
}
package GUIExample;

import Model.Dealer;
import Model.HighSum;
import Model.Player;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class HighSumGUI {
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                LoginDialog loginDialog = new LoginDialog(null);
                loginDialog.setVisible(true);

                if (loginDialog.isLoggedIn()) {
                    String login = loginDialog.getLogin();
                    String password = loginDialog.getPassword();

                    HighSum highSum = new HighSum() {
                        // Override the ‘run’ method to display and update the GameTableFrame
                        @Override
                        public void run() {
                            Dealer dealer = getDealer();
                            Player player = getPlayer();
                            GameTableFrame gameTableFrame = new GameTableFrame(dealer, player);
                            gameTableFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

                            // Use a loop to continuously update and start new games as desired by the user
                            boolean carryOn = true;
                            while (carryOn) {
                                runOneRound();
                                gameTableFrame.updateScreen();

                                int response = JOptionPane.showConfirmDialog(
                                        gameTableFrame,
                                        "Do you want to play another game?",
                                        "New Game",
                                        JOptionPane.YES_NO_OPTION
                                );

                                if (response == JOptionPane.YES_OPTION) {
                                    dealer.clearCardsOnHand();
                                    player.clearCardsOnHand();
                                } else {
                                    carryOn = false;
                                    gameTableFrame.dispose();
                                }
                            }
                        }
                    };

                    highSum.init(login, password);
                    highSum.run();
                }
            }
        });
    }
}




package Controller;
import Model.Dealer;
import Model.Player;
import View.ViewController;

public class GameController {

	private Dealer dealer;
	private Player player;
	private ViewController view;
	private int chipsOnTable;
	private boolean playerQuit;
	
	public GameController(Dealer dealer,Player player,ViewController view) {
		this.dealer = dealer;
		this.player = player;
		this.view = view;
		this.chipsOnTable = 0;
	}
	
	public boolean getPlayerQuitStatus() {
	    return playerQuit;
	}
	
	public void run() {
		
		boolean carryOn= true;
		
		while(carryOn) {
			runOneRound();
			char r = this.view.getPlayerNextGame();
			if(r=='n') {
				carryOn = false;
			}
		}
		this.view.displayPlayerNameAndLeftOverChips(this.player);
		this.view.displayExitGame();
	}
	
	public void runOneRound() {
		
		this.view.displayGameTitle();
		this.view.displayDoubleLine();
		this.view.displayPlayerNameAndChips(this.player);
		this.view.displaySingleLine();
		this.view.displayGameStart();
		this.view.displaySingleLine();
		this.dealer.shuffleCards();
		this.chipsOnTable = 0;
		boolean playerQuit = false;
				
		for(int round = 1;round<=4;round++) {
			this.view.displaySingleLine();
			this.view.displayDealerDealCardsAndGameRound(round);
			this.view.displaySingleLine();

			if (round == 1) { //round 1 deal extra card
			    this.dealer.dealCardTo(this.player);
			    this.dealer.dealCardTo(this.dealer);
			} else {
			    this.dealer.dealCardTo(this.player);
			    this.dealer.dealCardTo(this.dealer);
			}
			
			this.view.displayPlayerCardsOnHand(this.dealer);
			this.view.displayBlankLine();
			this.view.displayPlayerCardsOnHand(player);
			this.view.displayPlayerTotalCardValue(player);

			int whoCanCall = this.dealer.determineWhichCardRankHigher(dealer.getLastCard(), player.getLastCard());
			
			if(whoCanCall==1) {//dealer call
				int chipsToBet = this.view. getDealerCallBetChips();
				//ask player want to follow?
				char r = this.view.getPlayerFollowOrNot(this.player,chipsToBet);
				if(r=='y') {
					this.player.deductChips(chipsToBet);
					this.chipsOnTable+=2*chipsToBet;	
					this.view.displayPlayerNameAndLeftOverChips(this.player);
					this.view.displayBetOntable(this.chipsOnTable);
				}else {
					playerQuit = true;
					break;
				}
			}else {//player call
				if(round==1) {//round 1 player cannot quit
					int chipsToBet = view.getPlayerCallBetChip(this.player);
					this.player.deductChips(chipsToBet);
					this.chipsOnTable+=2*chipsToBet;
					this.view.displayBetOntable(this.chipsOnTable);
				}else {
					char r = this.view.getPlayerCallOrQuit();
					if(r=='c') {
						int chipsToBet = view.getPlayerCallBetChip(this.player);
						this.player.deductChips(chipsToBet);
						this.chipsOnTable+=2*chipsToBet;
						this.view.displayPlayerNameAndLeftOverChips(this.player);
						this.view.displayBetOntable(this.chipsOnTable);
					}else {
						playerQuit = true;
						break;
					}
				}
			}
		}
		
		//check who win
		if(playerQuit) {
			this.view.displayPlayerNameAndLeftOverChips(this.player);
			this.view.displayPlayerQuit();
		}
		else if(this.player.getTotalCardsValue()>this.dealer.getTotalCardsValue()) {
			this.view.displayPlayerWin(this.player);
			this.player.addChips(chipsOnTable);
			this.chipsOnTable=0;
			this.view.displayPlayerNameAndLeftOverChips(this.player);
		}else if(this.player.getTotalCardsValue()<this.dealer.getTotalCardsValue()) {
			this.view.displayDealerWin();
			this.view.displayPlayerNameAndLeftOverChips(this.player);
		}else {
			this.view.displayTie();
			this.player.addChips(chipsOnTable/2);
			this.view.displayPlayerNameAndLeftOverChips(this.player);
		}
		
		//put all the cards back to the deck
		dealer.addCardsBackToDeck(dealer.getCardsOnHand());
		dealer.addCardsBackToDeck(player.getCardsOnHand());
		dealer.clearCardsOnHand();
		player.clearCardsOnHand();	
	}
	
	
}
package GUIExample;
import Model.Dealer;
import Model.HighSum;
import Model.Player;
import java.awt.BorderLayout;
import javax.swing.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class GameTableFrame extends JFrame {

    private GameTablePanel gameTablePanel;
    private Dealer dealer;
    private Player player;
    private JLabel shufflingLabel;
    private JButton playButton;
    private JButton quitButton;

    public GameTableFrame(Dealer dealer, Player player) {
        this.dealer = dealer;
        this.player = player;
        gameTablePanel = new GameTablePanel(dealer, player);

        shufflingLabel = new JLabel("Shuffling");
        shufflingLabel.setHorizontalAlignment(SwingConstants.CENTER);
        playButton = new JButton("Play");
        quitButton = new JButton("Quit");
        
        addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
    
        playButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                shufflingLabel.setVisible(true);
                HighSum highSum = new HighSum();
                highSum.init(player.getLoginName(), "some_default_password");
                highSum.run();
                updateScreen();
            }
        });

        quitButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                System.exit(0);
            }
        });

        // Create the main panel that contains both the game board and the buttons
        JPanel mainPanel = new JPanel();
        mainPanel.setLayout(new BorderLayout());

        JPanel buttonsPanel = new JPanel();
        buttonsPanel.add(playButton);
        buttonsPanel.add(quitButton);

        mainPanel.add(gameTablePanel, BorderLayout.CENTER);
        mainPanel.add(buttonsPanel, BorderLayout.SOUTH);
        mainPanel.add(shufflingLabel, BorderLayout.NORTH);
        shufflingLabel.setVisible(false);

        add(mainPanel);

        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        pack();
        setLocationRelativeTo(null);
        setVisible(true);
    }

// This method updates the screen after each game
public void updateScreen() {
    gameTablePanel.updateTable(dealer, player);
}
}
package GUIExample;
import java.awt.*;
import javax.swing.*;

import Model.*;

public class GameTablePanel extends JPanel {

private Player player;
private Dealer dealer;

public GameTablePanel(Dealer dealer, Player player) {

setLayout(new BorderLayout());
setBackground(Color.GREEN);
setPreferredSize(new Dimension(1024, 768));

this.dealer = dealer;
this.player = player;
}

public void updateTable(Dealer dealer, Player player) {
this.dealer = dealer;
this.player = player;
repaint();
}

@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);

// Draw dealer’s cards
int dealerX = 50;
int dealerY = 100;
g.drawString("Dealer", dealerX, dealerY - 20);
dealerX = drawPlayerHand(g, dealer, dealerX, dealerY, true);

// Draw player’s cards
int playerX = 50;
int playerY = getHeight() - 200;
g.drawString("Player", playerX, playerY - 20);
playerX = drawPlayerHand(g, player, playerX, playerY, false);

// Draw chips on the table
g.setColor(Color.BLACK);
g.setFont(new Font("Arial", Font.PLAIN, 18));
g.drawString("Chips on the table: ", playerX + 50, playerY);

}

private int drawPlayerHand(Graphics g, Player p, int x, int y, boolean isDealer) {
int i = 0;
for (Card c : p.getCardsOnHand()) {
if (isDealer && i == 0) {
new ImageIcon("images/back.png").paintIcon(this, g, x, y);
} else {
c.paintIcon(this, g, x, y);
}

x += 100;
i++;
}
return x;
}
}
package GUIExample;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class LoginDialog extends JDialog {

    private JTextField loginField;
    private JPasswordField passwordField;
    private JButton loginButton;
    private boolean loggedIn = false;

    public LoginDialog(JFrame parent) {
        super(parent, "Login", true);

        loginField = new JTextField(20);
        passwordField = new JPasswordField(20);
        loginButton = new JButton("Login");

        loginButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                loggedIn = true;
                dispose();
            }
        });

        JPanel panel = new JPanel();
        panel.setLayout(new GridLayout(3, 2));
        panel.add(new JLabel("Login:"));
        panel.add(loginField);
        panel.add(new JLabel("Password:"));
        panel.add(passwordField);
        panel.add(loginButton);

        add(panel);

        pack();
        setLocationRelativeTo(parent);
    }

    public String getLogin() {
        return loginField.getText();
    }

    public String getPassword() {
        return new String(passwordField.getPassword());
    }

    public boolean isLoggedIn() {
        return loggedIn;
    }
}
package Helper;
public class Keyboard {

	public static String readString(String prompt) {
		System.out.print(prompt);
		return new java.util.Scanner(System.in).nextLine();
	}

	public static int readInt(String prompt) {
		int input = 0;
		boolean valid = false;
		while (!valid) {
			try {
				input = Integer.parseInt(readString(prompt));
				valid = true;
			} catch (NumberFormatException e) {
				System.out.println("*** Please enter an integer ***");
			}
		}
		return input;
	}

	public static double readDouble(String prompt) {
		double input = 0;
		boolean valid = false;
		while (!valid) {
			try {
				input = Double.parseDouble(readString(prompt));
				valid = true;
			} catch (NumberFormatException e) {
				System.out.println("*** Please enter a double ***");
			}
		}
		return input;
	}

	public static float readFloat(String prompt) {
		float input = 0;
		boolean valid = false;
		while (!valid) {
			try {
				input = Float.parseFloat(readString(prompt));
				valid = true;
			} catch (NumberFormatException e) {
				System.out.println("*** Please enter a float ***");
			}
		}
		return input;
	}

	public static long readLong(String prompt) {
		long input = 0;
		boolean valid = false;
		while (!valid) {
			try {
				input = Long.parseLong(readString(prompt));
				valid = true;
			} catch (NumberFormatException e) {
				e.printStackTrace();
				System.out.println("*** Please enter a long ***");
			}
		}
		return input;
	}

	

	public static char readChar(String prompt,char[] choices) {
		boolean validChoice = false;
		char r = ' ';
		while(!validChoice) {
			r = Keyboard.readChar(prompt+" "+charArrayToString(choices)+":");
			if(!validateChoice(choices,r)) {
				System.out.println("Invalid input");
			}else {
				validChoice = true;
			}
		}
		return r;
	}
	
	private static String charArrayToString(char[] charArray) {
		String s = "[";
		for(int i=0;i<charArray.length;i++) {
			s+=charArray[i];
			if(i!=charArray.length-1) {
				s+=",";
			}
		}
		s += "]";
		return s;
	}

	private static boolean validateChoice(char[] choices, char choice) {
		boolean validChoice = false;
		for(int i=0;i<choices.length;i++) {
			if(choices[i]==choice) {
				validChoice = true;
				break;
			}
		}
		return validChoice;
	}
	
	public static char readChar(String prompt) {
		char input = 0;
		boolean valid = false;
		while (!valid) {
			String temp = readString(prompt);
			if (temp.length() != 1) {
				System.out.println("*** Please enter a character ***");
			} else {
				input = temp.charAt(0);
				valid = true;
			}
		}
		return input;
	}

	public static boolean readBoolean(String prompt) {
		boolean valid = false;
		while (!valid) {
			String input = readString(prompt);
			if (input.equalsIgnoreCase("yes") || input.equalsIgnoreCase("y") || input.equalsIgnoreCase("true")
					|| input.equalsIgnoreCase("t")) {
				return true;
			} else if (input.equalsIgnoreCase("no") || input.equalsIgnoreCase("n") || input.equalsIgnoreCase("false")
					|| input.equalsIgnoreCase("f")) {
				return false;
			} else {
				System.out.println("*** Please enter Yes/No or True/False ***");
			}
		}
		return false;
	}

	public static java.util.Date readDate(String prompt) {
		java.util.Date date = null;
		boolean valid = false;
		while (!valid) {
			try {
				String input = readString(prompt).trim();
				if (input.matches("\\d\\d/\\d\\d/\\d\\d\\d\\d")) {
					int day = Integer.parseInt(input.substring(0, 2));
					int month = Integer.parseInt(input.substring(3, 5));
					int year = Integer.parseInt(input.substring(6, 10));
					java.util.Calendar cal = java.util.Calendar.getInstance();
					cal.setLenient(false);
					cal.set(year, month - 1, day, 0, 0, 0);
					date = cal.getTime();
					valid = true;
				} else {
					System.out.println("*** Please enter a date (DD/MM/YYYY) ***");
				}
			} catch (IllegalArgumentException e) {
				System.out.println("*** Please enter a date (DD/MM/YYYY) ***");
			}
		}
		return date;
	}

	private static String quit = "0";

	public static int getUserOption(String title, String[] menu) {
		displayMenu(title, menu);
		int choice = Keyboard.readInt("Enter Choice --> ");
		while (choice > menu.length || choice < 0) {
			choice = Keyboard.readInt("Invalid Choice, Re-enter --> ");
		}
		return choice;
	}

	private static void displayMenu(String title, String[] menu) {
		line(80, "=");
		System.out.println(title.toUpperCase());
		line(80, "-");
		for (int i = 0; i < menu.length; i++) {
			System.out.println("[" + (i + 1) + "] " + menu[i]);
		}
		System.out.println("[" + quit + "] Quit");
		line(80, "-");
	}

	public static void line(int len, String c) {
		System.out.println(String.format("%" + len + "s", " ").replaceAll(" ", c));
	}
}
package Helper;

import java.security.MessageDigest;

public class Utility {
    
    public static String getHash(String base)
    {
        String message=""; 
         
        try{
        MessageDigest digest = MessageDigest.getInstance("SHA-256");
        byte[] hash = digest.digest(base.getBytes("UTF-8"));
        StringBuffer hexString = new StringBuffer();

        for (int i = 0; i < hash.length; i++) {
            String hex = Integer.toHexString(0xff & hash[i]);
            if(hex.length() == 1) hexString.append('0');
            hexString.append(hex);
        }

        message = hexString.toString();
    
        } catch(Exception ex){
             throw new RuntimeException(ex);
        }
        
        return message;
    }
     
    public static void printLine(int num)
    {
      printLine(num,'-');
    }
     
    public static void printDoubleLine(int num)
    {
        printLine(num,'=');
    }
    
    
    public static void printLine(int num,char pattern)
    {
      for(int i =0;i<num;i++)
      {
          System.out.print(pattern);
      }
      System.out.println("");
        
    }
    
}
package Model;
import javax.swing.*;

public class Card extends ImageIcon {
    private String suit;
    private String name;
    private int value;
    private int rank;
    private boolean faceDown;

    public Card(String suit, String name, int value, int rank) {
        super("images/" + suit + name + ".png");
        this.suit = suit;
        this.name = name;
        this.value = value;
        this.rank = rank;
        this.faceDown = false;
    }

    public boolean isFaceDown() {
        return this.faceDown;
    }

    public void setFaceDown(boolean faceDown) {
        this.faceDown = faceDown;
    }

	public String getSuit() {
		return this.suit;
	}

	public String getName() {
		return this.name;
	}

	public int getValue() {
		return this.value;
	}
	
	public int getRank() {
		return this.rank;
	}
	
	
	public String toString() {
        if (this.faceDown) {
            return "<HIDDEN CARD>";
        } else {
            return "<" + this.suit + " " + this.name + ">";
        }
    }
	
	public String display() {
		return "<"+this.suit+" "+this.name+" "+this.rank+">";
	}
}
//card rank
//    D  C  H  S
//1   1  2  3  4
//2   5  6  7  8
//3   9 10 11 12
//4  13 14 15 16
//5  17 18 19 20
//6  21 22 23 24
//7  25 26 27 28
//8  29 30 31 32
//9  33 34 35 36 
//10 37 38 39 40
//J  41 42 43 44
//Q  45 46 47 48
//K  49 50 51 52
package Model;
import java.util.*;

public class Dealer extends Player {

    private Deck deck;

    public Dealer() {
        super("Dealer", "", 0);
        deck = new Deck();
    }

    public void shuffleCards() {
        System.out.println("Dealer shuffle deck");
        deck.shuffle();
    }

    public void dealCardTo(Player player) {
        Card card = deck.dealCard(); // take a card out from the deck
        player.addCard(card); // pass the card into the player
    }

    public void addCardsBackToDeck(ArrayList<Card> cards) {
        deck.appendCard(cards);
    }
	
	//return 1 if card1 rank higher, else return 2
	public int determineWhichCardRankHigher(Card card1, Card card2) {
		if(card1.getRank()>card2.getRank()) {
			return 1;
		}else {
			return 2;
		}
	}
	
	
	
}
package Model;
import java.util.*;

public class Deck {

	private ArrayList<Card> cards;

	public Deck() {
		cards = new ArrayList<Card>();
		String[] suits = { "Diamond", "Club","Heart","Spade",  };
		for (int i = 0; i < suits.length; i++) {
			String suit = suits[i];
			Card card = new Card(suit, "Ace", 1,1+i);
			cards.add(card);
			
			int c = 5;
			for (int n = 2; n <= 10; n++) {
				Card oCard = new Card(suit, "" + n, n,c+i);
				cards.add(oCard);
				c+=4;
			}

			Card jackCard = new Card(suit, "Jack", 10,41+i);
			cards.add(jackCard);

			Card queenCard = new Card(suit, "Queen", 10,45+i);
			cards.add(queenCard);

			Card kingCard = new Card(suit, "King", 10,49+i);
			cards.add(kingCard);
		}
	}
	
	public Card dealCard() {
		return cards.remove(0);
	}
	
	//add back one card
	public void appendCard(Card card) {
		cards.add(card);
	}
	//add back arraylist of cards
	public void appendCard(ArrayList<Card> cards) {
		for(Card card: cards) {
			this.cards.add(card);
		}
	}

	public void shuffle() {
		Random random = new Random();
		for(int i=0;i<10000;i++) {
			int indexA = random.nextInt(cards.size());
			int indexB = random.nextInt(cards.size());
			Card cardA = cards.get(indexA);
			Card cardB = cards.get(indexB);
			cards.set(indexA, cardB);
			cards.set(indexB, cardA);	
		}
	}

	//for internal use only
	private void showCards() {
		for (Card card : cards) {
			System.out.println(card);
		}
	}
	
	//for internal use only
	private void displayCards() {
		for (Card card : cards) {
			System.out.println(card.display());
		}
	}

	public static void main(String[] args) {
		Deck deck = new Deck();
		//deck.shuffle();
		/*Card card1 = deck.dealCard();
		Card card2 = deck.dealCard();
		Card card3 = deck.dealCard();
		deck.showCards();
		
		ArrayList<Card> cards = new ArrayList<Card>();
		cards.add(card1);
		cards.add(card2);
		cards.add(card3);
		deck.appendCard(cards);
		System.out.println();*/
		deck.displayCards();
	}
}

//card rank
//D  C  H  S
//1   1  2  3  4
//2   5  6  7  8
//3   9 10 11 12
//4  13 14 15 16
//5  17 18 19 20
//6  21 22 23 24
//7  25 26 27 28
//8  29 30 31 32
//9  33 34 35 36 
//10 37 38 39 40
//J  41 42 43 44
//Q  45 46 47 48
//K  49 50 51 52
package Model;

import Controller.*;
import View.*;
import GUIExample.LoginDialog;
import GUIExample.GameTableFrame;
import javax.swing.JOptionPane;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class HighSum {

    private Dealer dealer;
    private Player player;
    private ViewController view;
    private GameController gc;
    private int chipsOnTable;

    public HighSum() {
    }

    public void init(String login, String password) {
        // Create all the required objects
        this.dealer = new Dealer();
        this.player = new Player(login, password, 50);
        this.view = new ViewController();

        // Bring them together
        this.gc = new GameController(this.dealer, this.player, this.view);
    }

    private Player checkWinner() {
        if(player.getTotalCardsValue() > dealer.getTotalCardsValue())
            return player;
        else if(player.getTotalCardsValue() < dealer.getTotalCardsValue())
            return dealer;
        else
            return null;
    }
    
    public Dealer getDealer() {
        return dealer;
      }

     public Player getPlayer() {
        return player;
      }
    
     public void run() {
    	    // Setup the game table
    	    GameTableFrame gameTableFrame = new GameTableFrame(dealer, player);

    	    // Starts the game!
    	    boolean carryOn = true;

    	    while (carryOn) {
    	        runOneRound();
    	        gameTableFrame.updateScreen();

    	        if (!gc.getPlayerQuitStatus()) {
    	            int response = JOptionPane.showConfirmDialog(
    	                    gameTableFrame,
    	                    "Do you want to play another game?",
    	                    "New Game",
    	                    JOptionPane.YES_NO_OPTION
    	            );

    	            carryOn = response == JOptionPane.YES_OPTION;
    	        } else {
    	            carryOn = false;
    	        }
    	    }
    	    this.view.displayPlayerNameAndLeftOverChips(this.player);
    	    this.view.displayExitGame();
    	    gameTableFrame.dispose();
    	}


    public void runOneRound() {
        this.view.displayGameTitle();
        this.view.displayDoubleLine();
        this.view.displayPlayerNameAndChips(this.player);
        this.view.displaySingleLine();
        this.view.displayGameStart();
        this.view.displaySingleLine();
        this.dealer.shuffleCards();
        this.chipsOnTable = 0;
        boolean playerQuit = false;

        for (int round = 1; round <= 4; round++) {
            // Code remains same until here

            // Check if the player wants to follow or quit
            char r;
            int chipsToBet;
            if (round == 1) {
                chipsToBet = this.view.getPlayerCallBetChip(this.player);
            } else {
                chipsToBet = this.view.getDealerCallBetChips();
            }
        }
        Player winner = checkWinner();
        if(playerQuit){
            this.view.displayPlayerNameAndLeftOverChips(this.player);
            this.view.displayPlayerQuit();
        }
    }

  /*  public static void main(String[] args) {
        LoginDialog loginDialog = new LoginDialog(null);
        loginDialog.setVisible(true);

        if (loginDialog.isLoggedIn()) {
            String login = loginDialog.getLogin();
            String password = loginDialog.getPassword();

            HighSum highSum = new HighSum();
            highSum.init(login, password);
            highSum.run();
        }
    }*/
}




package Model;
import java.util.*;

public class Player extends User{

	private int chips;
	protected ArrayList<Card> cardsOnHand;
	
	public Player(String loginName, String password, int chips) {
		super(loginName, password);
		this.chips = chips;
		this.cardsOnHand = new ArrayList<Card>();
	}
	
	public int getChips() {
		return this.chips;
	}
	
	public void addChips(int amount) {
		this.chips+=amount;//no error check
	}
	
	public void deductChips(int amount) {
		this.chips-=amount;//no error check
	}

	public void addCard(Card card) {
		this.cardsOnHand.add(card);
	}
	
	public ArrayList<Card> getCardsOnHand() {
		return this.cardsOnHand;
	}
	
	
	public int getTotalCardsValue() {
		int total = 0;
		for(Card card: this.cardsOnHand) {
			total+=card.getValue();
		}
		return total;
	}
	
	
	public Card getLastCard() {
		return this.cardsOnHand.get(this.cardsOnHand.size()-1);
	}
	
	public void clearCardsOnHand() {
		this.cardsOnHand.clear();
	}
	
	//Think of the action that a player can take
	//implement more related methods here
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Player player = new Player("IcePeak","A",100);
		System.out.println(player.getChips());
		player.deductChips(10);
		System.out.println(player.getChips());
		player.addChips(20);
		System.out.println(player.getChips());
	}
}
package Model;
import Helper.*;

abstract public class User {

	private String loginName;
	private String hashPassword;
	
	public User(String loginName, String password) {
		this.loginName = loginName;
		this.hashPassword = Utility.getHash(password);
	}

	public String getLoginName() {
		return this.loginName;
	}
	
	public boolean checkPassword(String password) {
		return this.hashPassword.equals(Utility.getHash(password));
	}
}
package View;

import Helper.*;
import Model.*;

//all input and output should be done view ViewController
//so that it is easier to implement GUI later
public class ViewController {

	public void displayExitGame() {
		System.out.println("Thank you for playing HighSum game");
	}
	
	
	public void displayBetOntable(int bet) {
		System.out.println("Bet on table : "+bet);
	}
	
	public void displayPlayerWin(Player player) {
		System.out.println(player.getLoginName()+" Wins!");
	}
	
	public void displayDealerWin() {
		System.out.println("Dealer Wins!");
	}
	
	public void displayTie() {
		System.out.println("It is a tie!.");
	}
	
	public void displayPlayerQuit() {
		System.out.println("You have quit the current game.");
	}
	
	public void displayPlayerCardsOnHand(Player player) {
	    System.out.println(player.getLoginName());

	    if(player instanceof Dealer) {
	        for (int i = 0; i < player.getCardsOnHand().size(); i++) {
	            if (i == 0) {
	                System.out.print("<HIDDEN CARD> ");
	            } else {
	                System.out.print(player.getCardsOnHand().get(i).toString() + " ");
	            }
	        }
	    } else {
	        for (Card card : player.getCardsOnHand()) {
	            System.out.print(card + " ");
	        }
	    }
	    System.out.println();
	}
	
	public void displayBlankLine() {
		System.out.println();
	}
	
	public void displayPlayerTotalCardValue(Player player) {
		System.out.println("Value:"+player.getTotalCardsValue());
	}
	
	public void displayDealerDealCardsAndGameRound(int round) {
		System.out.println("Dealer dealing cards - ROUND "+round);
	}
	
	public void displayGameStart() {
		System.out.println("Game starts - Dealer shuffle deck");
	}
	
	public void displayPlayerNameAndChips(Player player) {
		System.out.println(player.getLoginName()+", You have "+player.getChips()+" chips");
	}
	
	public void displayPlayerNameAndLeftOverChips(Player player) {
		System.out.println(player.getLoginName()+", You are left with "+player.getChips()+" chips");
	}
	
	public void displayGameTitle() {
		System.out.println("HighSum GAME");
	}
	
	public void displaySingleLine() {
		for(int i=0;i<30;i++) {
			System.out.print("-");
		}
		System.out.println();
	}
	
	public void displayDoubleLine() {
		for(int i=0;i<30;i++) {
			System.out.print("=");
		}
		System.out.println();
	}
	
	
	public char getPlayerCallOrQuit() {
		char[] choices = {'c','q'};
		char r = Keyboard.readChar("Do you want to [c]all or [q]uit?:",choices);
		return r;
	}
	
	public char getPlayerFollowOrNot(Player player, int dealerBet) {
		
		boolean validChoice = false;
		char[] choices = {'y','n'};
		
		char r = 'n';
		while(!validChoice) {
			r = Keyboard.readChar("Do you want to follow?",choices);
			//check if player has enff chips to follow
			if(r=='y' && player.getChips()<dealerBet) {
				System.out.println("You do not have enough chips to follow");
				displayPlayerNameAndChips(player);
			}else {
				validChoice = true;
			}
		}
		return r;
	}
	
	public char getPlayerNextGame() {
		char[] choices = {'y','n'};
		char r = Keyboard.readChar("Next game?",choices);
		return r;
	}
	
	public int getPlayerCallBetChip(Player player) {
		boolean validBetAmount = false;
		int chipsToBet = 0;
		while(!validBetAmount) {
			chipsToBet = Keyboard.readInt("Player call, state bet:");
			if(chipsToBet<0) {
				System.out.println("Chips cannot be negative");
			}else if(chipsToBet>player.getChips()) {
				System.out.println("You do not have enough chips");
			}else {
				validBetAmount = true;
			}
		}
		return chipsToBet;
	}
	
	public int getDealerCallBetChips() {
		System.out.println("Dealer call, state bet: 10");
		return 10;
	}
	
	
}
"

These are the requirements: 
"On completion of this assignment a student should be able to write a Java application
that:
• Makes use of Java API "Swing" and "AWT" packages
• Handles generated events
• Makes use of layout manager to organize the GUI components
• Know how to apply and design a program using object-oriented concepts
2. Task
Enhance the one player Java game application "HighSum" done in Assignment 1 with Graphical User Interface (GUI).
2.1 Login
The game starts by the player logging into the game.
2.2 Play Game
The game starts after the player click on “Login”.
First, the dealer will shuffles the deck.
(You may include animation in this frame to simulate “shuffle” effect as enhancement.)
Then the dealer deals two cards from the top of the deck to the player and itself.
Since the player’s last card is higher than the dealer’s last card, the player gets to Call the game.
Assume the player states 10 as the bet chips.
The player’s chip will be deducted by 10.
The chips on table will be updated to 20 and the dealer deals cards for next round.
Assume the dealer’s last card is higher than the player’s last card.
The dealer Call the game and the player gets to choose to Follow or Quit the game.
If the player follows the game, 10 chips will be deducted from the player’s balance chips.
(Asumme the dealer place 10 chips.)
The games carry on for maximum of four rounds.
In the last round, the player with the highest total sum wins the game.
And the game continues until the player exits the game.
Error Handling
Your program should be able to handle error situations like where a player enter wrong password or has insufficient chips.
You should look out for other possible exceptions and handle them too."
Edit the code so that when highsum gui is run, 
The game runs on the GUI and NOT on the console. The gui currently is empty and blank and cannot be closed when run.