- created a custom button for usage in the ButtonRow
This commit is contained in:
parent
2d6a7f8dce
commit
e9aa132d3f
1 changed files with 57 additions and 0 deletions
57
src/de/itsblue/ConnectFour/PlateInsertButton.java
Normal file
57
src/de/itsblue/ConnectFour/PlateInsertButton.java
Normal file
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
Connect four - written in java
|
||||
Copyright (C) 2020 Oliver Schappacher and Dorian Zedler
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.itsblue.ConnectFour;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* PlateInsertButton is a class mean for use with
|
||||
* de.itsblue.ConnectFour.ButtonRow. It is a simple button with the extra
|
||||
* property "index" which is used to store its index in the button row.
|
||||
*
|
||||
* @author Dorian Zedler
|
||||
*/
|
||||
class PlateInsertButton extends JButton {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* The index of the button in a ButtonRow
|
||||
*/
|
||||
private int index;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param index The index of the button in the ButtonRow
|
||||
*/
|
||||
PlateInsertButton(int index) {
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to get the index of the button
|
||||
*/
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
}
|
Reference in a new issue