|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectInterface
public class Interface
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 |
---|
private Player player
private final java.lang.String RESOURCE_IMAGES_PATH
private final int WIN_WIDTH
private final int WIN_HEIGHT
private final int WIN_X
private final int WIN_Y
private Interface.Listener listener
private javax.swing.JFrame jframe
private javax.swing.JPanel jpanel
private javax.swing.JPanel welcome_pnl
private javax.swing.JPanel game_pnl
javax.swing.JLabel bg_lbl
javax.swing.JLabel name_lbl
javax.swing.JTextField name_txtfld
javax.swing.JButton enter_game_btn
javax.swing.JLabel game_status_first_line_lbl
javax.swing.JLabel game_status_second_line_lbl
javax.swing.JLabel[] table_lbl
javax.swing.JButton select_trump_btn
javax.swing.JButton serve_rest_btn
javax.swing.JButton[] table_btns
javax.swing.JButton[] card_btns
Constructor Detail |
---|
public Interface(Player player)
player
- Player objectMethod Detail |
---|
public void initialize()
private void create_welcome_pnl()
private void create_game_pnl()
public java.lang.String showinputmsg(java.lang.String msg)
msg
- String message to be shown.
public void showmsg(java.lang.String msg)
msg
- String to show the user.public javax.swing.JButton setTableCard(javax.swing.JButton btn, Card card)
public void setTrumpEnabled(boolean state)
public void setTableCards(Card[] cards)
Card[]
- cards array to be set in table.public void clearTrump()
public javax.swing.JButton setHandCard(javax.swing.JButton btn, Card card)
public void setInitialHandCards(java.util.ArrayList<Card> cards)
cards
- ArrayList of the 8 cards.public void setTheRestHandCards(java.util.ArrayList<Card> cards)
cards
- ArrayList of the 8 cards.public void setAllHandCardsEnabled(java.lang.Boolean state)
state
- Boolean of Enabled state.public void setHandCardsEnabled(java.lang.Boolean state, int from, int to)
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.public void updateHand(java.lang.Boolean[] hand)
hand
- boolean array.public void updateTable(java.lang.Boolean[] table)
table
- boolean array.public void setFirstLine(java.lang.String firstLine)
firstLine
- String message to set in the header first line.public void setSecondLine(java.lang.String secondLine)
secondLine
- String message to set in the header second line.public void setTableLabel(int lblNo, java.lang.String lbl)
lblNo
- int index of a table button.lbl
- String table button label text.public void hideButtons()
public void showButtons()
public void showgamepnl()
public void close()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |