added stuff
@@ -1,31 +0,0 @@
|
||||
public void saveAgenda(File file) {
|
||||
try {
|
||||
FileOutputStream fos = new FileOutputStream(file);
|
||||
ObjectOutputStream oos = new ObjectOutputStream(fos);
|
||||
oos.writeObject(this);
|
||||
oos.close();
|
||||
JOptionPane.showMessageDialog(null, "Saved succesfully");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void fillAgenda(File file) {
|
||||
FileInputStream fis = null;
|
||||
ObjectInputStream ois = null;
|
||||
try {
|
||||
|
||||
fis = new FileInputStream(file);
|
||||
ois = new ObjectInputStream(fis);
|
||||
|
||||
Object object;
|
||||
object = ois.readObject();
|
||||
Agenda a = (Agenda) object;
|
||||
events = a.getEvents();
|
||||
stages = a.getStages();
|
||||
artists = a.getArtists();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,218 @@
|
||||
package Agenda;
|
||||
import java.io.EOFException;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
|
||||
public class Agenda implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1;
|
||||
|
||||
private ArrayList<Stage> stages;
|
||||
private ArrayList<Event> events;
|
||||
private ArrayList<Artist> artists;
|
||||
|
||||
public Agenda() {
|
||||
stages = new ArrayList<Stage>();
|
||||
events = new ArrayList<Event>();
|
||||
artists = new ArrayList<Artist>();
|
||||
}
|
||||
|
||||
public void addStage(Stage stage){
|
||||
stages.add(stage);
|
||||
}
|
||||
|
||||
public void addEvent(Event event) {
|
||||
events.add(event);
|
||||
}
|
||||
|
||||
public void addArtist(Artist artist) {
|
||||
artists.add(artist);
|
||||
}
|
||||
|
||||
public ArrayList<Event> getEvents()
|
||||
{
|
||||
return events;
|
||||
}
|
||||
public ArrayList<Artist> getArtists()
|
||||
{
|
||||
return artists;
|
||||
}
|
||||
public ArrayList<Stage> getStages()
|
||||
{
|
||||
return stages;
|
||||
}
|
||||
|
||||
public void saveAgenda()
|
||||
{
|
||||
JFileChooser fileChooser = new JFileChooser();
|
||||
|
||||
fileChooser.setFileFilter(new FileFilter() {
|
||||
@Override
|
||||
public boolean accept(File pathname) {
|
||||
if(pathname.isFile() && pathname.getName().endsWith(".agn"))
|
||||
{
|
||||
return true;
|
||||
}else if(pathname.isDirectory()){return true;}else{return false;}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return ".agn";
|
||||
}
|
||||
|
||||
});
|
||||
fileChooser.setDialogTitle("Choose save location");
|
||||
int userSelection = fileChooser.showSaveDialog(null);
|
||||
|
||||
if(userSelection == JFileChooser.APPROVE_OPTION)
|
||||
{
|
||||
File file = fileChooser.getSelectedFile();
|
||||
if(!file.getName().endsWith(".agn"))
|
||||
{
|
||||
file = new File(file.getAbsolutePath() + ".agn");
|
||||
}
|
||||
|
||||
if(file.exists())
|
||||
{
|
||||
if(JOptionPane.showConfirmDialog(null, "Are you sure you want to overwrite: " + file.getName(), "Overwrite", JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION)
|
||||
{
|
||||
saveAgenda(file);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
saveAgenda(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void loadAgenda()
|
||||
{
|
||||
JFileChooser fileChooser = new JFileChooser();
|
||||
fileChooser.setFileFilter(new FileFilter() {
|
||||
@Override
|
||||
public boolean accept(File pathname) {
|
||||
if(pathname.isFile() && pathname.getName().endsWith(".agn"))
|
||||
{
|
||||
return true;
|
||||
}else if(pathname.isDirectory()){return true;}else{return false;}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return ".agn";
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
fileChooser.setDialogTitle("Choose file");
|
||||
int userSelection = fileChooser.showOpenDialog(null);
|
||||
|
||||
if(userSelection == JFileChooser.APPROVE_OPTION)
|
||||
{
|
||||
File file = fileChooser.getSelectedFile();
|
||||
if(!file.exists())
|
||||
{
|
||||
JOptionPane.showMessageDialog(null, "This file does not exist: " + file.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
clearAgenda();
|
||||
fillAgenda(file);
|
||||
JOptionPane.showMessageDialog(null, "Loaded succesfully");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void fillAgenda(File file) {
|
||||
FileInputStream fis = null;
|
||||
ObjectInputStream ois = null;
|
||||
try {
|
||||
|
||||
fis = new FileInputStream(file);
|
||||
ois = new ObjectInputStream(fis);
|
||||
|
||||
Object object;
|
||||
object = ois.readObject();
|
||||
Agenda a = (Agenda) object;
|
||||
events = a.getEvents();
|
||||
stages = a.getStages();
|
||||
artists = a.getArtists();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void fillArtists()
|
||||
{
|
||||
for (Event e : events)
|
||||
{
|
||||
boolean exists = false;
|
||||
String name = e.getArtist().getName();
|
||||
for (Artist a : artists)
|
||||
{
|
||||
if ( a.getName().equals(name) ) {
|
||||
exists = true;
|
||||
}
|
||||
}
|
||||
if ( exists == false) {
|
||||
addArtist(e.getArtist());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void fillStages()
|
||||
{
|
||||
for (Event e : events)
|
||||
{
|
||||
boolean exists = false;
|
||||
String name = e.getStage().getName();
|
||||
for (Stage s : stages)
|
||||
{
|
||||
if ( s.getName().equals(name) ) {
|
||||
exists = true;
|
||||
}
|
||||
}
|
||||
if ( exists == false) {
|
||||
addStage(e.getStage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void saveAgenda(File file) {
|
||||
try {
|
||||
FileOutputStream fos = new FileOutputStream(file);
|
||||
ObjectOutputStream oos = new ObjectOutputStream(fos);
|
||||
oos.writeObject(this);
|
||||
oos.close();
|
||||
JOptionPane.showMessageDialog(null, "Saved succesfully");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void clearAgenda()
|
||||
{
|
||||
events.clear();
|
||||
stages.clear();
|
||||
artists.clear();
|
||||
}
|
||||
|
||||
public void fillAllLists()
|
||||
{
|
||||
loadAgenda();
|
||||
fillStages();
|
||||
fillArtists();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package Agenda;
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
|
||||
public class Artist implements Serializable{
|
||||
|
||||
private static final long serialVersionUID = 1;
|
||||
|
||||
private String name;
|
||||
private String genre;
|
||||
private ImageIcon image;
|
||||
private String description;
|
||||
private String background;
|
||||
|
||||
public Artist(String name, String genre, String image, String description, String background)
|
||||
{
|
||||
this.name = name;
|
||||
this.genre = genre;
|
||||
this.description = description;
|
||||
this.background = background;
|
||||
|
||||
if ( !image.equals("null")) {
|
||||
this.image = new ImageIcon(image);
|
||||
}
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getGenre()
|
||||
{
|
||||
return this.genre;
|
||||
}
|
||||
|
||||
public ImageIcon getImage()
|
||||
{
|
||||
return this.image;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public String getBackground()
|
||||
{
|
||||
return this.background;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setGenre(String genre)
|
||||
{
|
||||
this.genre = genre;
|
||||
}
|
||||
|
||||
public void setImageIconString(String image)
|
||||
{
|
||||
this.image = new ImageIcon(image);
|
||||
}
|
||||
|
||||
public void setImageIcon(ImageIcon image)
|
||||
{
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setBackground(String background)
|
||||
{
|
||||
this.background = background;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
package Agenda;
|
||||
import java.io.Serializable;
|
||||
import java.text.DateFormat;
|
||||
import java.text.Format;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
public class Event implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1;
|
||||
|
||||
private String eventName;
|
||||
private GregorianCalendar startDate;
|
||||
private GregorianCalendar endDate;
|
||||
private Artist artist;
|
||||
private Stage stage;
|
||||
private String description;
|
||||
private int expectedPopularity;
|
||||
|
||||
public Event(String eventName, int startYear, int startMonth, int startDay,
|
||||
int startHour, int startMinute, int endYear, int endMonth,
|
||||
int endDay, int endHour, int endMinute, Artist artist, Stage stage,
|
||||
String description, int expectedPopularity) {
|
||||
this.eventName = eventName;
|
||||
this.startDate = new GregorianCalendar(startYear, startMonth - 1,
|
||||
startDay, startHour, startMinute);
|
||||
this.endDate = new GregorianCalendar(endYear, endMonth - 1, endDay,
|
||||
endHour, endMinute);
|
||||
this.stage = stage;
|
||||
this.artist = artist;
|
||||
this.description = description;
|
||||
this.expectedPopularity = expectedPopularity;
|
||||
}
|
||||
|
||||
public Event(String eventName, GregorianCalendar startDate,
|
||||
GregorianCalendar endDate, Artist artist, Stage stage,
|
||||
String description, int expectedPopularity) {
|
||||
this.eventName = eventName;
|
||||
this.startDate = startDate;
|
||||
this.endDate = endDate;
|
||||
this.artist = artist;
|
||||
this.stage = stage;
|
||||
this.description = description;
|
||||
this.expectedPopularity = expectedPopularity;
|
||||
}
|
||||
|
||||
public String getEventName() {
|
||||
return this.eventName;
|
||||
}
|
||||
|
||||
public GregorianCalendar getStartDate() {
|
||||
return this.startDate;
|
||||
}
|
||||
|
||||
public GregorianCalendar getEndDate() {
|
||||
return this.endDate;
|
||||
}
|
||||
|
||||
public Artist getArtist() {
|
||||
return this.artist;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public Stage getStage() {
|
||||
return this.stage;
|
||||
}
|
||||
|
||||
public int getExpectedPopularity() {
|
||||
return this.expectedPopularity;
|
||||
}
|
||||
|
||||
public void setEventName(String name) {
|
||||
this.eventName = name;
|
||||
}
|
||||
|
||||
public void setStartDate(int startYear, int startMonth, int startDay,
|
||||
int startHour, int startMinute) {
|
||||
startDate.set(startYear, startMonth - 1, startDay, startHour,
|
||||
startMinute);
|
||||
}
|
||||
|
||||
public void setStartDate(GregorianCalendar startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public void setEndDate(int endYear, int endMonth, int endDay, int endHour,
|
||||
int endMinute) {
|
||||
endDate.set(endYear, endMonth - 1, endDay, endHour, endMinute);
|
||||
}
|
||||
|
||||
public void setEndDate(GregorianCalendar endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public void setArtist(Artist artist) {
|
||||
this.artist.setName(artist.getName());
|
||||
this.artist.setGenre(artist.getGenre());
|
||||
this.artist.setImageIcon(artist.getImage());
|
||||
this.artist.setDescription(artist.getDescription());
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setExpectedPopularity(int popularity) {
|
||||
this.expectedPopularity = popularity;
|
||||
}
|
||||
|
||||
public void setStage(Stage stage) {
|
||||
this.stage = stage;
|
||||
}
|
||||
|
||||
public int getLength()
|
||||
{
|
||||
return getEndTime() - getStartTime();
|
||||
}
|
||||
|
||||
public int getStartTime()
|
||||
{
|
||||
DateFormat format = new SimpleDateFormat("kkmm");
|
||||
format.setLenient(false);
|
||||
// System.out.println(format.format(startDate.getTime()));
|
||||
|
||||
// System.out.println(date.get(Calendar.HOUR_OF_DAY));
|
||||
int time = Integer.valueOf(format.format(startDate.getTime()));
|
||||
int hours = time/100;
|
||||
int minutes = time%100;
|
||||
int finaltime;
|
||||
if(minutes != 0)
|
||||
{
|
||||
finaltime = hours*60 + minutes;
|
||||
}
|
||||
else
|
||||
{
|
||||
finaltime = hours*60;
|
||||
}
|
||||
return finaltime;
|
||||
}
|
||||
|
||||
public int getEndTime()
|
||||
{
|
||||
DateFormat format = new SimpleDateFormat("kkmm");
|
||||
format.setLenient(false);
|
||||
// System.out.println(format.format(endDate.getTime()));
|
||||
int time = Integer.valueOf(format.format(endDate.getTime()));
|
||||
int hours = time/100;
|
||||
int minutes = time%100;
|
||||
int finaltime;
|
||||
if(minutes != 0)
|
||||
{
|
||||
finaltime = hours*60 + minutes;
|
||||
}
|
||||
else
|
||||
{
|
||||
finaltime = hours*60;
|
||||
}
|
||||
|
||||
return finaltime;
|
||||
}
|
||||
|
||||
public void setStartTime(int hours, int minutes)
|
||||
{
|
||||
// System.out.println("Start:" + hours + ":" + minutes);
|
||||
startDate.set(Calendar.HOUR_OF_DAY, hours);
|
||||
startDate.set(Calendar.MINUTE, minutes);
|
||||
// System.out.println(startDate.getTime());
|
||||
}
|
||||
|
||||
public void setEndTime(int hours, int minutes)
|
||||
{
|
||||
// System.out.println("End:" + hours + ":" + minutes);
|
||||
endDate.set(Calendar.HOUR_OF_DAY, hours);
|
||||
endDate.set(Calendar.MINUTE, minutes);
|
||||
// System.out.println(endDate.getTime());
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
DateFormat format = new SimpleDateFormat("dd-MM-yyyy");
|
||||
format.setLenient(false);
|
||||
|
||||
return artist.getName() + " plays from "
|
||||
+ format.format(startDate.getTime()) + " to "
|
||||
+ format.format(endDate.getTime()) + ".";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package Agenda;
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Stage implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1;
|
||||
|
||||
private String name;
|
||||
private String description;
|
||||
|
||||
public Stage(String name, String description)
|
||||
{
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,41 @@
|
||||
package Applicatie;
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.Point;
|
||||
import java.awt.Shape;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.Ellipse2D;
|
||||
import java.awt.geom.NoninvertibleTransformException;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
|
||||
public class DrawObject {
|
||||
public class DrawObject implements Serializable{
|
||||
Point2D position;
|
||||
double rotation;
|
||||
double scale;
|
||||
Image image;
|
||||
private String filename;
|
||||
//private Image rotateImage;
|
||||
protected boolean selected;
|
||||
private Rectangle2D rektAngle;
|
||||
private Rectangle2D upperLeftCorner;
|
||||
private Rectangle2D upperRightCorner;
|
||||
private Rectangle2D bottomLeftCorner;
|
||||
private Rectangle2D bottomRightCorner;
|
||||
private Ellipse2D rotateDot;
|
||||
static final int UPPERLEFT = 0;
|
||||
static final int UPPERRIGHT = 1;
|
||||
static final int BOTTOMLEFT = 2;
|
||||
static final int BOTTOMRIGHT = 3;
|
||||
|
||||
public DrawObject(String filename, Point2D position)
|
||||
{
|
||||
image = new ImageIcon(filename).getImage();
|
||||
this.filename = filename;
|
||||
//rotateImage = new ImageIcon("rotate.png").getImage();
|
||||
scale = 1;
|
||||
rotation = 0;
|
||||
this.position = position;
|
||||
@@ -28,24 +44,122 @@ public class DrawObject {
|
||||
public void draw(Graphics2D g)
|
||||
{
|
||||
AffineTransform tx = getTransform();
|
||||
Image image = new ImageIcon(filename).getImage();
|
||||
g.drawImage(image, tx, null);
|
||||
if(selected) {
|
||||
// g.rotate(Math.toRadians(rotation), image.getWidth(null)/2, image.getHeight(null)/2);
|
||||
|
||||
AffineTransform rotate = AffineTransform.getRotateInstance(Math.toRadians(rotation), position.getX() + image.getWidth(null)/2, position.getY() +image.getHeight(null)/2);
|
||||
g.transform(rotate);
|
||||
g.setColor(Color.BLACK);
|
||||
g.setStroke(new BasicStroke(7));
|
||||
rektAngle = new Rectangle2D.Double((int) position.getX(), (int) position.getY(), image.getWidth(null), image.getHeight(null));
|
||||
tx = getTransformRectangle();
|
||||
rektAngle.setFrame(tx.createTransformedShape(rektAngle).getBounds());
|
||||
g.draw(rektAngle);
|
||||
g.setColor(Color.YELLOW);
|
||||
upperLeftCorner = new Rectangle2D.Double(rektAngle.getX()-7,rektAngle.getY()-7,15,15);
|
||||
upperRightCorner = new Rectangle2D.Double(rektAngle.getX() + rektAngle.getWidth()-8,rektAngle.getY()-7,15,15);
|
||||
bottomLeftCorner = new Rectangle2D.Double(rektAngle.getX()-7,rektAngle.getY() + rektAngle.getHeight()-8,15,15);
|
||||
bottomRightCorner = new Rectangle2D.Double(rektAngle.getX() + rektAngle.getWidth()-8,rektAngle.getY() + rektAngle.getHeight()-8,15,15);
|
||||
g.fill(upperLeftCorner); //upperleft
|
||||
g.fill(upperRightCorner); //upperright
|
||||
g.fill(bottomLeftCorner); //bottomleft
|
||||
g.fill(bottomRightCorner); //bottomright
|
||||
g.setColor(Color.RED);
|
||||
rotateDot = new Ellipse2D.Double((rektAngle.getX() + (rektAngle.getWidth()/2))-8,rektAngle.getY()-8,15,15);
|
||||
g.fill(rotateDot);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected AffineTransform getTransform() {
|
||||
AffineTransform tx = new AffineTransform();
|
||||
tx.scale(scale, scale);
|
||||
tx.translate(position.getX(), position.getY());
|
||||
Image image = new ImageIcon(filename).getImage();
|
||||
tx.rotate(Math.toRadians(rotation), image.getWidth(null) / 2, image.getHeight(null) / 2);
|
||||
return tx;
|
||||
}
|
||||
|
||||
protected AffineTransform getTransformSelection() {
|
||||
AffineTransform tx = new AffineTransform();
|
||||
tx.scale(scale, scale);
|
||||
tx.translate(position.getX(), position.getY());
|
||||
return tx;
|
||||
}
|
||||
|
||||
public boolean contains(Point2D clickPoint) {
|
||||
Shape shape = new Rectangle2D.Double(0,0,image.getWidth(null), image.getHeight(null));
|
||||
return getTransform().createTransformedShape(shape).contains(clickPoint);
|
||||
/**
|
||||
* Special transformation for the selection rectangle, because the translation of the image one places the rectangle translated from the image.
|
||||
* @return affineTransform
|
||||
*/
|
||||
private AffineTransform getTransformRectangle() {
|
||||
AffineTransform tx = new AffineTransform();
|
||||
tx.scale(scale, scale);
|
||||
return tx;
|
||||
}
|
||||
|
||||
public void setSelected(boolean b)
|
||||
{
|
||||
public boolean contains(Point2D clickPoint) {
|
||||
Shape shape;
|
||||
Image image = new ImageIcon(filename).getImage();
|
||||
if(rektAngle == null) {
|
||||
shape = new Rectangle2D.Double(0,0,image.getWidth(null), image.getHeight(null));
|
||||
return getTransform().createTransformedShape(shape).contains(clickPoint);
|
||||
}
|
||||
else {
|
||||
shape = new Rectangle2D.Double(-7,-7,image.getWidth(null)+7, image.getHeight(null)+7);
|
||||
return getTransformSelection().createTransformedShape(shape).contains(clickPoint);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Point2D getObjectPoint(Point2D point) {
|
||||
try {
|
||||
return getTransform().inverseTransform(point, null);
|
||||
} catch (NoninvertibleTransformException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method checks if the place thats clicked is inside one of the corners.
|
||||
*
|
||||
* @param point
|
||||
* @param corner
|
||||
* @return if the clicked point is inside one of the corners
|
||||
*/
|
||||
public boolean containsCorner(Point2D point, int corner) {
|
||||
Rectangle2D chosenCorner = null;
|
||||
switch(corner) {
|
||||
case 0:
|
||||
chosenCorner = upperLeftCorner;
|
||||
break;
|
||||
case 1:
|
||||
chosenCorner = upperRightCorner;
|
||||
break;
|
||||
case 2:
|
||||
chosenCorner = bottomLeftCorner;
|
||||
break;
|
||||
case 3:
|
||||
chosenCorner = bottomRightCorner;
|
||||
break;
|
||||
case 4:
|
||||
if(point.getX() > rotateDot.getX() && point.getX() < rotateDot.getX() + rotateDot.getWidth()
|
||||
&& point.getY() > rotateDot.getY() && point.getY() < rotateDot.getY() + rotateDot.getHeight())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
if(point.getX() > chosenCorner.getX() && point.getX() < chosenCorner.getX() + chosenCorner.getWidth()
|
||||
&& point.getY() > chosenCorner.getY() && point.getY() < chosenCorner.getY() + chosenCorner.getHeight())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setSelected(boolean b) {
|
||||
selected = b;
|
||||
}
|
||||
|
||||
@@ -74,16 +188,24 @@ public class DrawObject {
|
||||
}
|
||||
|
||||
public Image getImage() {
|
||||
Image image = new ImageIcon(filename).getImage();
|
||||
return image;
|
||||
}
|
||||
|
||||
public void setImage(Image image) {
|
||||
this.image = image;
|
||||
}
|
||||
//public void setImage(Image image) {
|
||||
// this.image = image;
|
||||
//}
|
||||
|
||||
public boolean isSelected() {
|
||||
return selected;
|
||||
}
|
||||
|
||||
public Rectangle2D getRectangle() {
|
||||
return rektAngle;
|
||||
}
|
||||
|
||||
}
|
||||
public void setRectangle(Rectangle2D rectangle) {
|
||||
rektAngle = rectangle;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +1,7 @@
|
||||
package Applicatie;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
new Window();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,9 @@ import javax.swing.JOptionPane;
|
||||
|
||||
public class MenuBar extends JMenuBar {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public MenuBar(Window w)
|
||||
{
|
||||
super();
|
||||
@@ -23,8 +26,24 @@ public class MenuBar extends JMenuBar {
|
||||
}
|
||||
});
|
||||
|
||||
JMenuItem save = new JMenuItem("Save");
|
||||
save.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
SaveLoad.save(w.fp);
|
||||
}
|
||||
});
|
||||
|
||||
JMenuItem load = new JMenuItem("Load");
|
||||
load.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
SaveLoad.load(w.fp);
|
||||
}
|
||||
});
|
||||
|
||||
file.add(load);
|
||||
file.add(save);
|
||||
file.add(exit);
|
||||
|
||||
add(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,10 @@
|
||||
package Applicatie;
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
import java.awt.TexturePaint;
|
||||
import java.awt.event.MouseWheelEvent;
|
||||
import java.awt.event.MouseWheelListener;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.Ellipse2D;
|
||||
import java.awt.geom.NoninvertibleTransformException;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
@@ -18,84 +16,156 @@ import java.util.ArrayList;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import Agenda.Agenda;
|
||||
import Listeners.Mouse;
|
||||
import Listeners.MouseMotion;
|
||||
import Listeners.MouseWheel;
|
||||
import Objects.Entrance;
|
||||
import Objects.Path;
|
||||
import Objects.Podium;
|
||||
import Objects.Toilet;
|
||||
import Objects.Wall;
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class Panel extends JPanel {
|
||||
|
||||
|
||||
BufferedImage background;
|
||||
|
||||
BufferedImage podiumImage, toiletImage, entranceImage, pathImage,
|
||||
wallImage;
|
||||
|
||||
private int panelInfox, panelInfoy, scrollfactor;
|
||||
|
||||
private ArrayList<BufferedImage> panelInfo = new ArrayList<BufferedImage>();
|
||||
// private ArrayList<Object> panelTypes = new ArrayList<Object>();
|
||||
|
||||
ArrayList<DrawObject> objects = new ArrayList<>();
|
||||
DrawObject dragObject = null;
|
||||
|
||||
Point2D cameraPoint = new Point2D.Double(getWidth()/2,getHeight()/2);
|
||||
private DrawObject selectedObject;
|
||||
private String clickedOption = "drag";
|
||||
|
||||
Point2D cameraPoint = new Point2D.Double(getWidth() / 2, getHeight() / 2);
|
||||
float cameraScale = 1;
|
||||
|
||||
|
||||
Point2D lastClickPosition = new Point(0,0);
|
||||
Point lastMousePosition = new Point(0,0);
|
||||
|
||||
Panel()
|
||||
{
|
||||
|
||||
PropertiesPanel pp;
|
||||
|
||||
Point2D lastClickPosition = new Point(0, 0);
|
||||
Point lastMousePosition = new Point(0, 0);
|
||||
public Agenda agenda;
|
||||
|
||||
// how to nieuwe dingen aan het panel toe te voegen:
|
||||
// maak bufferedimage global aan, voeg er een image aan toe, en voeg de
|
||||
// image aan panelInfo toe en het object aan panelTypes.
|
||||
// en maak een case statement die een new Object returnt in
|
||||
// createNewDrawObject.
|
||||
|
||||
Panel(PropertiesPanel pp) {
|
||||
this.pp = pp;
|
||||
pp.setPanel(this);
|
||||
try {
|
||||
background = ImageIO.read(new File("images/grass.jpg"));
|
||||
podiumImage = ImageIO.read(new File("images/stageIcon.png"));
|
||||
toiletImage = ImageIO.read(new File("images/wcIcon.png"));
|
||||
entranceImage = ImageIO.read(new File("images/entranceIcon.png"));
|
||||
pathImage = ImageIO.read(new File("images/pathIcon.png"));
|
||||
wallImage = ImageIO.read(new File("images/wallIcon.png"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
objects.add(new Podium(new Point2D.Double(100, 100)));
|
||||
objects.add(new Podium(new Point2D.Double(500, 100)));
|
||||
objects.add(new Podium(new Point2D.Double(300, 400)));
|
||||
|
||||
panelInfo.add(podiumImage);
|
||||
panelInfo.add(toiletImage);
|
||||
panelInfo.add(entranceImage);
|
||||
panelInfo.add(pathImage);
|
||||
panelInfo.add(wallImage);
|
||||
|
||||
panelInfox = 0;
|
||||
panelInfoy = 0;
|
||||
scrollfactor = 0;
|
||||
|
||||
// objects.add(new Podium(new Point2D.Double(100, 100)));
|
||||
// objects.add(new Podium(new Point2D.Double(500, 100)));
|
||||
// objects.add(new Podium(new Point2D.Double(300, 400)));
|
||||
|
||||
addMouseListener(new Mouse(this));
|
||||
|
||||
|
||||
addMouseMotionListener(new MouseMotion(this));
|
||||
|
||||
|
||||
addMouseWheelListener(new MouseWheel(this));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void add(DrawObject dragObject)
|
||||
{
|
||||
|
||||
public int getPanelInfoLength() {
|
||||
int panelInfoLength = 0;
|
||||
for (BufferedImage image : panelInfo) {
|
||||
panelInfoLength += image.getWidth();
|
||||
}
|
||||
|
||||
return panelInfoLength;
|
||||
}
|
||||
|
||||
public DrawObject createNewDrawObject(int index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return new Podium(null);
|
||||
case 1:
|
||||
return new Toilet(null);
|
||||
case 2:
|
||||
return new Entrance(null);
|
||||
case 3:
|
||||
return new Path(null);
|
||||
case 4:
|
||||
return new Wall(null);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void add(DrawObject dragObject) {
|
||||
objects.add(dragObject);
|
||||
}
|
||||
|
||||
public void paintComponent(Graphics g)
|
||||
{
|
||||
super.paintComponent(g);
|
||||
Graphics2D g2 = (Graphics2D)g;
|
||||
g2.setClip(new Rectangle2D.Double(0,0, 200, getHeight()));
|
||||
|
||||
g2.fill(new Ellipse2D.Double(0,0,300,300));
|
||||
|
||||
|
||||
g2.setClip(new Rectangle2D.Double(200,0, getWidth()-200, getHeight()));
|
||||
public void paintComponent(Graphics g) {
|
||||
super.paintComponent(g);
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
g2.setClip(new Rectangle2D.Double(0, 0, getWidth(), 300));
|
||||
|
||||
// g2.fill(new Ellipse2D.Double(0,0,300,300));
|
||||
|
||||
// g2.drawImage(podiumImage, 0, 0, null);
|
||||
|
||||
g2.drawLine(0, 150, getWidth(), 150);
|
||||
for (BufferedImage image : panelInfo) {
|
||||
g2.drawImage(image, panelInfox + scrollfactor, panelInfoy, null);
|
||||
panelInfox += image.getWidth();
|
||||
}
|
||||
panelInfox = 0;
|
||||
|
||||
g2.setClip(new Rectangle2D.Double(0, 150, getWidth(), getHeight()));
|
||||
AffineTransform oldTransform = g2.getTransform();
|
||||
g2.setTransform(getCamera());
|
||||
|
||||
TexturePaint p = new TexturePaint(background, new Rectangle2D.Double(0, 0, 100, 100));
|
||||
|
||||
TexturePaint p = new TexturePaint(background, new Rectangle2D.Double(0,0, 100, 100));
|
||||
g2.setPaint(p);
|
||||
g2.fill(new Rectangle2D.Double(0,0,1920,1080));
|
||||
|
||||
for(DrawObject o : objects)
|
||||
g2.fill(new Rectangle2D.Double(-1920, -1080, 3840, 2160));
|
||||
|
||||
BasicStroke stroke = new BasicStroke(10);
|
||||
g2.setStroke(stroke);
|
||||
|
||||
for (DrawObject o : objects) {
|
||||
o.draw(g2);
|
||||
|
||||
|
||||
}
|
||||
|
||||
g2.setClip(null);
|
||||
g2.setTransform(oldTransform);
|
||||
}
|
||||
|
||||
public AffineTransform getCamera() {
|
||||
AffineTransform tx = new AffineTransform();
|
||||
tx.translate(-cameraPoint.getX() + getWidth()/2, -cameraPoint.getY() + getHeight()/2);
|
||||
tx.translate(-cameraPoint.getX() + getWidth() / 2, -cameraPoint.getY() + getHeight() / 2);
|
||||
tx.scale(cameraScale, cameraScale);
|
||||
|
||||
return tx;
|
||||
}
|
||||
|
||||
|
||||
public Point2D getClickPoint(Point point) {
|
||||
try {
|
||||
return getCamera().inverseTransform(point, null);
|
||||
@@ -105,72 +175,115 @@ public class Panel extends JPanel {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setBackground(BufferedImage background) {
|
||||
this.background = background;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ArrayList<DrawObject> getObjects() {
|
||||
return objects;
|
||||
}
|
||||
|
||||
|
||||
public void setObjects(ArrayList<DrawObject> objects) {
|
||||
this.objects = objects;
|
||||
}
|
||||
|
||||
|
||||
public DrawObject getDragObject() {
|
||||
return dragObject;
|
||||
}
|
||||
|
||||
|
||||
public void setDragObject(DrawObject dragObject) {
|
||||
this.dragObject = dragObject;
|
||||
}
|
||||
|
||||
|
||||
public Point2D getCameraPoint() {
|
||||
return cameraPoint;
|
||||
}
|
||||
|
||||
|
||||
public void setCameraPoint(Point2D cameraPoint) {
|
||||
this.cameraPoint = cameraPoint;
|
||||
}
|
||||
|
||||
|
||||
public float getCameraScale() {
|
||||
return cameraScale;
|
||||
}
|
||||
|
||||
|
||||
public void setCameraScale(float cameraScale) {
|
||||
this.cameraScale = cameraScale;
|
||||
}
|
||||
|
||||
|
||||
public Point2D getLastClickPosition() {
|
||||
return lastClickPosition;
|
||||
}
|
||||
|
||||
|
||||
public void setLastClickPosition(Point2D lastClickPosition) {
|
||||
this.lastClickPosition = lastClickPosition;
|
||||
}
|
||||
|
||||
|
||||
public Point getLastMousePosition() {
|
||||
return lastMousePosition;
|
||||
}
|
||||
|
||||
|
||||
public void setLastMousePosition(Point lastMousePosition) {
|
||||
this.lastMousePosition = lastMousePosition;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public BufferedImage getPodiumImage() {
|
||||
return podiumImage;
|
||||
}
|
||||
|
||||
public void setPodiumImage(BufferedImage podiumImage) {
|
||||
this.podiumImage = podiumImage;
|
||||
}
|
||||
|
||||
public ArrayList<BufferedImage> getPanelInfo() {
|
||||
return panelInfo;
|
||||
}
|
||||
|
||||
public void setPanelInfo(ArrayList<BufferedImage> panelInfo) {
|
||||
this.panelInfo = panelInfo;
|
||||
}
|
||||
|
||||
public int getScrollfactor() {
|
||||
return scrollfactor;
|
||||
}
|
||||
|
||||
public void setScrollfactor(int scrollfactor) {
|
||||
this.scrollfactor = scrollfactor;
|
||||
}
|
||||
|
||||
public int getPanelInfox() {
|
||||
return panelInfox;
|
||||
}
|
||||
|
||||
public void setPanelInfox(int panelInfox) {
|
||||
this.panelInfox = panelInfox;
|
||||
}
|
||||
|
||||
public PropertiesPanel getPP() {
|
||||
return pp;
|
||||
}
|
||||
|
||||
public void update() {
|
||||
repaint();
|
||||
}
|
||||
|
||||
public DrawObject getSelectedObject() {
|
||||
return selectedObject;
|
||||
}
|
||||
|
||||
public void setSelectedObject(DrawObject selectedObject) {
|
||||
this.selectedObject = selectedObject;
|
||||
}
|
||||
|
||||
public String getClickedOption() {
|
||||
return clickedOption;
|
||||
}
|
||||
|
||||
public void setClickedOption(String clickedOption) {
|
||||
this.clickedOption = clickedOption;
|
||||
}
|
||||
|
||||
public void clearObjects(){
|
||||
objects.clear();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,294 @@
|
||||
package Applicatie;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.KeyListener;
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class PropertiesPanel extends JPanel {
|
||||
|
||||
DrawObject selectedObject = null;
|
||||
Panel p = null;
|
||||
|
||||
JTextField locationXField;
|
||||
JTextField locationYField;
|
||||
JTextField scaleField;
|
||||
JTextField rotationField;
|
||||
|
||||
PropertiesPanel() {
|
||||
super();
|
||||
BoxLayout box = new BoxLayout(this, BoxLayout.PAGE_AXIS);
|
||||
setLayout(box);
|
||||
|
||||
setPreferredSize(new Dimension(200, 0));
|
||||
setBorder(BorderFactory.createLineBorder(new Color(180, 180, 180)));
|
||||
setBackground(new Color(220, 220, 220));
|
||||
|
||||
// NAME "PROPERTIES"
|
||||
JPanel propPanel = new JPanel();
|
||||
JLabel propLabel = new JLabel("Properties");
|
||||
propLabel.setFont(new Font("Segoe UI", Font.BOLD, 30));
|
||||
propPanel.setBackground(new Color(220, 220, 220));
|
||||
propPanel.setMaximumSize(new Dimension(200, 60));
|
||||
propPanel.add(propLabel);
|
||||
add(propPanel);
|
||||
|
||||
// LOCATION
|
||||
JPanel locationPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||
JLabel locationLabel = new JLabel("Location");
|
||||
locationLabel.setFont(new Font("Segoe UI", Font.ITALIC, 20));
|
||||
locationPanel.setPreferredSize(new Dimension(200, 150));
|
||||
locationPanel.setMaximumSize(new Dimension(200, 150));
|
||||
locationPanel.add(locationLabel);
|
||||
add(locationPanel);
|
||||
{
|
||||
JPanel locationXPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||
locationXPanel.setPreferredSize(new Dimension(200, 50));
|
||||
locationPanel.add(locationXPanel);
|
||||
|
||||
JLabel locationXLabel = new JLabel("X");
|
||||
locationXPanel.add(locationXLabel);
|
||||
locationXField = new JTextField();
|
||||
locationXField.setPreferredSize(new Dimension(150, 25));
|
||||
{
|
||||
locationXField.addKeyListener(new KeyListener() {
|
||||
|
||||
public void keyTyped(KeyEvent e) {
|
||||
|
||||
try {
|
||||
locationXField.setBackground(Color.WHITE);
|
||||
double xpos = Double.parseDouble(locationXField
|
||||
.getText());
|
||||
selectedObject.setPosition(new Point2D.Double(xpos,
|
||||
selectedObject.getPosition().getY()));
|
||||
p.update();
|
||||
} catch (NumberFormatException nfe) {
|
||||
locationXField.setBackground(Color.RED);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void keyReleased(KeyEvent e) {
|
||||
}
|
||||
|
||||
public void keyPressed(KeyEvent e) {
|
||||
}
|
||||
});
|
||||
}
|
||||
locationXPanel.add(locationXField);
|
||||
}
|
||||
{
|
||||
JPanel locationYPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||
locationYPanel.setPreferredSize(new Dimension(200, 50));
|
||||
locationPanel.add(locationYPanel);
|
||||
|
||||
JLabel locationYLabel = new JLabel("Y");
|
||||
locationYPanel.add(locationYLabel);
|
||||
locationYField = new JTextField();
|
||||
locationYField.setPreferredSize(new Dimension(150, 25));
|
||||
{
|
||||
locationYField.addKeyListener(new KeyListener() {
|
||||
|
||||
public void keyTyped(KeyEvent e) {
|
||||
try {
|
||||
locationYField.setBackground(Color.WHITE);
|
||||
double ypos = Double.parseDouble(locationYField
|
||||
.getText());
|
||||
selectedObject.setPosition(new Point2D.Double(
|
||||
selectedObject.getPosition().getX(), ypos));
|
||||
;
|
||||
p.update();
|
||||
} catch (NumberFormatException nfe) {
|
||||
|
||||
locationYField.setBackground(Color.RED);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void keyReleased(KeyEvent e) {
|
||||
}
|
||||
|
||||
public void keyPressed(KeyEvent e) {
|
||||
}
|
||||
});
|
||||
}
|
||||
locationYPanel.add(locationYField);
|
||||
}
|
||||
|
||||
// SCALE
|
||||
JPanel scalePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||
JLabel scaleLabel = new JLabel("Scale");
|
||||
scaleLabel.setFont(new Font("Segoe UI", Font.ITALIC, 20));
|
||||
scalePanel.setPreferredSize(new Dimension(200, 100));
|
||||
scalePanel.setMaximumSize(new Dimension(200, 100));
|
||||
scalePanel.add(scaleLabel);
|
||||
add(scalePanel);
|
||||
{
|
||||
JPanel scalePanel2 = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||
scalePanel2.setPreferredSize(new Dimension(200, 50));
|
||||
scalePanel.add(scalePanel2);
|
||||
|
||||
JLabel scale2Label = new JLabel(" ");
|
||||
scalePanel2.add(scale2Label);
|
||||
scaleField = new JTextField();
|
||||
scaleField.setPreferredSize(new Dimension(150, 25));
|
||||
{
|
||||
scaleField.addKeyListener(new KeyListener() {
|
||||
|
||||
public void keyTyped(KeyEvent e) {
|
||||
|
||||
try {
|
||||
scaleField.setBackground(Color.WHITE);
|
||||
double scale = Double.parseDouble(scaleField
|
||||
.getText());
|
||||
selectedObject.setScale(scale);
|
||||
p.update();
|
||||
} catch (NumberFormatException nfe) {
|
||||
scaleField.setBackground(Color.RED);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void keyReleased(KeyEvent e) {
|
||||
}
|
||||
|
||||
public void keyPressed(KeyEvent e) {
|
||||
}
|
||||
});
|
||||
}
|
||||
scalePanel2.add(scaleField);
|
||||
}
|
||||
|
||||
// ROTATION
|
||||
JPanel rotationPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||
JLabel rotationLabel = new JLabel("Rotation");
|
||||
rotationLabel.setFont(new Font("Segoe UI", Font.ITALIC, 20));
|
||||
rotationPanel.setPreferredSize(new Dimension(200, 100));
|
||||
rotationPanel.setMaximumSize(new Dimension(200, 100));
|
||||
rotationPanel.add(rotationLabel);
|
||||
add(rotationPanel);
|
||||
{
|
||||
JPanel rotationPanel2 = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||
rotationPanel2.setPreferredSize(new Dimension(200, 50));
|
||||
rotationPanel.add(rotationPanel2);
|
||||
|
||||
JLabel rotation2Label = new JLabel(" ");
|
||||
rotationPanel2.add(rotation2Label);
|
||||
rotationField = new JTextField();
|
||||
rotationField.setPreferredSize(new Dimension(150, 25));
|
||||
{
|
||||
rotationField.addKeyListener(new KeyListener() {
|
||||
|
||||
public void keyTyped(KeyEvent e) {
|
||||
|
||||
try {
|
||||
rotationField.setBackground(Color.WHITE);
|
||||
int rotation = Integer.parseInt(rotationField
|
||||
.getText()) % 360;
|
||||
rotationField.setText(rotation + "");
|
||||
selectedObject.setRotation(rotation);
|
||||
p.update();
|
||||
} catch (NumberFormatException nfe) {
|
||||
rotationField.setBackground(Color.RED);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void keyReleased(KeyEvent e) {
|
||||
}
|
||||
|
||||
public void keyPressed(KeyEvent e) {
|
||||
}
|
||||
});
|
||||
}
|
||||
rotationPanel2.add(rotationField);
|
||||
}
|
||||
|
||||
// SPACER
|
||||
JPanel spacerPanel = new JPanel();
|
||||
spacerPanel.setPreferredSize(new Dimension(200, 50));
|
||||
spacerPanel.setMaximumSize(new Dimension(200, 50));
|
||||
spacerPanel.setBackground(new Color(220, 220, 220));
|
||||
add(spacerPanel);
|
||||
|
||||
// EXAMPLE
|
||||
JPanel examplePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||
JLabel exampleLabel = new JLabel("Example");
|
||||
exampleLabel.setFont(new Font("Segoe UI", Font.ITALIC, 20));
|
||||
examplePanel.setPreferredSize(new Dimension(200, 100));
|
||||
examplePanel.setMaximumSize(new Dimension(200, 100));
|
||||
examplePanel.add(exampleLabel);
|
||||
add(examplePanel);
|
||||
|
||||
enableComponents(this, false);
|
||||
}
|
||||
|
||||
public void setSelected(DrawObject drOb) {
|
||||
selectedObject = drOb;
|
||||
fillFields();
|
||||
enableComponents(this, true);
|
||||
}
|
||||
|
||||
public void clearSelected() {
|
||||
enableComponents(this, false);
|
||||
clearFields(this);
|
||||
selectedObject = null;
|
||||
}
|
||||
|
||||
public void update() {
|
||||
fillFields();
|
||||
}
|
||||
|
||||
private void enableComponents(Container container, boolean enable) {
|
||||
Component[] components = container.getComponents();
|
||||
for (Component component : components) {
|
||||
component.setEnabled(enable);
|
||||
if (component instanceof Container) {
|
||||
enableComponents((Container) component, enable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void clearFields(Container container) {
|
||||
Component[] components = container.getComponents();
|
||||
for (Component component : components) {
|
||||
if (component instanceof JTextField) {
|
||||
((JTextField) component).setText("");
|
||||
}
|
||||
if (component instanceof Container) {
|
||||
clearFields((Container) component);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void fillFields() {
|
||||
if (selectedObject != null) {
|
||||
locationXField.setText(Math.round(selectedObject.getPosition()
|
||||
.getX()) + "");
|
||||
locationYField.setText(Math.round(selectedObject.getPosition()
|
||||
.getY()) + "");
|
||||
scaleField
|
||||
.setText((double) Math.round(selectedObject.getScale() * 10)
|
||||
/ 10 + "");
|
||||
rotationField
|
||||
.setText(Math.round(selectedObject.getRotation() % 360)
|
||||
+ "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setPanel(Panel p) {
|
||||
this.p = p;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,23 @@
|
||||
public void save()
|
||||
package Applicatie;
|
||||
import java.io.EOFException;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
|
||||
import Agenda.Agenda;
|
||||
|
||||
|
||||
public class SaveLoad {
|
||||
|
||||
|
||||
public static void save(Panel panel)
|
||||
{
|
||||
JFileChooser fileChooser = new JFileChooser();
|
||||
|
||||
@@ -32,24 +51,24 @@ public void save()
|
||||
{
|
||||
if(JOptionPane.showConfirmDialog(null, "Are you sure you want to overwrite: " + file.getName(), "Overwrite", JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION)
|
||||
{
|
||||
saveTerrain(file);
|
||||
saveTerrain(file, panel);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
saveTerrain(file);
|
||||
saveTerrain(file, panel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void saveTerrain(File file) {
|
||||
public static void saveTerrain(File file, Panel panel) {
|
||||
|
||||
try {
|
||||
FileOutputStream fos = new FileOutputStream(file);
|
||||
ObjectOutputStream oos = new ObjectOutputStream(fos);
|
||||
oos.writeObject(agenda);
|
||||
for (TekenObject object : objects) {
|
||||
//oos.writeObject(panel.agenda);
|
||||
for (DrawObject object : panel.objects) {
|
||||
oos.writeObject(object);
|
||||
}
|
||||
oos.close();
|
||||
@@ -59,7 +78,7 @@ public void save()
|
||||
}
|
||||
}
|
||||
|
||||
public void load()
|
||||
public static void load(Panel panel)
|
||||
{
|
||||
JFileChooser fileChooser = new JFileChooser();
|
||||
fileChooser.setFileFilter(new FileFilter() {
|
||||
@@ -90,13 +109,13 @@ public void save()
|
||||
}
|
||||
else
|
||||
{
|
||||
fillTerrain(file);
|
||||
fillTerrain(file, panel);
|
||||
JOptionPane.showMessageDialog(null, "Loaded succesfully");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void fillTerrain(File file) {
|
||||
public static void fillTerrain(File file, Panel panel) {
|
||||
FileInputStream fis = null;
|
||||
ObjectInputStream ois = null;
|
||||
|
||||
@@ -108,10 +127,11 @@ public void save()
|
||||
Object object;
|
||||
object = ois.readObject();
|
||||
try {
|
||||
agenda = (Agenda) object;
|
||||
object = ois.readObject();
|
||||
//panel.agenda = (Agenda) object;
|
||||
//object = ois.readObject();
|
||||
panel.clearObjects();
|
||||
while (object != null) {
|
||||
objects.add((TekenObject) object);
|
||||
panel.objects.add((DrawObject) object);
|
||||
object = ois.readObject();
|
||||
}
|
||||
} catch (EOFException e) {
|
||||
@@ -119,7 +139,8 @@ public void save()
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
for ( int i = 0; i < objects.size(); i++){
|
||||
System.out.println(objects.get(i).getPosition());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -7,6 +7,8 @@ import javax.swing.JPanel;
|
||||
|
||||
public class Window extends JFrame {
|
||||
private static final long serialVersionUID = -1324363758675184283L;
|
||||
|
||||
Panel fp;
|
||||
|
||||
Window()
|
||||
{
|
||||
@@ -17,8 +19,10 @@ public class Window extends JFrame {
|
||||
|
||||
//CONTENT PANELS
|
||||
JPanel contentPanel = new JPanel(new BorderLayout());
|
||||
Panel fp = new Panel();
|
||||
PropertiesPanel pp = new PropertiesPanel();
|
||||
fp = new Panel(pp);
|
||||
contentPanel.add(fp, BorderLayout.CENTER);
|
||||
contentPanel.add(pp, BorderLayout.EAST);
|
||||
|
||||
setContentPane(contentPanel);
|
||||
//END CONTENT PANELS
|
||||
@@ -31,4 +35,4 @@ public class Window extends JFrame {
|
||||
setFocusable(true);
|
||||
setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,45 +3,94 @@ package Listeners;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import Applicatie.DrawObject;
|
||||
import Applicatie.Panel;
|
||||
import Objects.Podium;
|
||||
import Objects.Toilet;
|
||||
import Applicatie.Panel;
|
||||
|
||||
public class Mouse extends MouseAdapter {
|
||||
|
||||
private Panel panel;
|
||||
|
||||
public Mouse(Panel panel)
|
||||
{
|
||||
private Panel panel;
|
||||
private DrawObject selectedObject;
|
||||
|
||||
public Mouse(Panel panel) {
|
||||
this.panel = panel;
|
||||
selectedObject = null;
|
||||
}
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
Point2D clickPoint = panel.getClickPoint(e.getPoint());
|
||||
panel.setLastClickPosition(clickPoint);
|
||||
panel.setLastMousePosition(e.getPoint());
|
||||
if (e.getY() < 150) {
|
||||
// if(e.getX() < 51) //51 = width podium image
|
||||
// panel.setDragObject(new Podium(clickPoint));
|
||||
// else
|
||||
// panel.setDragObject(new Toilet(clickPoint));
|
||||
int i = 0;
|
||||
int last = 0;
|
||||
for (BufferedImage image : panel.getPanelInfo()) {
|
||||
if (e.getX() >= panel.getScrollfactor()
|
||||
&& e.getX() < last + image.getWidth()
|
||||
+ panel.getScrollfactor()) {
|
||||
DrawObject tempDrawObj = panel.createNewDrawObject(i);
|
||||
tempDrawObj.setPosition(clickPoint);
|
||||
panel.setDragObject(tempDrawObj);
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
last += image.getWidth();
|
||||
|
||||
if(e.getX() < 200)
|
||||
{
|
||||
if(e.getY() < 300)
|
||||
panel.setDragObject(new Podium(clickPoint));
|
||||
else
|
||||
panel.setDragObject(new Toilet(clickPoint));
|
||||
panel.add(panel.getDragObject());
|
||||
}
|
||||
else
|
||||
{
|
||||
for(DrawObject o : panel.getObjects())
|
||||
if(o.contains(clickPoint))
|
||||
}
|
||||
if (panel.getDragObject() != null) {
|
||||
panel.add(panel.getDragObject());
|
||||
}
|
||||
} else {
|
||||
for (DrawObject o : panel.getObjects()) {
|
||||
if (o.contains(clickPoint)) {
|
||||
if (o == selectedObject) {
|
||||
boolean upperLeft = o.containsCorner(clickPoint, 0);
|
||||
boolean upperRight = o.containsCorner(clickPoint, 1);
|
||||
boolean bottomLeft = o.containsCorner(clickPoint, 2);
|
||||
boolean bottomRight = o.containsCorner(clickPoint, 3);
|
||||
boolean rotate = o.containsCorner(clickPoint, 4);
|
||||
if (upperLeft) {
|
||||
panel.setClickedOption("upperLeft");
|
||||
} else if (upperRight) {
|
||||
panel.setClickedOption("upperRight");
|
||||
} else if (bottomLeft) {
|
||||
panel.setClickedOption("bottomLeft");
|
||||
} else if (bottomRight) {
|
||||
panel.setClickedOption("bottomRight");
|
||||
} else if (rotate) {
|
||||
panel.setClickedOption("rotate");
|
||||
} else {
|
||||
panel.setClickedOption("drag");
|
||||
}
|
||||
}
|
||||
if (selectedObject != null)
|
||||
selectedObject.setSelected(false);
|
||||
panel.setDragObject(o);
|
||||
o.setSelected(true);
|
||||
selectedObject = o;
|
||||
panel.setDragObject(o);
|
||||
panel.getPP().setSelected(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (panel.getDragObject() == null && selectedObject != null) {
|
||||
selectedObject.setSelected(false);
|
||||
selectedObject = null;
|
||||
}
|
||||
panel.repaint();
|
||||
}
|
||||
|
||||
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
panel.setDragObject(null);
|
||||
panel.setClickedOption("drag");
|
||||
panel.repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,8 @@
|
||||
package Listeners;
|
||||
import Applicatie.Panel;
|
||||
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseMotionAdapter;
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import Applicatie.Panel;
|
||||
|
||||
public class MouseMotion extends MouseMotionAdapter {
|
||||
@@ -21,32 +16,80 @@ public class MouseMotion extends MouseMotionAdapter {
|
||||
|
||||
public void mouseDragged(MouseEvent e) {
|
||||
Point2D clickPoint = panel.getClickPoint(e.getPoint());
|
||||
if(panel.getDragObject() != null)
|
||||
{
|
||||
if(SwingUtilities.isLeftMouseButton(e)){
|
||||
|
||||
|
||||
panel.getDragObject().setPosition(new Point2D.Double(
|
||||
panel.getDragObject().getPosition().getX() - (panel.getLastClickPosition().getX() - clickPoint.getX()),
|
||||
panel.getDragObject().getPosition().getY() - (panel.getLastClickPosition().getY() - clickPoint.getY())));
|
||||
if(panel.getDragObject() != null) {
|
||||
Point2D objectPoint = panel.getDragObject().getObjectPoint(panel.getDragObject().getPosition());
|
||||
switch(panel.getClickedOption()) {
|
||||
case "drag":
|
||||
if(panel.getDragObject() != null)
|
||||
panel.getDragObject().setPosition(new Point2D.Double(
|
||||
(panel.getDragObject().getPosition().getX() ) - ((panel.getLastClickPosition().getX() - clickPoint.getX()) ) / panel.getDragObject().getScale(),
|
||||
(panel.getDragObject().getPosition().getY()) - (panel.getLastClickPosition().getY() - clickPoint.getY()) / panel.getDragObject().getScale() ));
|
||||
System.out.println(panel.getDragObject().getPosition().getX());
|
||||
System.out.println(panel.getLastClickPosition().getX());
|
||||
System.out.println(clickPoint.getX());
|
||||
System.out.println("----------'");
|
||||
break;
|
||||
case "upperLeft":
|
||||
if(clickPoint.getX() < panel.getDragObject().getPosition().getX() && clickPoint.getY() < panel.getDragObject().getPosition().getY()) {
|
||||
resizeBigger();
|
||||
}
|
||||
else if (clickPoint.getX() > panel.getDragObject().getPosition().getX() && clickPoint.getY() > panel.getDragObject().getPosition().getY()) {
|
||||
resizeSmaller();
|
||||
}
|
||||
break;
|
||||
case "upperRight":
|
||||
if(clickPoint.getX() > panel.getDragObject().getRectangle().getX() + panel.getDragObject().getRectangle().getWidth() && clickPoint.getY() < panel.getDragObject().getRectangle().getY()) {
|
||||
resizeBigger();
|
||||
}
|
||||
else if (clickPoint.getX() < panel.getDragObject().getRectangle().getX() + panel.getDragObject().getRectangle().getWidth() && clickPoint.getY() > panel.getDragObject().getRectangle().getY()) {
|
||||
resizeSmaller();
|
||||
}
|
||||
break;
|
||||
case "bottomLeft":
|
||||
if(clickPoint.getX() < panel.getDragObject().getRectangle().getX() && clickPoint.getY() > panel.getDragObject().getRectangle().getY() + panel.getDragObject().getRectangle().getHeight()) {
|
||||
resizeBigger();
|
||||
}
|
||||
else if (clickPoint.getX() > panel.getDragObject().getRectangle().getX() && clickPoint.getY() < panel.getDragObject().getRectangle().getY() + panel.getDragObject().getRectangle().getHeight()) {
|
||||
resizeSmaller();
|
||||
}
|
||||
break;
|
||||
case "bottomRight":
|
||||
if(clickPoint.getX() > panel.getDragObject().getRectangle().getX() + panel.getDragObject().getRectangle().getWidth() && clickPoint.getY() > panel.getDragObject().getRectangle().getY() + panel.getDragObject().getRectangle().getHeight()) {
|
||||
resizeBigger();
|
||||
}
|
||||
else if (clickPoint.getX() < panel.getDragObject().getRectangle().getX() + panel.getDragObject().getRectangle().getWidth() && clickPoint.getY() < panel.getDragObject().getRectangle().getY() + panel.getDragObject().getRectangle().getHeight()) {
|
||||
resizeSmaller();
|
||||
}
|
||||
break;
|
||||
case "rotate":
|
||||
double tempval = panel.getDragObject().getRotation() + (panel.getLastClickPosition().getX() - clickPoint.getX());
|
||||
panel.getDragObject().setRotation(tempval);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
double tempval = panel.getDragObject().getRotation() + (panel.getLastClickPosition().getX() - clickPoint.getX());
|
||||
panel.getDragObject().setRotation(tempval);
|
||||
}
|
||||
panel.repaint();
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
panel.setCameraPoint(new Point2D.Double(
|
||||
panel.getCameraPoint().getX() + (panel.getLastMousePosition().getX() - e.getX()),
|
||||
panel.getCameraPoint().getY() + (panel.getLastMousePosition().getY() - e.getY())
|
||||
));
|
||||
panel.repaint();
|
||||
}
|
||||
panel.getCameraPoint().getX() + (panel.getLastMousePosition().getX() - e.getX()),
|
||||
panel.getCameraPoint().getY() + (panel.getLastMousePosition().getY() - e.getY())
|
||||
));
|
||||
}
|
||||
panel.repaint();
|
||||
panel.setLastMousePosition(e.getPoint());
|
||||
panel.setLastClickPosition(clickPoint);
|
||||
panel.getPP().update();
|
||||
}
|
||||
}
|
||||
|
||||
private void resizeBigger() {
|
||||
double scale = panel.getDragObject().getScale()*1 + 0.02;
|
||||
panel.getDragObject().setScale(scale);
|
||||
panel.getDragObject().setPosition(new Point2D.Double(panel.getDragObject().getPosition().getX()-2,panel.getDragObject().getPosition().getY()-2));
|
||||
}
|
||||
|
||||
private void resizeSmaller() {
|
||||
if(panel.getDragObject().getScale() > 0.2) {
|
||||
double scale = panel.getDragObject().getScale()*1 - 0.02;
|
||||
panel.getDragObject().setScale(scale);
|
||||
panel.getDragObject().setPosition(new Point2D.Double(panel.getDragObject().getPosition().getX()+2,panel.getDragObject().getPosition().getY()+2));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,28 +9,51 @@ import Applicatie.Panel;
|
||||
|
||||
public class MouseWheel implements MouseWheelListener {
|
||||
private Panel panel;
|
||||
|
||||
public MouseWheel(Panel panel)
|
||||
{
|
||||
private int scrollfactor;
|
||||
|
||||
public MouseWheel(Panel panel) {
|
||||
this.panel = panel;
|
||||
scrollfactor = 20;
|
||||
}
|
||||
|
||||
|
||||
public void mouseWheelMoved(MouseWheelEvent e) {
|
||||
Point2D clickPoint = panel.getClickPoint(e.getPoint());
|
||||
for(DrawObject o : panel.getObjects())
|
||||
{
|
||||
if(o.contains(clickPoint))
|
||||
{
|
||||
double scale = o.getScale()* 1 + (e.getPreciseWheelRotation()/10.0);
|
||||
for (DrawObject o : panel.getObjects()) {
|
||||
if (o.contains(clickPoint)) {
|
||||
double scale = o.getScale() * 1
|
||||
+ (e.getPreciseWheelRotation() / 10.0);
|
||||
o.setScale(scale);
|
||||
panel.getPP().update();
|
||||
panel.repaint();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// cameraPoint
|
||||
double cameraScale = panel.getCameraScale() * 1 - (e.getPreciseWheelRotation()/10);
|
||||
panel.setCameraScale((float) cameraScale);
|
||||
|
||||
if (e.getY() < 150) {
|
||||
|
||||
if (e.getPreciseWheelRotation() < 0) {
|
||||
if (panel.getScrollfactor() + scrollfactor
|
||||
+ panel.getPanelInfoLength() < panel.getWidth()) {
|
||||
panel.setScrollfactor(panel.getScrollfactor()
|
||||
+ scrollfactor);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (panel.getScrollfactor() - scrollfactor >= 0) {
|
||||
panel.setScrollfactor(panel.getScrollfactor()
|
||||
- scrollfactor);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
// cameraPoint
|
||||
double cameraScale = panel.getCameraScale() * 1
|
||||
- (e.getPreciseWheelRotation() / 10);
|
||||
panel.setCameraScale((float) cameraScale);
|
||||
|
||||
}
|
||||
|
||||
panel.repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package Objects;
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import Applicatie.DrawObject;
|
||||
|
||||
|
||||
public class Entrance extends DrawObject {
|
||||
|
||||
public Entrance(Point2D position) {
|
||||
super("images/entrance.png", position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Entrance";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package Objects;
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import Applicatie.DrawObject;
|
||||
|
||||
|
||||
public class Path extends DrawObject {
|
||||
|
||||
public Path(Point2D position) {
|
||||
super("images/path.jpg", position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Path";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import Applicatie.DrawObject;
|
||||
public class Podium extends DrawObject {
|
||||
|
||||
public Podium(Point2D position) {
|
||||
super("images/stage3.png", position);
|
||||
super("images/stage4.png", position);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package Objects;
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import Applicatie.DrawObject;
|
||||
|
||||
|
||||
public class Stage extends DrawObject {
|
||||
|
||||
public Stage(Point2D position) {
|
||||
super("images/stage3.png", position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Stage";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -7,7 +7,13 @@ import Applicatie.DrawObject;
|
||||
public class Toilet extends DrawObject {
|
||||
|
||||
public Toilet(Point2D position) {
|
||||
super("images/toilet.png", position);
|
||||
super("images/wc.png", position);
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Toilet";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package Objects;
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import Applicatie.DrawObject;
|
||||
|
||||
|
||||
public class Wall extends DrawObject {
|
||||
|
||||
public Wall(Point2D position) {
|
||||
super("images/wall.png", position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Wall";
|
||||
}
|
||||
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 494 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 9.1 KiB |
|
After Width: | Height: | Size: 911 B |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 4.0 KiB |