Search in sources :

Example 1 with Command

use of mage.client.util.Command in project mage by magefree.

the class ChoiceDialog method getJButtonCancel.

/**
 * This method initializes jButtonCancel
 *
 * @return javax.swing.JButton
 */
private HoverButton getJButtonCancel() {
    if (jButtonCancel == null) {
        jButtonCancel = new HoverButton("", ImageManagerImpl.instance.getDlgCancelButtonImage(), ImageManagerImpl.instance.getDlgActiveCancelButtonImage(), ImageManagerImpl.instance.getDlgCancelButtonImage(), new Rectangle(60, 60));
        int w = getDlgParams().rect.width - 75;
        int h = getDlgParams().rect.height - 90;
        jButtonCancel.setBounds(new Rectangle(w / 2 + 150, h - 50, 60, 60));
        jButtonCancel.setToolTipText("Cancel");
        jButtonCancel.setVisible(isOptional);
        if (!isCancelStopsPlaying) {
            jButtonCancel.setToolTipText("Done (enough)");
            jButtonCancel.setBounds(new Rectangle(w / 2 + 150, h - 50, 60, 60));
        }
        jButtonCancel.setObserver(new Command() {

            private static final long serialVersionUID = -567322540616089486L;

            public void execute() {
                DialogManager.getManager(gameId).fadeOut((DialogContainer) getParent());
            /*
                    try {
                        ConnectionManager.sendAddChosenCard(null);
                    } catch (RemoteException re) {
                        re.printStackTrace();
                    }
                    */
            }
        });
    }
    return jButtonCancel;
}
Also used : Command(mage.client.util.Command) HoverButton(mage.client.components.HoverButton) DialogContainer(mage.client.components.ext.dlg.DialogContainer)

Example 2 with Command

use of mage.client.util.Command in project mage by magefree.

the class ChoiceDialog method getJButtonNextPage.

/**
 * This method initializes jButtonNextPage
 *
 * @return javax.swing.JButton
 */
private HoverButton getJButtonNextPage() {
    if (jButtonNextPage == null) {
        jButtonNextPage = new HoverButton("", ImageManagerImpl.instance.getDlgNextButtonImage(), ImageManagerImpl.instance.getDlgActiveNextButtonImage(), ImageManagerImpl.instance.getDlgNextButtonImage(), new Rectangle(60, 60));
        int w = getDlgParams().rect.width - 75;
        int h = getDlgParams().rect.height - 90;
        jButtonNextPage.setBounds(new Rectangle(w / 2 + 45, h - 50, 60, 60));
        jButtonNextPage.setVisible(maxPages > 1);
        jButtonNextPage.setObserver(new Command() {

            private static final long serialVersionUID = -3174360416099554104L;

            public void execute() {
                if (page == maxPages) {
                    return;
                }
                AudioManager.playNextPage();
                page++;
                getJButtonPrevPage().setVisible(false);
                getJButtonOK().setVisible(false);
                getJButtonNextPage().setVisible(false);
                revalidate();
                displayCards(params.getCards(), params.gameId, params.bigCard);
                getJButtonPrevPage().setVisible(true);
                getJButtonOK().setVisible(true);
                if (page != maxPages) {
                    getJButtonNextPage().setVisible(true);
                }
            }
        });
    }
    return jButtonNextPage;
}
Also used : Command(mage.client.util.Command) HoverButton(mage.client.components.HoverButton)

Aggregations

HoverButton (mage.client.components.HoverButton)2 Command (mage.client.util.Command)2 DialogContainer (mage.client.components.ext.dlg.DialogContainer)1