Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle update #12

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
language: java
jdk:
- oraclejdk8
- openjdk8
- oraclejdk11
- openjdk11
25 changes: 14 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
plugins {
id "java"
id "application"
id "wrapper"

id 'com.github.sherter.google-java-format' version '0.3.2'
id 'com.github.sherter.google-java-format' version '0.9'
}

sourceCompatibility = 11
targetCompatibility = 11

wrapper {
gradleVersion "5.0"
gradleVersion "7.0"
}

mainClassName = "free.jin.JinApplication"
Expand All @@ -16,20 +20,19 @@ repositories {
}

dependencies {
compile "org.jdesktop:appframework:1.0.3"
compile "org.swinglabs:swing-layout:1.0.3"
compile "org.beanshell:bsh:2.0b5"
compile "org.reflections:reflections:0.9.12"
compile "com.google.guava:guava:30.1.1-jre"
compile "org.lwjgl.lwjgl:lwjgl:2.9.3"
compile "org.lwjgl.lwjgl:lwjgl_util:2.9.1"
implementation "org.jdesktop:appframework:1.0.3"
implementation "org.swinglabs:swing-layout:1.0.3"
implementation "org.beanshell:bsh:2.0b5"
implementation "org.reflections:reflections:0.9.12"
implementation "com.google.guava:guava:30.1.1-jre"
implementation "org.lwjgl.lwjgl:lwjgl:2.9.3"
implementation "org.lwjgl.lwjgl:lwjgl_util:2.9.1"
}

// If Java formatter checks fail, tell the user how to fix them.
task printFormatHelperMessage {
doLast {
throw new FileNotFoundException('google-java-format is required.\n' +
'Use ./gradlew googleJavaFormat to reformat the broken files')
throw new FileNotFoundException('google-java-format is required.\nUse ./gradlew googleJavaFormat to reformat the broken files')
}
}
verifyGoogleJavaFormat.finalizedBy printFormatHelperMessage
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
27 changes: 13 additions & 14 deletions release/applet/DetectJava.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,37 @@
* Jin - a chess client for internet chess servers. More information is available at
* http://www.jinchess.com/. Copyright (C) 2004 Alexander Maryanovsky. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* <p>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 2 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.
* <p>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
* <p>You should have received a copy of the GNU General Public License along with this program; if
* not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
import java.applet.Applet;
import java.net.URL;
import java.net.MalformedURLException;
import java.net.URL;

