public CardDragSourceListener(GuiCard comp) { this(comp, DnDConstants.ACTION_COPY_OR_MOVE); this.comp = comp; this.dragIcon = new ImageIcon(CardManager.getInstance().getCard(comp.getCard())); }
public TurnPanel(DurakActionListener actionListener) { this.setPreferredSize(new Dimension(WIDTH, HEIGHT)); this.setMinimumSize(new Dimension(WIDTH, HEIGHT)); this.setBackground(Colors.DARK_GREEN); this.setLayout(new GridBagLayout()); int activeRow = 0; this.btnNextMove.addActionListener(actionListener); this.btnNextMove.setActionCommand("" + DurakActionListener.ACTION_NEXT_MOVE); this.btnNextMove.setIcon(CardManager.getImageIcon("images/icons/hourglass.png")); this.btnEndTurn.addActionListener(actionListener); this.btnEndTurn.setActionCommand("" + DurakActionListener.ACTION_END_TURN); this.btnEndTurn.setIcon(CardManager.getImageIcon("images/icons/flag_green.png")); this.chkAutoReply.addActionListener(actionListener); this.chkAutoReply.setActionCommand("" + DurakActionListener.ACTION_UPDATE_DISPLAY); this.chkAutoReply.setRolloverEnabled(false); this.chkAutoReply.setContentAreaFilled(false); this.grpSortBy.add(this.radSortBySuit); this.grpSortBy.add(this.radSortByNumber); this.radSortBySuit.addActionListener(actionListener); this.radSortByNumber.addActionListener(actionListener); this.radSortByNumber.setActionCommand("" + DurakActionListener.ACTION_UPDATE_HAND_PANEL); this.radSortBySuit.setActionCommand("" + DurakActionListener.ACTION_UPDATE_HAND_PANEL); this.radSortBySuit.setOpaque(false); this.radSortByNumber.setOpaque(false); JPanel pnlSortBy = new JPanel(new GridBagLayout()); pnlSortBy.setBackground(Colors.LIGHT_GREEN); pnlSortBy.setBorder( BorderFactory.createTitledBorder( new LineBorder(Colors.NORMAL_GREEN, 1), "sort cards by: ")); pnlSortBy.add( this.radSortBySuit, new GridBagConstraints( 0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 2, 0, 2), 2, 2)); pnlSortBy.add( this.radSortByNumber, new GridBagConstraints( 0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 0, 2), 2, 2)); this.add( this.chkAutoReply, new GridBagConstraints( 0, activeRow++, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); this.add( pnlSortBy, new GridBagConstraints( 0, activeRow++, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); this.add( this.btnNextMove, new GridBagConstraints( 0, activeRow++, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); this.add( this.btnEndTurn, new GridBagConstraints( 0, activeRow++, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); this.setVisible(true); }