package views; import javax.swing.*; import javax.swing.border.LineBorder; import java.awt.*; import static views.Constants.*; import static views.Constants.CARD_HEIGHT; public class CardButton extends JButton { final int UNSELECTED_THICKNESS=1; final int SELECTED_THICKNESS=4; public CardButton(String text) { this.setText(text); this.setBorder(new LineBorder(UNSELECTED_COLOR, UNSELECTED_THICKNESS, true)); this.setPreferredSize(new Dimension(CARD_WIDTH, CARD_HEIGHT)); this.setFont(new Font("MS ゴシック", Font.BOLD, 14)); } //選択状態の切り替え public void setEnabledSelection(boolean enabledSelection){ if(enabledSelection){ this.setBorder(new LineBorder(SELECTED_COLOR, SELECTED_THICKNESS,true)); }else { this.setBorder(new LineBorder(UNSELECTED_COLOR, UNSELECTED_THICKNESS, true)); } } }