/**
* A small applet which redirects to a different page based on the version of Java in which it is
* run. The applet takes 3 parameters:
*
* <ul>
* <li>minRequiredJavaVersion - the minimum required version of Java.
* <li>goodJavaURL - the URL to redirect to if the version of Java is equal to or higher than
* minRequiredJavaVersion.
* <li>badJavaURL - The URL to redirect to the if the version of Java is lower than
* minRequiredJavaVersion.
* <li>minRequiredJavaVersion - the minimum required version of Java.
* <li>goodJavaURL - the URL to redirect to if the version of Java is equal to or higher than
* minRequiredJavaVersion.
* <li>badJavaURL - The URL to redirect to the if the version of Java is lower than
* minRequiredJavaVersion.
* </ul>
*/
public class DetectJava extends Applet {

/**
* Invokes </code>getAppletContext().showDocument()</code> on the appropriate URL.
*/
/** Invokes </code>getAppletContext().showDocument()</code> on the appropriate URL. */
public void start() {
String minRequiredJavaVersion = getParameter("minRequiredJavaVersion");
String javaVersion = System.getProperty("java.version");
Expand Down
84 changes: 27 additions & 57 deletions src/main/java/free/chess/AbstractChessClock.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,38 @@
* The chess framework library. More information is available at http://www.jinchess.com/. Copyright
* (C) 2002 Alexander Maryanovsky. All rights reserved.
*
* The chess framework library is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software Foundation;
* <p>The chess framework library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free Software Foundation;
* either version 2 of the License, or (at your option) any later version.
*
* The chess framework library is distributed in the hope that it will be useful, but WITHOUT ANY
* <p>The chess framework library 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with the chess
* <p>You should have received a copy of the GNU Lesser General Public License along with the chess
* framework library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite
* 330, Boston, MA 02111-1307 USA
*/
package free.chess;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JComponent;
import javax.swing.Timer;

/**
* The abstract superclass of all components who display a chess clock (one part of it).
*/
/** The abstract superclass of all components who display a chess clock (one part of it). */
public abstract class AbstractChessClock extends JComponent {

/**
* The code for the mode where only hours and minutes are displayed.
*/
/** The code for the mode where only hours and minutes are displayed. */
public static final int HOUR_MINUTE_DISPLAY_MODE = 0;

/**
* The code for the mode where minutes and seconds are displayed.
*/
/** The code for the mode where minutes and seconds are displayed. */
public static final int MINUTE_SECOND_DISPLAY_MODE = 1;

/**
* The code for the mode where minutes, seconds and second tenths are displayed.
*/
/** The code for the mode where minutes, seconds and second tenths are displayed. */
public static final int SECOND_TENTHS_DISPLAY_MODE = 2;

/**
* The code for the mode where the actual display depends on the current time.
*/
/** The code for the mode where the actual display depends on the current time. */
public static final int TIME_DEPENDENT_DISPLAY_MODE = 3;

/**
Expand All @@ -55,20 +44,18 @@ public abstract class AbstractChessClock extends JComponent {
private int time;

/**
* The threshold of time under which the clock displays second tenths, when in
* <code>TIME_DEPENDENT_DISPLAY_MODE</code> mode.
* The threshold of time under which the clock displays second tenths, when in <code>
* TIME_DEPENDENT_DISPLAY_MODE</code> mode.
*/
private int secondTenthsThreshold = 10 * 1000;

/**
* The threshold of time under which the clock displays minutes and seconds, when in
* <code>TIME_DEPENDENT_DISPLAY_MODE</code> mode.
* The threshold of time under which the clock displays minutes and seconds, when in <code>
* TIME_DEPENDENT_DISPLAY_MODE</code> mode.
*/
private int minutesSecondsThreshold = 20 * 60 * 1000;

/**
* The repaint timer.
*/
/** The repaint timer. */
private final Timer repaintTimer =
new Timer(
100,
Expand All @@ -91,9 +78,7 @@ public void actionPerformed(ActionEvent evt) {
*/
private int displayMode = TIME_DEPENDENT_DISPLAY_MODE;

/**
* Is the clock currently active (the current turn belongs to the owner of this clock).
*/
/** Is the clock currently active (the current turn belongs to the owner of this clock). */
private boolean isActive = false;

/**
Expand All @@ -104,33 +89,25 @@ public AbstractChessClock(int time) {
this.time = time;
}

/**
* Sets the time displayed by this clock, in milliseconds.
*/
/** Sets the time displayed by this clock, in milliseconds. */
public void setTime(int time) {
this.time = time;
if (isRunning()) runStart = System.currentTimeMillis();
repaint();
}

/**
* Returns the time displayed by this clock, in milliseconds.
*/
/** Returns the time displayed by this clock, in milliseconds. */
public int getTime() {
if (isRunning()) return time - (int) (System.currentTimeMillis() - runStart);
else return time;
}

/**
* Returns whether the clock is running.
*/
/** Returns whether the clock is running. */
public boolean isRunning() {
return runStart >= 0;
}

/**
* Sets the clock's running status.
*/
/** Sets the clock's running status. */
public void setRunning(boolean isRunning) {
if (isRunning == isRunning()) return;

Expand All @@ -155,16 +132,12 @@ public void setTimeDependentDisplayModeThresholds(int minutesSeconds, int second
repaint();
}

/**
* Sets the delay between repaints of the clock when it is running, in milliseconds.
*/
/** Sets the delay between repaints of the clock when it is running, in milliseconds. */
public void setRepaintDelay(int delay) {
repaintTimer.setDelay(delay);
}

/**
* Returns the delay between repaints of the clock when it is running, in milliseconds.
*/
/** Returns the delay between repaints of the clock when it is running, in milliseconds. */
public int getRepaintDelay() {
return repaintTimer.getDelay();
}
Expand All @@ -190,18 +163,17 @@ public void setDisplayMode(int displayMode) {
}

/**
* Returns the current display mode of the clock. Possible values are
* {@link #HOUR_MINUTE_DISPLAY_MODE}, {@link #MINUTE_SECOND_DISPLAY_MODE},
* {@link #SECOND_TENTHS_DISPLAY_MODE} and {@link #TIME_DEPENDENT_DISPLAY_MODE}.
* Returns the current display mode of the clock. Possible values are {@link
* #HOUR_MINUTE_DISPLAY_MODE}, {@link #MINUTE_SECOND_DISPLAY_MODE}, {@link
* #SECOND_TENTHS_DISPLAY_MODE} and {@link #TIME_DEPENDENT_DISPLAY_MODE}.
*/
public int getDisplayMode() {
return displayMode;
}

/**
* Returns the actual display mode. If the display mode is
* <code>TIME_DEPENDENT_DISPLAY_MODE</code>, returns one of the other display modes based on the
* current time.
* Returns the actual display mode. If the display mode is <code>TIME_DEPENDENT_DISPLAY_MODE
* </code>, returns one of the other display modes based on the current time.
*/
protected int getActualDisplayMode() {
int displayMode = getDisplayMode();
Expand All @@ -222,9 +194,7 @@ public void setActive(boolean isActive) {
repaint();
}

/**
* Returns whether this clock is active.
*/
/** Returns whether this clock is active. */
public boolean isActive() {
return isActive;
}
Expand Down
36 changes: 11 additions & 25 deletions src/main/java/free/chess/AbstractColoredBoardPainter.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,29 @@
* The chess framework library. More information is available at http://www.jinchess.com/. Copyright
* (C) 2002 Alexander Maryanovsky. All rights reserved.
*
* The chess framework library is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software Foundation;
* <p>The chess framework library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free Software Foundation;
* either version 2 of the License, or (at your option) any later version.
*
* The chess framework library is distributed in the hope that it will be useful, but WITHOUT ANY
* <p>The chess framework library 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with the chess
* <p>You should have received a copy of the GNU Lesser General Public License along with the chess
* framework library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite
* 330, Boston, MA 02111-1307 USA
*/
package free.chess;

import java.awt.Color;

/**
* A skeleton implementation of <code>ColoredBoardPainter</code>.
*/
/** A skeleton implementation of <code>ColoredBoardPainter</code>. */
public abstract class AbstractColoredBoardPainter implements ColoredBoardPainter {

/**
* The color of the light squares.
*/
/** The color of the light squares. */
private Color lightColor;

/**
* The color of the dark squares.
*/
/** The color of the dark squares. */
private Color darkColor;

/**
Expand All @@ -53,35 +47,27 @@ public AbstractColoredBoardPainter() {
this(Color.white.darker(), Color.black.brighter());
}

/**
* Returns the color with which light squares are drawn.
*/
/** Returns the color with which light squares are drawn. */
@Override
public Color getLightColor() {
return lightColor;
}

/**
* Sets the color with which light squares are drawn;
*/
/** Sets the color with which light squares are drawn; */
@Override
public void setLightColor(Color lightColor) {
if (lightColor == null) throw new IllegalArgumentException("Null color");

this.lightColor = lightColor;
}

/**
* Returns the color with which dark squares are drawn.
*/
/** Returns the color with which dark squares are drawn. */
@Override
public Color getDarkColor() {
return darkColor;
}

/**
* Sets the color with which dark squares are drawn;
*/
/** Sets the color with which dark squares are drawn; */
@Override
public void setDarkColor(Color darkColor) {
if (darkColor == null) throw new IllegalArgumentException("Null color");
Expand Down
Loading