Class Interface

java.lang.Object
  extended by Interface

public class Interface
extends java.lang.Object

This class represents the interface of this 304 cards game. User output and input operations are handled in this class. This class doesn't have any game logics or any other network operational funcationlities included.


Nested Class Summary
 class Interface.Listener
          This Listener class extends WindowAdaptor and implements ActionListener.
 
Field Summary
(package private)  javax.swing.JLabel bg_lbl
           
(package private)  javax.swing.JButton[] card_btns
           
(package private)  javax.swing.JButton enter_game_btn
           
private  javax.swing.JPanel game_pnl
           
(package private)  javax.swing.JLabel game_status_first_line_lbl
           
(package private)  javax.swing.JLabel game_status_second_line_lbl
           
private  javax.swing.JFrame jframe
           
private  javax.swing.JPanel jpanel
           
private  Interface.Listener listener
           
(package private)  javax.swing.JLabel name_lbl
           
(package private)  javax.swing.JTextField name_txtfld
           
private  Player player
           
private  java.lang.String RESOURCE_IMAGES_PATH
           
(package private)  javax.swing.JButton select_trump_btn
           
(package private)  javax.swing.JButton serve_rest_btn
           
(package private)  javax.swing.JButton[] table_btns
           
(package private)  javax.swing.JLabel[] table_lbl
           
private  javax.swing.JPanel welcome_pnl
           
private  int WIN_HEIGHT
           
private  int WIN_WIDTH
           
private  int WIN_X
           
private  int WIN_Y
           
 
Constructor Summary
Interface(Player player)
          Constructor method of this Interface class.
 
Method Summary
 void clearTrump()
          ClearTrump method is to clear the image in the trump table button and show.
 void close()
          This method is to close the window
private  void create_game_pnl()
          This method is to create game panel user interface.
private  void create_welcome_pnl()
          This method creates the JPanel of welcome screen.
 void hideButtons()
          This method is to hide bet buttons.
 void initialize()
          This method initilizes the user interface with all the swing components.
 void setAllHandCardsEnabled(java.lang.Boolean state)
          This method set all the hand cards enabled or disabled depends on the state boolean.
 void setFirstLine(java.lang.String firstLine)
          This method set the message on the game window header.
 javax.swing.JButton setHandCard(javax.swing.JButton btn, Card card)
          This method sets an image to a hand betton and returns it.
 void setHandCardsEnabled(java.lang.Boolean state, int from, int to)
          This method set the Hand cards enabled or disabled in a range.
 void setInitialHandCards(java.util.ArrayList<Card> cards)
          This method sets initially first four card in the hands Other four cards out of eight will be blank.
 void setSecondLine(java.lang.String secondLine)
          This method set the message on the game window header.
 javax.swing.JButton setTableCard(javax.swing.JButton btn, Card card)
          This method is to set card image to a table button
 void setTableCards(Card[] cards)
          This method is to set the cards to the table from cards array.
 void setTableLabel(int lblNo, java.lang.String lbl)
          Sets the table lable.
 void setTheRestHandCards(java.util.ArrayList<Card> cards)
          This method sets rest four card in the hands
 void setTrumpEnabled(boolean state)
          This method is to enable and disable the trump card table button.
 void showButtons()
          This method is to show the bet buttons.
 void showgamepnl()
          This method is to show the game panel
 java.lang.String showinputmsg(java.lang.String msg)
          This method is to show a input box with a message and to get some input.
 void showmsg(java.lang.String msg)
          This method is to show a message to a user.
 void updateHand(java.lang.Boolean[] hand)
          This method updates the visibility state of a hand button by checking the hand Boolean array.
 void updateTable(java.lang.Boolean[] table)
          This method updates the visibility state of a table button by checking the table Boolean array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

player

private Player player

RESOURCE_IMAGES_PATH

private final java.lang.String RESOURCE_IMAGES_PATH
See Also:
Constant Field Values

WIN_WIDTH

private final int WIN_WIDTH
See Also:
Constant Field Values

WIN_HEIGHT

private final int WIN_HEIGHT
See Also:
Constant Field Values

WIN_X

private final int WIN_X
See Also:
Constant Field Values

WIN_Y

private final int WIN_Y
See Also:
Constant Field Values

listener

private Interface.Listener listener

jframe

private javax.swing.JFrame jframe

jpanel

