Added nice theme

This commit is contained in:
loveb 2022-03-30 15:53:00 +02:00
parent f4b18d9a78
commit 0bc66164f5
11 changed files with 103 additions and 25 deletions

47
.idea/workspace.xml Normal file
View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="3016dc8e-42de-49f3-b975-2eb86e73f414" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/nbproject/genfiles.properties" beforeDir="false" afterPath="$PROJECT_DIR$/nbproject/genfiles.properties" afterDir="false" />
<change beforePath="$PROJECT_DIR$/nbproject/project.properties" beforeDir="false" afterPath="$PROJECT_DIR$/nbproject/project.properties" afterDir="false" />
<change beforePath="$PROJECT_DIR$/nbproject/project.xml" beforeDir="false" afterPath="$PROJECT_DIR$/nbproject/project.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/schack/Schack.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/schack/Schack.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="MarkdownSettingsMigration">
<option name="stateVersion" value="1" />
</component>
<component name="ProjectId" id="276iVuFCCxRiuS6y4h05wbCRVls" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="3016dc8e-42de-49f3-b975-2eb86e73f414" name="Changes" comment="" />
<created>1648646964120</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1648646964120</updated>
<workItem from="1648646965594" duration="195000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
</project>

12
Schack.iml Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="lib" level="project" />
</component>
</module>

BIN
lib/flatlaf-2.1.jar Normal file

Binary file not shown.

BIN
lib/flatlaf-extras-2.1.jar Normal file

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,4 @@
libs.CopyLibs.classpath=\
${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
libs.CopyLibs.displayName=CopyLibs Task
libs.CopyLibs.prop-version=3.0

View File

@ -1,6 +1,6 @@
build.xml.data.CRC32=ab896e8c build.xml.data.CRC32=8c4b7f48
build.xml.script.CRC32=3becf7c5 build.xml.script.CRC32=3becf7c5
build.xml.stylesheet.CRC32=f85dc8f2@1.101.0.48 build.xml.stylesheet.CRC32=f85dc8f2@1.102.0.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=ab896e8c nbproject/build-impl.xml.data.CRC32=ab896e8c

View File

@ -13,6 +13,7 @@ auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap=none auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap=none
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=project auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=project
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.enable-indent=true auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.enable-indent=true
auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml
build.classes.dir=${build.dir}/classes build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned: # This directory is removed when the project is cleaned:
@ -41,11 +42,17 @@ dist.jar=${dist.dir}/Schack.jar
dist.javadoc.dir=${dist.dir}/javadoc dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath= endorsed.classpath=
excludes= excludes=
file.reference.flatlaf-2.1.jar=lib\\flatlaf-2.1.jar
file.reference.flatlaf-extras-2.1.jar=lib\\flatlaf-extras-2.1.jar
file.reference.flatlaf-intellij-themes-2.1.jar=lib\\flatlaf-intellij-themes-2.1.jar
includes=** includes=**
jar.archive.disabled=${jnlp.enabled} jar.archive.disabled=${jnlp.enabled}
jar.compress=false jar.compress=false
jar.index=${jnlp.enabled} jar.index=${jnlp.enabled}
javac.classpath= javac.classpath=\
${file.reference.flatlaf-2.1.jar}:\
${file.reference.flatlaf-intellij-themes-2.1.jar}:\
${file.reference.flatlaf-extras-2.1.jar}
# Space-separated list of extra javac options # Space-separated list of extra javac options
javac.compilerargs= javac.compilerargs=
javac.deprecation=false javac.deprecation=false

View File

@ -11,5 +11,8 @@
<root id="test.src.dir"/> <root id="test.src.dir"/>
</test-roots> </test-roots>
</data> </data>
<libraries xmlns="http://www.netbeans.org/ns/ant-project-libraries/1">
<definitions>.\lib\nblibraries.properties</definitions>
</libraries>
</configuration> </configuration>
</project> </project>

View File

@ -1,5 +1,6 @@
package schack; package schack;
import com.formdev.flatlaf.FlatLightLaf;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.io.IOException; import java.io.IOException;
import java.net.InetAddress; import java.net.InetAddress;
@ -15,23 +16,30 @@ import javax.swing.UIManager;
* *
* @author Love Billenius & Simon Hansson * @author Love Billenius & Simon Hansson
*/ */
public class Schack extends JFrame{ public class Schack {
public Schack() throws IOException { public Schack() throws IOException {
setTitle("Schack");
setAlwaysOnTop(false);
setResizable(false);
Board board = new Board();
setContentPane(board);
getContentPane().addMouseListener(board);
// Set theme // Set theme
try { try {
UIManager.setLookAndFeel( // FlatSolarizedLightIJTheme.setup();
UIManager.getSystemLookAndFeelClassName()); FlatLightLaf.setup();
} catch (Exception e) { System.setProperty("flatlaf.menuBarEmbedded", "true");
} catch (Exception cantThemeWithFlatLaf) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception cantThemeWithSystemLAF) {
} }
}
JFrame frame = new JFrame();
frame.setTitle("Schack");
frame.setAlwaysOnTop(false);
frame.setResizable(false);
// Might throw an IOException if the icon of the Pieces isn't embedded correctly
Board board = new Board();
frame.setContentPane(board);
frame.getContentPane().addMouseListener(board);
// Create menu // Create menu
JMenuBar menuBar = new JMenuBar(); JMenuBar menuBar = new JMenuBar();
@ -49,9 +57,9 @@ public class Schack extends JFrame{
showLocalIP.addActionListener((ActionEvent ae) -> { showLocalIP.addActionListener((ActionEvent ae) -> {
try { try {
String localIp = InetAddress.getLocalHost().toString(); String localIp = InetAddress.getLocalHost().toString();
JOptionPane.showMessageDialog(this, "Local IP: " + localIp); JOptionPane.showMessageDialog(frame, "Local IP: " + localIp);
} catch (UnknownHostException ex) { } catch (UnknownHostException ex) {
JOptionPane.showMessageDialog(this, "Could not get local IP"); JOptionPane.showMessageDialog(frame, "Could not get local IP");
} }
}); });
askForRemi.addActionListener((ActionEvent ae) -> { askForRemi.addActionListener((ActionEvent ae) -> {
@ -62,25 +70,22 @@ public class Schack extends JFrame{
}); });
// Add the menu stuff // Add the menu stuff
setJMenuBar(menuBar); frame.setJMenuBar(menuBar);
menuBar.add(gameMenu); menuBar.add(gameMenu);
menuBar.add(connectMenu); menuBar.add(connectMenu);
connectMenu.add(connectToOpponent); connectMenu.add(connectToOpponent);
connectMenu.add(showLocalIP); connectMenu.add(showLocalIP);
gameMenu.add(askForRemi); gameMenu.add(askForRemi);
gameMenu.add(surrender); gameMenu.add(surrender);
pack(); frame.pack();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true); frame.setVisible(true);
} }
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
new Schack(); new Schack();
new Schack();
} }
} }