|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.MenuComponent java.awt.MenuItem java.awt.Menu java.awt.PopupMenu soc.client.SOCHandPanel.ResourceTradePopupMenu soc.client.SOCHandPanel.ResourceTradeTypeMenu
static class SOCHandPanel.ResourceTradeTypeMenu
Menu for right-click on resource square to trade one resource type with bank/port.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.awt.PopupMenu |
---|
java.awt.PopupMenu.AccessibleAWTPopupMenu |
Nested classes/interfaces inherited from class java.awt.Menu |
---|
java.awt.Menu.AccessibleAWTMenu |
Nested classes/interfaces inherited from class java.awt.MenuItem |
---|
java.awt.MenuItem.AccessibleAWTMenuItem |
Nested classes/interfaces inherited from class java.awt.MenuComponent |
---|
java.awt.MenuComponent.AccessibleAWTMenuComponent |
Field Summary | |
---|---|
private int |
costFrom
|
(package private) boolean |
isForThree1
|
private ColorSquare |
resSq
|
private int |
resTypeFrom
|
private SOCHandPanel.ResourceTradeMenuItem[] |
tradeForItems
|
Fields inherited from class soc.client.SOCHandPanel.ResourceTradePopupMenu |
---|
hpan |
Constructor Summary | |
---|---|
SOCHandPanel.ResourceTradeTypeMenu(SOCHandPanel hp,
int typeFrom,
boolean forThree1)
One-time-use menu for board popup menu. |
|
SOCHandPanel.ResourceTradeTypeMenu(SOCHandPanel hp,
int typeFrom,
ColorSquare sq,
int numFrom)
Menu attached to a resource colorsquare in the client player's handpanel |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Handling the menu item |
void |
destroy()
Cleanup, for removing this menu. |
int |
getResourceCost()
|
int |
getResourceType()
|
private void |
init(int typeFrom,
SOCGame ga,
ColorSquare sq,
int numFrom,
boolean forThree1)
Common to both constructors |
void |
mouseClicked(java.awt.event.MouseEvent evt)
Handle popup-click on resource colorsquare. |
void |
mouseEntered(java.awt.event.MouseEvent evt)
Stub required for MouseListener |
void |
mouseExited(java.awt.event.MouseEvent evt)
Stub required for MouseListener |
void |
mousePressed(java.awt.event.MouseEvent evt)
Handle popup-click on resource colorsquare. |
void |
mouseReleased(java.awt.event.MouseEvent evt)
Handle popup-click on resource colorsquare. |
void |
setEnabledIfCanTrade(boolean itemsOnly)
Enable or disable based on gamestate and player's resources. |
void |
show(int x,
int y)
Show menu at this position. |
void |
updateCost(int newCost)
Update cost of trade; update menu item text. |
Methods inherited from class java.awt.PopupMenu |
---|
addNotify, getAccessibleContext, getParent, show |
Methods inherited from class java.awt.Menu |
---|
add, add, addSeparator, countItems, getItem, getItemCount, insert, insert, insertSeparator, isTearOff, paramString, remove, remove, removeAll, removeNotify |
Methods inherited from class java.awt.MenuItem |
---|
addActionListener, deleteShortcut, disable, disableEvents, enable, enable, enableEvents, getActionCommand, getActionListeners, getLabel, getListeners, getShortcut, isEnabled, processActionEvent, processEvent, removeActionListener, setActionCommand, setEnabled, setLabel, setShortcut |
Methods inherited from class java.awt.MenuComponent |
---|
dispatchEvent, getFont, getName, getPeer, getTreeLock, postEvent, setFont, setName, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.awt.MenuContainer |
---|
getFont, postEvent |
Field Detail |
---|
private ColorSquare resSq
private int resTypeFrom
private int costFrom
boolean isForThree1
private SOCHandPanel.ResourceTradeMenuItem[] tradeForItems
Constructor Detail |
---|
public SOCHandPanel.ResourceTradeTypeMenu(SOCHandPanel hp, int typeFrom, ColorSquare sq, int numFrom)
public SOCHandPanel.ResourceTradeTypeMenu(SOCHandPanel hp, int typeFrom, boolean forThree1) throws java.lang.IllegalStateException
hp
- Handpanel with player's information (including trade costs)typeFrom
- Resource type from which to tradeforThree1
- Is part of a 3-for-1 port trade menu, with all resource types
java.lang.IllegalStateException
- If client not current playerMethod Detail |
---|
private void init(int typeFrom, SOCGame ga, ColorSquare sq, int numFrom, boolean forThree1)
public void show(int x, int y)
show
in class SOCHandPanel.ResourceTradePopupMenu
x
- Mouse x-position relative to colorsquarey
- Mouse y-position relative to colorsquareSOCHandPanel.ResourceTradePopupMenu.setEnabledIfCanTrade(boolean)
public void setEnabledIfCanTrade(boolean itemsOnly)
setEnabledIfCanTrade
in class SOCHandPanel.ResourceTradePopupMenu
itemsOnly
- If true, enable/disable items, instead of the menu itself.public void updateCost(int newCost)
public int getResourceType()
public int getResourceCost()
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
public void mousePressed(java.awt.event.MouseEvent evt)
mousePressed
in interface java.awt.event.MouseListener
public void mouseClicked(java.awt.event.MouseEvent evt)
mouseClicked
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent evt)
mouseReleased
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent evt)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent evt)
mouseExited
in interface java.awt.event.MouseListener
public void destroy()
destroy
in class SOCHandPanel.ResourceTradePopupMenu
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |