mirror of
				https://github.com/lov3b/Schack.git
				synced 2025-11-03 22:50:24 +01:00 
			
		
		
		
	Board=JPanel, Schack=JFrame
This commit is contained in:
		@@ -1,9 +1,18 @@
 | 
				
			|||||||
annotation.processing.enabled=true
 | 
					annotation.processing.enabled=true
 | 
				
			||||||
annotation.processing.enabled.in.editor=false
 | 
					annotation.processing.enabled.in.editor=false
 | 
				
			||||||
annotation.processing.processor.options=
 | 
					 | 
				
			||||||
annotation.processing.processors.list=
 | 
					annotation.processing.processors.list=
 | 
				
			||||||
annotation.processing.run.all.processors=true
 | 
					annotation.processing.run.all.processors=true
 | 
				
			||||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
 | 
					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.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:
 | 
				
			||||||
@@ -30,6 +39,7 @@ dist.archive.excludes=
 | 
				
			|||||||
dist.dir=dist
 | 
					dist.dir=dist
 | 
				
			||||||
dist.jar=${dist.dir}/Schack.jar
 | 
					dist.jar=${dist.dir}/Schack.jar
 | 
				
			||||||
dist.javadoc.dir=${dist.dir}/javadoc
 | 
					dist.javadoc.dir=${dist.dir}/javadoc
 | 
				
			||||||
 | 
					endorsed.classpath=
 | 
				
			||||||
excludes=
 | 
					excludes=
 | 
				
			||||||
includes=**
 | 
					includes=**
 | 
				
			||||||
jar.compress=false
 | 
					jar.compress=false
 | 
				
			||||||
@@ -54,6 +64,7 @@ javac.test.processorpath=\
 | 
				
			|||||||
javadoc.additionalparam=
 | 
					javadoc.additionalparam=
 | 
				
			||||||
javadoc.author=false
 | 
					javadoc.author=false
 | 
				
			||||||
javadoc.encoding=${source.encoding}
 | 
					javadoc.encoding=${source.encoding}
 | 
				
			||||||
 | 
					javadoc.html5=false
 | 
				
			||||||
javadoc.noindex=false
 | 
					javadoc.noindex=false
 | 
				
			||||||
javadoc.nonavbar=false
 | 
					javadoc.nonavbar=false
 | 
				
			||||||
javadoc.notree=false
 | 
					javadoc.notree=false
 | 
				
			||||||
@@ -62,6 +73,8 @@ javadoc.splitindex=true
 | 
				
			|||||||
javadoc.use=true
 | 
					javadoc.use=true
 | 
				
			||||||
javadoc.version=false
 | 
					javadoc.version=false
 | 
				
			||||||
javadoc.windowtitle=
 | 
					javadoc.windowtitle=
 | 
				
			||||||
 | 
					jlink.launcher=false
 | 
				
			||||||
 | 
					jlink.launcher.name=Schack
 | 
				
			||||||
main.class=schack.Schack
 | 
					main.class=schack.Schack
 | 
				
			||||||
manifest.file=manifest.mf
 | 
					manifest.file=manifest.mf
 | 
				
			||||||
meta.inf.dir=${src.dir}/META-INF
 | 
					meta.inf.dir=${src.dir}/META-INF
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,31 +5,17 @@ import java.awt.Dimension;
 | 
				
			|||||||
import java.awt.Graphics;
 | 
					import java.awt.Graphics;
 | 
				
			||||||
import java.awt.Graphics2D;
 | 
					import java.awt.Graphics2D;
 | 
				
			||||||
import java.util.ArrayList;
 | 
					import java.util.ArrayList;
 | 
				
			||||||
import javax.swing.JFrame;
 | 
					 | 
				
			||||||
import javax.swing.JPanel;
 | 
					import javax.swing.JPanel;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class Board extends JFrame
 | 
					public class Board extends JPanel {
 | 
				
			||||||
{
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ArrayList<Piece> pieces = new ArrayList<>();
 | 
					    ArrayList<Piece> pieces = new ArrayList<>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public Board()
 | 
					    public Board() {
 | 
				
			||||||
    {
 | 
					        setPreferredSize(new Dimension(800, 800));
 | 
				
			||||||
        setTitle("Schack");
 | 
					 | 
				
			||||||
        setAlwaysOnTop(true);
 | 
					 | 
				
			||||||
        setResizable(false);
 | 
					 | 
				
			||||||
        setContentPane(cp);
 | 
					 | 
				
			||||||
        cp.setPreferredSize(new Dimension(800, 800) );
 | 
					 | 
				
			||||||
        pack();
 | 
					 | 
				
			||||||
        setVisible(true);
 | 
					 | 
				
			||||||
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    JPanel cp = new JPanel()
 | 
					    public void paintComponent(Graphics g) {
 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        public void paintComponent(Graphics g)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
        Graphics2D g2 = (Graphics2D) g;
 | 
					        Graphics2D g2 = (Graphics2D) g;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        g2.scale(100, 100);
 | 
					        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();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,8 +9,8 @@ package schack;
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @author lovbil251
 | 
					 * @author lovbil251
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
public interface DiagonalWalk
 | 
					public interface DiagonalWalk {
 | 
				
			||||||
{
 | 
					
 | 
				
			||||||
    public void walDiagonal();
 | 
					    public void walDiagonal();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,5 +2,7 @@ package schack;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public final class King extends Piece {
 | 
					public final class King extends Piece {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public boolean isSeen(){return true;}
 | 
					    public boolean isSeen() {
 | 
				
			||||||
 | 
					        return true;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,13 +4,14 @@ import java.awt.Point;
 | 
				
			|||||||
import java.util.ArrayList;
 | 
					import java.util.ArrayList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class Piece {
 | 
					public class Piece {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public Point position;
 | 
					    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.
 | 
					        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,35 +1,28 @@
 | 
				
			|||||||
package schack;
 | 
					package schack;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.awt.Color;
 | 
					 | 
				
			||||||
import java.awt.Dimension;
 | 
					import java.awt.Dimension;
 | 
				
			||||||
import java.awt.Graphics;
 | 
					 | 
				
			||||||
import java.awt.Graphics2D;
 | 
					 | 
				
			||||||
import javax.swing.JFrame;
 | 
					import javax.swing.JFrame;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @author Love Billenius & Simon Hansson
 | 
					 * @author Love Billenius & Simon Hansson
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
public class Schack extends JFrame
 | 
					public class Schack extends JFrame {
 | 
				
			||||||
{
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public Dimension size = new Dimension(800, 800);
 | 
					    public Dimension size = new Dimension(800, 800);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public Schack()
 | 
					    public Schack() {
 | 
				
			||||||
    {
 | 
					        setTitle("Schack");
 | 
				
			||||||
        setSize(size);
 | 
					 | 
				
			||||||
        setAlwaysOnTop(true);
 | 
					        setAlwaysOnTop(true);
 | 
				
			||||||
        setBackground(Color.black);
 | 
					        setResizable(false);
 | 
				
			||||||
 | 
					        setContentPane(new Board());
 | 
				
			||||||
 | 
					        pack();
 | 
				
			||||||
        setVisible(true);
 | 
					        setVisible(true);
 | 
				
			||||||
    }
 | 
					        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    private void drawSquares(Graphics g){
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static void main(String[] args)
 | 
					    public static void main(String[] args) {
 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        new Schack();
 | 
					        new Schack();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user