private javax.swing.JPanel jpanel

welcome_pnl

private javax.swing.JPanel welcome_pnl

game_pnl

private javax.swing.JPanel game_pnl

bg_lbl

javax.swing.JLabel bg_lbl

name_lbl

javax.swing.JLabel name_lbl

name_txtfld

javax.swing.JTextField name_txtfld

enter_game_btn

javax.swing.JButton enter_game_btn

game_status_first_line_lbl

javax.swing.JLabel game_status_first_line_lbl

game_status_second_line_lbl

javax.swing.JLabel game_status_second_line_lbl

table_lbl

javax.swing.JLabel[] table_lbl

select_trump_btn

javax.swing.JButton select_trump_btn

serve_rest_btn

javax.swing.JButton serve_rest_btn

table_btns

javax.swing.JButton[] table_btns

card_btns

javax.swing.JButton[] card_btns
Constructor Detail

Interface

public Interface(Player player)
Constructor method of this Interface class.

Parameters:
player - Player object
Method Detail

initialize

public void initialize()
This method initilizes the user interface with all the swing components. And this method creates the welcome panel by calling the create_welcome_pnl method.


create_welcome_pnl

private void create_welcome_pnl()
This method creates the JPanel of welcome screen.


create_game_pnl

private void create_game_pnl()
This method is to create game panel user interface.


showinputmsg

public java.lang.String showinputmsg(java.lang.String msg)
This method is to show a input box with a message and to get some input.

Parameters:
msg - String message to be shown.
Returns:
String input from the user.

showmsg

public void showmsg(java.lang.String msg)
This method is to show a message to a user.

Parameters:
msg - String to show the user.

setTableCard

public javax.swing.JButton setTableCard(javax.swing.JButton btn,
                                        Card card)
This method is to set card image to a table button


setTrumpEnabled

public void setTrumpEnabled(boolean state)
This method is to enable and disable the trump card table button.


setTableCards

public void setTableCards(Card[] cards)
This method is to set the cards to the table from cards array.

Parameters:
Card[] - cards array to be set in table.

clearTrump

public void clearTrump()
ClearTrump method is to clear the image in the trump table button and show.


setHandCard

public javax.swing.JButton setHandCard(javax.swing.JButton btn,
                                       Card card)
This method sets an image to a hand betton and returns it.


setInitialHandCards

public void setInitialHandCards(java.util.ArrayList<Card> cards)
This method sets initially first four card in the hands Other four cards out of eight will be blank.

Parameters:
cards - ArrayList of the 8 cards.

setTheRestHandCards

public void setTheRestHandCards(java.util.ArrayList<Card> cards)
This method sets rest four card in the hands

Parameters:
cards - ArrayList of the 8 cards.

setAllHandCardsEnabled

public void setAllHandCardsEnabled(java.lang.Boolean state)
This method set all the hand cards enabled or disabled depends on the state boolean.

Parameters:
state - Boolean of Enabled state.

setHandCardsEnabled

public void setHandCardsEnabled(java.lang.Boolean state,
                                int from,
                                int to)
This method set the Hand cards enabled or disabled in a range.

Parameters:
state - Boolean to enable or disable a hand card button.
from - int starting position of a card button to enable or disable.
to - int ending position of a card button to enable or disable.

updateHand

public void updateHand(java.lang.Boolean[] hand)
This method updates the visibility state of a hand button by checking the hand Boolean array.

Parameters:
hand - boolean array.

updateTable

public void updateTable(java.lang.Boolean[] table)
This method updates the visibility state of a table button by checking the table Boolean array.

Parameters:
table - boolean array.

setFirstLine

public void setFirstLine(java.lang.String firstLine)
This method set the message on the game window header.

Parameters:
firstLine - String message to set in the header first line.

setSecondLine

public void setSecondLine(java.lang.String secondLine)
This method set the message on the game window header.

Parameters:
secondLine - String message to set in the header second line.

setTableLabel

public void setTableLabel(int lblNo,
                          java.lang.String lbl)
Sets the table lable.

Parameters:
lblNo - int index of a table button.
lbl - String table button label text.

hideButtons

public void hideButtons()
This method is to hide bet buttons.


showButtons

public void showButtons()
This method is to show the bet buttons.


showgamepnl

public void showgamepnl()
This method is to show the game panel


close

public void close()
This method is to close the window