diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..a536f7e --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1648646964120 + + + + + + \ No newline at end of file diff --git a/Schack.iml b/Schack.iml new file mode 100644 index 0000000..fb8e866 --- /dev/null +++ b/Schack.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar b/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar new file mode 100644 index 0000000..60e8e2b Binary files /dev/null and b/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar differ diff --git a/lib/flatlaf-2.1.jar b/lib/flatlaf-2.1.jar new file mode 100644 index 0000000..bf7da70 Binary files /dev/null and b/lib/flatlaf-2.1.jar differ diff --git a/lib/flatlaf-extras-2.1.jar b/lib/flatlaf-extras-2.1.jar new file mode 100644 index 0000000..904428d Binary files /dev/null and b/lib/flatlaf-extras-2.1.jar differ diff --git a/lib/flatlaf-intellij-themes-2.1.jar b/lib/flatlaf-intellij-themes-2.1.jar new file mode 100644 index 0000000..28caa51 Binary files /dev/null and b/lib/flatlaf-intellij-themes-2.1.jar differ diff --git a/lib/nblibraries.properties b/lib/nblibraries.properties new file mode 100644 index 0000000..b5bd56c --- /dev/null +++ b/lib/nblibraries.properties @@ -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 diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties index e62ef03..e2a1f03 100644 --- a/nbproject/genfiles.properties +++ b/nbproject/genfiles.properties @@ -1,6 +1,6 @@ -build.xml.data.CRC32=ab896e8c +build.xml.data.CRC32=8c4b7f48 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. # 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 diff --git a/nbproject/project.properties b/nbproject/project.properties index 8958ed4..dec7de7 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -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.usedProfile=project 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.excludes=**/*.java,**/*.form # 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 endorsed.classpath= 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=** jar.archive.disabled=${jnlp.enabled} jar.compress=false 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 javac.compilerargs= javac.deprecation=false diff --git a/nbproject/project.xml b/nbproject/project.xml index fd47071..810ba06 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -11,5 +11,8 @@ + + .\lib\nblibraries.properties + diff --git a/src/schack/Schack.java b/src/schack/Schack.java index da87d08..7817d0f 100644 --- a/src/schack/Schack.java +++ b/src/schack/Schack.java @@ -1,5 +1,6 @@ package schack; +import com.formdev.flatlaf.FlatLightLaf; import java.awt.event.ActionEvent; import java.io.IOException; import java.net.InetAddress; @@ -15,24 +16,31 @@ import javax.swing.UIManager; * * @author Love Billenius & Simon Hansson */ -public class Schack extends JFrame{ +public class Schack { public Schack() throws IOException { - setTitle("Schack"); - setAlwaysOnTop(false); - setResizable(false); - Board board = new Board(); - setContentPane(board); - getContentPane().addMouseListener(board); - - // Set theme try { - UIManager.setLookAndFeel( - UIManager.getSystemLookAndFeelClassName()); - } catch (Exception e) { +// FlatSolarizedLightIJTheme.setup(); + FlatLightLaf.setup(); + 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 JMenuBar menuBar = new JMenuBar(); JMenu gameMenu = new JMenu("Game"); @@ -49,9 +57,9 @@ public class Schack extends JFrame{ showLocalIP.addActionListener((ActionEvent ae) -> { try { String localIp = InetAddress.getLocalHost().toString(); - JOptionPane.showMessageDialog(this, "Local IP: " + localIp); + JOptionPane.showMessageDialog(frame, "Local IP: " + localIp); } catch (UnknownHostException ex) { - JOptionPane.showMessageDialog(this, "Could not get local IP"); + JOptionPane.showMessageDialog(frame, "Could not get local IP"); } }); askForRemi.addActionListener((ActionEvent ae) -> { @@ -62,25 +70,22 @@ public class Schack extends JFrame{ }); // Add the menu stuff - setJMenuBar(menuBar); + frame.setJMenuBar(menuBar); menuBar.add(gameMenu); menuBar.add(connectMenu); connectMenu.add(connectToOpponent); connectMenu.add(showLocalIP); gameMenu.add(askForRemi); gameMenu.add(surrender); - pack(); - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - setVisible(true); - + frame.pack(); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setVisible(true); } public static void main(String[] args) throws IOException { new Schack(); - +new Schack(); } - - }