ok
This commit is contained in:
+373
-98
@@ -1,32 +1,56 @@
|
||||
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.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.KeyListener;
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import Objects.DrawObject;
|
||||
import Objects.Path;
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class PropertiesPanel extends JPanel {
|
||||
public class PropertiesPanel extends JPanel
|
||||
{
|
||||
|
||||
DrawObject selectedObject = null;
|
||||
Path selectedPath = null;
|
||||
|
||||
Panel p = null;
|
||||
|
||||
Dimension spacerDimension = new Dimension(200, 10);
|
||||
|
||||
|
||||
JLabel nameLabel;
|
||||
JPanel areaPanel;
|
||||
Component rigidArea;
|
||||
|
||||
JTextField locationXField;
|
||||
JTextField locationYField;
|
||||
JTextField scaleField;
|
||||
JTextField rotationField;
|
||||
JTextField areaTopField;
|
||||
JTextField areaBottomField;
|
||||
JTextField areaLeftField;
|
||||
JTextField areaRightField;
|
||||
|
||||
PropertiesPanel() {
|
||||
PropertiesPanel()
|
||||
{
|
||||
super();
|
||||
BoxLayout box = new BoxLayout(this, BoxLayout.PAGE_AXIS);
|
||||
setLayout(box);
|
||||
@@ -44,17 +68,224 @@ public class PropertiesPanel extends JPanel {
|
||||
propPanel.add(propLabel);
|
||||
add(propPanel);
|
||||
|
||||
// NAME
|
||||
JPanel namePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||
nameLabel = new JLabel("No Selection");
|
||||
nameLabel.setFont(new Font("Segoe UI", Font.PLAIN, 20));
|
||||
namePanel.setPreferredSize(new Dimension(200, 40));
|
||||
namePanel.setMaximumSize(new Dimension(200, 40));
|
||||
namePanel.add(nameLabel);
|
||||
add(namePanel);
|
||||
|
||||
// SPACER
|
||||
add(Box.createRigidArea(spacerDimension));
|
||||
|
||||
// BUTTONS
|
||||
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||
JLabel buttonLabel = new JLabel("Actions");
|
||||
buttonLabel.setFont(new Font("Segoe UI", Font.ITALIC, 20));
|
||||
buttonPanel.setPreferredSize(new Dimension(200, 40));
|
||||
buttonPanel.setMaximumSize(new Dimension(200, 40));
|
||||
buttonPanel.add(buttonLabel);
|
||||
add(buttonPanel);
|
||||
|
||||
//AREA PANEL: AVAILABLE FOR ACTIONLISTENER
|
||||
areaPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||
areaPanel.setVisible(false);
|
||||
rigidArea = Box.createRigidArea(spacerDimension);
|
||||
rigidArea.setVisible(false);
|
||||
|
||||
// BUTTONS ROW 1
|
||||
JPanel row1ButtonPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||
JButton deleteButton = new JButton("Delete");
|
||||
deleteButton.setFont(new Font("Segoe UI", Font.PLAIN, 20));
|
||||
deleteButton.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
if(selectedObject != null)
|
||||
p.removeObject(selectedObject);
|
||||
else if(selectedPath != null) {
|
||||
p.removePath(selectedPath);
|
||||
}
|
||||
}
|
||||
});
|
||||
JButton areaButton = new JButton("Area");
|
||||
areaButton.setFont(new Font("Segoe UI", Font.PLAIN, 20));
|
||||
areaButton.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
areaPanel.setVisible(!areaPanel.isVisible());
|
||||
rigidArea.setVisible(!rigidArea.isVisible());
|
||||
}
|
||||
});
|
||||
row1ButtonPanel.setPreferredSize(new Dimension(200, 50));
|
||||
row1ButtonPanel.setMaximumSize(new Dimension(200, 50));
|
||||
row1ButtonPanel.add(deleteButton);
|
||||
row1ButtonPanel.add(areaButton);
|
||||
add(row1ButtonPanel);
|
||||
|
||||
add(rigidArea);
|
||||
|
||||
//AREA PANEL
|
||||
JLabel areaLabel = new JLabel("Area size");
|
||||
areaLabel.setFont(new Font("Segoe UI", Font.ITALIC, 20));
|
||||
areaPanel.setPreferredSize(new Dimension(200, 180));
|
||||
areaPanel.setMaximumSize(new Dimension(200, 180));
|
||||
areaPanel.add(areaLabel);
|
||||
add(areaPanel);
|
||||
{
|
||||
JPanel areaTopPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||
areaTopPanel.setPreferredSize(new Dimension(200, 30));
|
||||
areaPanel.add(areaTopPanel);
|
||||
|
||||
JLabel areaTopLabel = new JLabel("Top ");
|
||||
areaTopPanel.add(areaTopLabel);
|
||||
areaTopField = new JTextField();
|
||||
areaTopField.setPreferredSize(new Dimension(120, 25));
|
||||
{
|
||||
areaTopField.addKeyListener(new KeyListener()
|
||||
{
|
||||
|
||||
public void keyTyped(KeyEvent e){}
|
||||
|
||||
public void keyReleased(KeyEvent e)
|
||||
{
|
||||
try
|
||||
{
|
||||
areaTopField.setBackground(Color.WHITE);
|
||||
int top = Integer.parseInt(areaTopField.getText());
|
||||
selectedObject.setAreaTop(top);
|
||||
p.update();
|
||||
} catch (NumberFormatException nfe)
|
||||
{
|
||||
areaTopField.setBackground(Color.RED);
|
||||
}
|
||||
}
|
||||
|
||||
public void keyPressed(KeyEvent e){}
|
||||
});
|
||||
}
|
||||
areaTopPanel.add(areaTopField);
|
||||
}
|
||||
{
|
||||
JPanel areaBottomPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||
areaBottomPanel.setPreferredSize(new Dimension(200, 30));
|
||||
areaPanel.add(areaBottomPanel);
|
||||
|
||||
JLabel areaBottomLabel = new JLabel("Bottom");
|
||||
areaBottomPanel.add(areaBottomLabel);
|
||||
areaBottomField = new JTextField();
|
||||
areaBottomField.setPreferredSize(new Dimension(120, 25));
|
||||
{
|
||||
areaBottomField.addKeyListener(new KeyListener()
|
||||
{
|
||||
|
||||
public void keyTyped(KeyEvent e){}
|
||||
|
||||
public void keyReleased(KeyEvent e)
|
||||
{
|
||||
try
|
||||
{
|
||||
areaBottomField.setBackground(Color.WHITE);
|
||||
int bottom = Integer.parseInt(areaBottomField.getText());
|
||||
selectedObject.setAreaBottom(bottom);
|
||||
p.update();
|
||||
} catch (NumberFormatException nfe)
|
||||
{
|
||||
areaBottomField.setBackground(Color.RED);
|
||||
}
|
||||
}
|
||||
|
||||
public void keyPressed(KeyEvent e){}
|
||||
});
|
||||
}
|
||||
areaBottomPanel.add(areaBottomField);
|
||||
}
|
||||
{
|
||||
JPanel areaLeftPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||
areaLeftPanel.setPreferredSize(new Dimension(200, 30));
|
||||
areaPanel.add(areaLeftPanel);
|
||||
|
||||
JLabel areaLeftLabel = new JLabel("Left ");
|
||||
areaLeftPanel.add(areaLeftLabel);
|
||||
areaLeftField = new JTextField();
|
||||
areaLeftField.setPreferredSize(new Dimension(120, 25));
|
||||
{
|
||||
areaLeftField.addKeyListener(new KeyListener()
|
||||
{
|
||||
|
||||
public void keyTyped(KeyEvent e){}
|
||||
|
||||
public void keyReleased(KeyEvent e)
|
||||
{
|
||||
try
|
||||
{
|
||||
areaLeftField.setBackground(Color.WHITE);
|
||||
int left = Integer.parseInt(areaLeftField.getText());
|
||||
selectedObject.setAreaLeft(left);
|
||||
p.update();
|
||||
} catch (NumberFormatException nfe)
|
||||
{
|
||||
areaLeftField.setBackground(Color.RED);
|
||||
}
|
||||
}
|
||||
|
||||
public void keyPressed(KeyEvent e){}
|
||||
});
|
||||
}
|
||||
areaLeftPanel.add(areaLeftField);
|
||||
}
|
||||
{
|
||||
JPanel areaRightPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||
areaRightPanel.setPreferredSize(new Dimension(200, 30));
|
||||
areaPanel.add(areaRightPanel);
|
||||
|
||||
JLabel areaRightLabel = new JLabel("Right ");
|
||||
areaRightPanel.add(areaRightLabel);
|
||||
areaRightField = new JTextField();
|
||||
areaRightField.setPreferredSize(new Dimension(120, 25));
|
||||
{
|
||||
areaRightField.addKeyListener(new KeyListener()
|
||||
{
|
||||
|
||||
public void keyTyped(KeyEvent e){}
|
||||
|
||||
public void keyReleased(KeyEvent e)
|
||||
{
|
||||
try
|
||||
{
|
||||
areaRightField.setBackground(Color.WHITE);
|
||||
int right = Integer.parseInt(areaRightField.getText());
|
||||
selectedObject.setAreaRight(right);
|
||||
p.update();
|
||||
} catch (NumberFormatException nfe)
|
||||
{
|
||||
areaRightField.setBackground(Color.RED);
|
||||
}
|
||||
}
|
||||
|
||||
public void keyPressed(KeyEvent e){}
|
||||
});
|
||||
}
|
||||
areaRightPanel.add(areaRightField);
|
||||
}
|
||||
|
||||
// SPACER
|
||||
add(Box.createRigidArea(spacerDimension));
|
||||
|
||||
// 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.setPreferredSize(new Dimension(200, 110));
|
||||
locationPanel.setMaximumSize(new Dimension(200, 110));
|
||||
locationPanel.add(locationLabel);
|
||||
add(locationPanel);
|
||||
{
|
||||
JPanel locationXPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||
locationXPanel.setPreferredSize(new Dimension(200, 50));
|
||||
locationXPanel.setPreferredSize(new Dimension(200, 30));
|
||||
locationPanel.add(locationXPanel);
|
||||
|
||||
JLabel locationXLabel = new JLabel("X");
|
||||
@@ -62,27 +293,29 @@ public class PropertiesPanel extends JPanel {
|
||||
locationXField = new JTextField();
|
||||
locationXField.setPreferredSize(new Dimension(150, 25));
|
||||
{
|
||||
locationXField.addKeyListener(new KeyListener() {
|
||||
locationXField.addKeyListener(new KeyListener()
|
||||
{
|
||||
|
||||
public void keyTyped(KeyEvent e) {
|
||||
public void keyTyped(KeyEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
try {
|
||||
public void keyReleased(KeyEvent e)
|
||||
{
|
||||
try
|
||||
{
|
||||
locationXField.setBackground(Color.WHITE);
|
||||
double xpos = Double.parseDouble(locationXField
|
||||
.getText());
|
||||
selectedObject.setPosition(new Point2D.Double(xpos,
|
||||
selectedObject.getPosition().getY()));
|
||||
double xpos = Double.parseDouble(locationXField.getText());
|
||||
selectedObject.setPosition(new Point2D.Double(xpos, selectedObject.getPosition().getY()));
|
||||
p.update();
|
||||
} catch (NumberFormatException nfe) {
|
||||
} catch (NumberFormatException nfe)
|
||||
{
|
||||
locationXField.setBackground(Color.RED);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void keyReleased(KeyEvent e) {
|
||||
}
|
||||
|
||||
public void keyPressed(KeyEvent e) {
|
||||
public void keyPressed(KeyEvent e)
|
||||
{
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -90,7 +323,7 @@ public class PropertiesPanel extends JPanel {
|
||||
}
|
||||
{
|
||||
JPanel locationYPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||
locationYPanel.setPreferredSize(new Dimension(200, 50));
|
||||
locationYPanel.setPreferredSize(new Dimension(200, 30));
|
||||
locationPanel.add(locationYPanel);
|
||||
|
||||
JLabel locationYLabel = new JLabel("Y");
|
||||
@@ -98,28 +331,32 @@ public class PropertiesPanel extends JPanel {
|
||||
locationYField = new JTextField();
|
||||
locationYField.setPreferredSize(new Dimension(150, 25));
|
||||
{
|
||||
locationYField.addKeyListener(new KeyListener() {
|
||||
locationYField.addKeyListener(new KeyListener()
|
||||
{
|
||||
|
||||
public void keyTyped(KeyEvent e) {
|
||||
try {
|
||||
public void keyTyped(KeyEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
public void keyReleased(KeyEvent e)
|
||||
{
|
||||
try
|
||||
{
|
||||
locationYField.setBackground(Color.WHITE);
|
||||
double ypos = Double.parseDouble(locationYField
|
||||
.getText());
|
||||
selectedObject.setPosition(new Point2D.Double(
|
||||
selectedObject.getPosition().getX(), ypos));
|
||||
double ypos = Double.parseDouble(locationYField.getText());
|
||||
selectedObject.setPosition(new Point2D.Double(selectedObject.getPosition().getX(), ypos));
|
||||
;
|
||||
p.update();
|
||||
} catch (NumberFormatException nfe) {
|
||||
} catch (NumberFormatException nfe)
|
||||
{
|
||||
|
||||
locationYField.setBackground(Color.RED);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void keyReleased(KeyEvent e) {
|
||||
}
|
||||
|
||||
public void keyPressed(KeyEvent e) {
|
||||
public void keyPressed(KeyEvent e)
|
||||
{
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -130,13 +367,13 @@ public class PropertiesPanel extends JPanel {
|
||||
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.setPreferredSize(new Dimension(200, 70));
|
||||
scalePanel.setMaximumSize(new Dimension(200, 70));
|
||||
scalePanel.add(scaleLabel);
|
||||
add(scalePanel);
|
||||
{
|
||||
JPanel scalePanel2 = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||
scalePanel2.setPreferredSize(new Dimension(200, 50));
|
||||
scalePanel2.setPreferredSize(new Dimension(200, 30));
|
||||
scalePanel.add(scalePanel2);
|
||||
|
||||
JLabel scale2Label = new JLabel(" ");
|
||||
@@ -144,26 +381,29 @@ public class PropertiesPanel extends JPanel {
|
||||
scaleField = new JTextField();
|
||||
scaleField.setPreferredSize(new Dimension(150, 25));
|
||||
{
|
||||
scaleField.addKeyListener(new KeyListener() {
|
||||
scaleField.addKeyListener(new KeyListener()
|
||||
{
|
||||
|
||||
public void keyTyped(KeyEvent e) {
|
||||
public void keyTyped(KeyEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
try {
|
||||
public void keyReleased(KeyEvent e)
|
||||
{
|
||||
try
|
||||
{
|
||||
scaleField.setBackground(Color.WHITE);
|
||||
double scale = Double.parseDouble(scaleField
|
||||
.getText());
|
||||
double scale = Double.parseDouble(scaleField.getText());
|
||||
selectedObject.setScale(scale);
|
||||
p.update();
|
||||
} catch (NumberFormatException nfe) {
|
||||
} catch (NumberFormatException nfe)
|
||||
{
|
||||
scaleField.setBackground(Color.RED);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void keyReleased(KeyEvent e) {
|
||||
}
|
||||
|
||||
public void keyPressed(KeyEvent e) {
|
||||
public void keyPressed(KeyEvent e)
|
||||
{
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -174,13 +414,13 @@ public class PropertiesPanel extends JPanel {
|
||||
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.setPreferredSize(new Dimension(200, 80));
|
||||
rotationPanel.setMaximumSize(new Dimension(200, 80));
|
||||
rotationPanel.add(rotationLabel);
|
||||
add(rotationPanel);
|
||||
{
|
||||
JPanel rotationPanel2 = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||
rotationPanel2.setPreferredSize(new Dimension(200, 50));
|
||||
rotationPanel2.setPreferredSize(new Dimension(200, 30));
|
||||
rotationPanel.add(rotationPanel2);
|
||||
|
||||
JLabel rotation2Label = new JLabel(" ");
|
||||
@@ -188,27 +428,30 @@ public class PropertiesPanel extends JPanel {
|
||||
rotationField = new JTextField();
|
||||
rotationField.setPreferredSize(new Dimension(150, 25));
|
||||
{
|
||||
rotationField.addKeyListener(new KeyListener() {
|
||||
rotationField.addKeyListener(new KeyListener()
|
||||
{
|
||||
|
||||
public void keyTyped(KeyEvent e) {
|
||||
public void keyTyped(KeyEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
try {
|
||||
public void keyReleased(KeyEvent e)
|
||||
{
|
||||
try
|
||||
{
|
||||
rotationField.setBackground(Color.WHITE);
|
||||
int rotation = Integer.parseInt(rotationField
|
||||
.getText()) % 360;
|
||||
int rotation = Integer.parseInt(rotationField.getText()) % 360;
|
||||
rotationField.setText(rotation + "");
|
||||
selectedObject.setRotation(rotation);
|
||||
p.update();
|
||||
} catch (NumberFormatException nfe) {
|
||||
} catch (NumberFormatException nfe)
|
||||
{
|
||||
rotationField.setBackground(Color.RED);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void keyReleased(KeyEvent e) {
|
||||
}
|
||||
|
||||
public void keyPressed(KeyEvent e) {
|
||||
public void keyPressed(KeyEvent e)
|
||||
{
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -216,79 +459,111 @@ public class PropertiesPanel extends JPanel {
|
||||
}
|
||||
|
||||
// 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);
|
||||
add(Box.createRigidArea(spacerDimension));
|
||||
|
||||
// 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);
|
||||
// AGENDA
|
||||
JPanel agendaPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||
JLabel agendaLabel = new JLabel("Agenda");
|
||||
agendaLabel.setFont(new Font("Segoe UI", Font.ITALIC, 20));
|
||||
agendaPanel.setPreferredSize(new Dimension(200, 100));
|
||||
agendaPanel.setMaximumSize(new Dimension(200, 100));
|
||||
agendaPanel.add(agendaLabel);
|
||||
add(agendaPanel);
|
||||
|
||||
enableComponents(this, false);
|
||||
}
|
||||
|
||||
public void setSelected(DrawObject drOb) {
|
||||
public void setSelected(DrawObject drOb)
|
||||
{
|
||||
selectedObject = drOb;
|
||||
selectedPath = null;
|
||||
fillFields();
|
||||
enableComponents(this, true);
|
||||
}
|
||||
|
||||
public void clearSelected() {
|
||||
public void clearSelected()
|
||||
{
|
||||
enableComponents(this, false);
|
||||
clearFields(this);
|
||||
selectedObject = null;
|
||||
selectedPath = null;
|
||||
}
|
||||
|
||||
public void update() {
|
||||
fillFields();
|
||||
public void update()
|
||||
{
|
||||
if(selectedObject != null)
|
||||
fillFields();
|
||||
}
|
||||
|
||||
private void enableComponents(Container container, boolean enable) {
|
||||
private void enableComponents(Container container, boolean enable)
|
||||
{
|
||||
Component[] components = container.getComponents();
|
||||
for (Component component : components) {
|
||||
for (Component component : components)
|
||||
{
|
||||
component.setEnabled(enable);
|
||||
if (component instanceof Container) {
|
||||
if (component instanceof Container)
|
||||
{
|
||||
enableComponents((Container) component, enable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void clearFields(Container container) {
|
||||
private void clearFields(Container container)
|
||||
{
|
||||
Component[] components = container.getComponents();
|
||||
for (Component component : components) {
|
||||
if (component instanceof JTextField) {
|
||||
for (Component component : components)
|
||||
{
|
||||
if (component instanceof JTextField)
|
||||
{
|
||||
((JTextField) component).setText("");
|
||||
((JTextField) component).setBackground(Color.WHITE);
|
||||
|
||||
}
|
||||
if (component instanceof Container) {
|
||||
if (component instanceof Container)
|
||||
{
|
||||
clearFields((Container) component);
|
||||
}
|
||||
}
|
||||
|
||||
nameLabel.setText("No Selection");
|
||||
areaPanel.setVisible(false);
|
||||
rigidArea.setVisible(false);
|
||||
}
|
||||
|
||||
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)
|
||||
+ "");
|
||||
}
|
||||
private void fillFields()
|
||||
{
|
||||
|
||||
nameLabel.setText(selectedObject.getName());
|
||||
|
||||
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) + "");
|
||||
|
||||
areaTopField.setText(selectedObject.getAreaTop() + "");
|
||||
areaBottomField.setText(selectedObject.getAreaBottom() + "");
|
||||
areaLeftField.setText(selectedObject.getAreaLeft() + "");
|
||||
areaRightField.setText(selectedObject.getAreaRight() + "");
|
||||
|
||||
}
|
||||
|
||||
public void setPanel(Panel p) {
|
||||
public void setPanel(Panel p)
|
||||
{
|
||||
this.p = p;
|
||||
}
|
||||
}
|
||||
|
||||
public void setSelectedPath(Path path) {
|
||||
selectedObject = null;
|
||||
selectedPath = path;
|
||||
fillPathFields();
|
||||
}
|
||||
|
||||
private void fillPathFields() {
|
||||
nameLabel.setText("Path");
|
||||
enableComponents(this, true);
|
||||
locationXField.setEnabled(false);
|
||||
locationYField.setEnabled(false);
|
||||
scaleField.setEnabled(false);
|
||||
rotationField.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user