Board=JPanel, Schack=JFrame

This commit is contained in:
lov3b 2022-03-01 18:39:24 +01:00
parent a66a3e625a
commit 2bb09a0f94
7 changed files with 134 additions and 149 deletions

View File

@ -6,19 +6,19 @@
For the purpose of easier reading the script
is divided into following sections:
- initialization
- compilation
- jar
- execution
- debugging
- javadoc
- test compilation
- test execution
- test debugging
- applet
- cleanup
- initialization
- compilation
- jar
- execution
- debugging
- javadoc
- test compilation
- test execution
- test debugging
- applet
- cleanup
-->
-->
<project xmlns:if="ant:if" xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" xmlns:unless="ant:unless" basedir=".." default="default" name="Schack-impl">
<fail message="Please build using Ant 1.8.0 or higher.">
<condition>

View File

@ -1,9 +1,18 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processor.options=
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.title=Schack
application.vendor=love
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs=true
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width=4
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab=4
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=8
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=80
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
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
@ -30,6 +39,7 @@ dist.archive.excludes=
dist.dir=dist
dist.jar=${dist.dir}/Schack.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
includes=**
jar.compress=false
@ -54,6 +64,7 @@ javac.test.processorpath=\
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.html5=false
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
@ -62,6 +73,8 @@ javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
jlink.launcher=false
jlink.launcher.name=Schack
main.class=schack.Schack
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF

View File

@ -5,31 +5,17 @@ import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.util.ArrayList;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class Board extends JFrame
{
public class Board extends JPanel {
ArrayList<Piece> pieces = new ArrayList<>();
public Board()
{
setTitle("Schack");
setAlwaysOnTop(true);
setResizable(false);
setContentPane(cp);
cp.setPreferredSize(new Dimension(800, 800) );
pack();
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
public Board() {
setPreferredSize(new Dimension(800, 800));
}
JPanel cp = new JPanel()
{
public void paintComponent(Graphics g)
{
public void paintComponent(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
g2.scale(100, 100);
@ -48,14 +34,4 @@ public class Board extends JFrame
}
}
}
};
// for(Piece p : pieces){
// p.draw();
// }
public static void main(String[] args)
{
new Board();
}
}

View File

@ -9,8 +9,8 @@ package schack;
*
* @author lovbil251
*/
public interface DiagonalWalk
{
public interface DiagonalWalk {
public void walDiagonal();
}

View File

@ -1,6 +1,8 @@
package schack;
public final class King extends Piece{
public final class King extends Piece {
public boolean isSeen(){return true;}
public boolean isSeen() {
return true;
}
}

View File

@ -4,13 +4,14 @@ import java.awt.Point;
import java.util.ArrayList;
public class Piece {
public Point position;
public boolean isValidMove(Point p, ArrayList<Piece> pieces) {
return true;
}
public boolean isValidMove(Point p, ArrayList<Piece> pieces){return true;}
void draw()
{
void draw() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

View File

@ -1,35 +1,28 @@
package schack;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JFrame;
/**
*
* @author Love Billenius & Simon Hansson
*/
public class Schack extends JFrame
{
public class Schack extends JFrame {
public Dimension size = new Dimension(800, 800);
public Schack()
{
setSize(size);
public Schack() {
setTitle("Schack");
setAlwaysOnTop(true);
setBackground(Color.black);
setResizable(false);
setContentPane(new Board());
pack();
setVisible(true);
}
private void drawSquares(Graphics g){
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[] args)
{
public static void main(String[] args) {
new Schack();
}