Merge remote-tracking branch 'origin/kenneth' into develop
This commit is contained in:
@@ -26,10 +26,11 @@ public class ControlPanel extends JPanel
|
|||||||
super();
|
super();
|
||||||
BoxLayout box = new BoxLayout(this, BoxLayout.X_AXIS);
|
BoxLayout box = new BoxLayout(this, BoxLayout.X_AXIS);
|
||||||
setLayout(box);
|
setLayout(box);
|
||||||
|
|
||||||
setPreferredSize(new Dimension(0,50));
|
setPreferredSize(new Dimension(0,50));
|
||||||
setBorder(BorderFactory.createLineBorder(new Color(180, 180, 180)));
|
setBorder(BorderFactory.createLineBorder(new Color(180, 180, 180)));
|
||||||
setBackground(new Color(220, 220, 220));
|
setBackground(new Color(220, 220, 220));
|
||||||
|
setFocusable(false);
|
||||||
|
|
||||||
JPanel simulatorPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
JPanel simulatorPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
simulatorPanel.setPreferredSize(new Dimension(350,50));
|
simulatorPanel.setPreferredSize(new Dimension(350,50));
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import javax.swing.JPanel;
|
|||||||
import javax.swing.Timer;
|
import javax.swing.Timer;
|
||||||
|
|
||||||
import Agenda.Agenda;
|
import Agenda.Agenda;
|
||||||
|
import Listeners.WindowFocusListener;
|
||||||
import Listeners.Mouse;
|
import Listeners.Mouse;
|
||||||
import Listeners.MouseMotion;
|
import Listeners.MouseMotion;
|
||||||
import Listeners.MouseWheel;
|
import Listeners.MouseWheel;
|
||||||
@@ -113,7 +114,7 @@ public class Panel extends JPanel implements ActionListener
|
|||||||
entranceImage = ImageIO.read(new File("images/entranceIcon.png"));
|
entranceImage = ImageIO.read(new File("images/entranceIcon.png"));
|
||||||
wallImage = ImageIO.read(new File("images/wallIcon.png"));
|
wallImage = ImageIO.read(new File("images/wallIcon.png"));
|
||||||
foodImage = ImageIO.read(new File("images/foodIcon.png"));
|
foodImage = ImageIO.read(new File("images/foodIcon.png"));
|
||||||
waypointImage = ImageIO.read(new File("images/waypointIcon.png"));
|
waypointImage = ImageIO.read(new File("images/waypoint.png"));
|
||||||
background = grass;
|
background = grass;
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
@@ -142,6 +143,9 @@ public class Panel extends JPanel implements ActionListener
|
|||||||
addMouseMotionListener(new MouseMotion(this));
|
addMouseMotionListener(new MouseMotion(this));
|
||||||
|
|
||||||
addMouseWheelListener(new MouseWheel(this));
|
addMouseWheelListener(new MouseWheel(this));
|
||||||
|
|
||||||
|
addFocusListener(new WindowFocusListener(this));
|
||||||
|
|
||||||
t = new Timer(1000 / 10, this);
|
t = new Timer(1000 / 10, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,7 +213,7 @@ public class Panel extends JPanel implements ActionListener
|
|||||||
{
|
{
|
||||||
super.paintComponent(g);
|
super.paintComponent(g);
|
||||||
Graphics2D g2 = (Graphics2D) g;
|
Graphics2D g2 = (Graphics2D) g;
|
||||||
g2.setClip(new Rectangle2D.Double(0, 0, getWidth(), 300));
|
g2.setClip(new Rectangle2D.Double(0, 0, getWidth(), 150));
|
||||||
Stroke old = g2.getStroke();
|
Stroke old = g2.getStroke();
|
||||||
g2.setStroke(new BasicStroke(10));
|
g2.setStroke(new BasicStroke(10));
|
||||||
g2.drawLine(0, 150, getWidth(), 150);
|
g2.drawLine(0, 150, getWidth(), 150);
|
||||||
@@ -469,6 +473,9 @@ public class Panel extends JPanel implements ActionListener
|
|||||||
*/
|
*/
|
||||||
public void startPath()
|
public void startPath()
|
||||||
{
|
{
|
||||||
|
pp.clearSelected();
|
||||||
|
setSelectedObject(null);
|
||||||
|
clearObjectSelection();
|
||||||
setClickedOption("Path");
|
setClickedOption("Path");
|
||||||
currentPath = new Path();
|
currentPath = new Path();
|
||||||
paths.add(currentPath);
|
paths.add(currentPath);
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ public class PropertiesPanel extends JPanel
|
|||||||
setPreferredSize(new Dimension(200, 0));
|
setPreferredSize(new Dimension(200, 0));
|
||||||
setBorder(BorderFactory.createLineBorder(new Color(180, 180, 180)));
|
setBorder(BorderFactory.createLineBorder(new Color(180, 180, 180)));
|
||||||
setBackground(new Color(220, 220, 220));
|
setBackground(new Color(220, 220, 220));
|
||||||
|
setFocusable(false);
|
||||||
|
|
||||||
// NAME "PROPERTIES"
|
// NAME "PROPERTIES"
|
||||||
JPanel propPanel = new JPanel();
|
JPanel propPanel = new JPanel();
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package Listeners;
|
||||||
|
|
||||||
|
import java.awt.event.FocusEvent;
|
||||||
|
import java.awt.event.FocusListener;
|
||||||
|
|
||||||
|
import Applicatie.Panel;
|
||||||
|
|
||||||
|
public class WindowFocusListener implements FocusListener
|
||||||
|
{
|
||||||
|
Panel p;
|
||||||
|
|
||||||
|
public WindowFocusListener(Panel p)
|
||||||
|
{
|
||||||
|
this.p = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void focusGained(FocusEvent e){}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void focusLost(FocusEvent e)
|
||||||
|
{
|
||||||
|
p.requestFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user