|
@@ -0,0 +1,64 @@
|
|
|
+package ui.view;
|
|
|
+
|
|
|
+import java.awt.BorderLayout;
|
|
|
+
|
|
|
+import javax.swing.JDialog;
|
|
|
+import javax.swing.JPanel;
|
|
|
+import javax.swing.border.EmptyBorder;
|
|
|
+import javax.swing.JCheckBox;
|
|
|
+import javax.swing.JButton;
|
|
|
+import java.awt.event.ActionListener;
|
|
|
+import java.awt.event.ActionEvent;
|
|
|
+
|
|
|
+public class ShowedInformationPopUp extends JDialog{
|
|
|
+ private final JPanel contentPanel = new JPanel();
|
|
|
+ private final JButton btnOk = new JButton("OK");
|
|
|
+ private MyCanvas canvas;
|
|
|
+ private JCheckBox objectEnergyCheckbox;
|
|
|
+ private JCheckBox connectionCheckbox;
|
|
|
+
|
|
|
+ public ShowedInformationPopUp(MyCanvas canvas){
|
|
|
+ super((java.awt.Frame) null, true);
|
|
|
+ setModalityType(java.awt.Dialog.ModalityType.APPLICATION_MODAL);
|
|
|
+ this.setTitle("Edit Showed Informations");
|
|
|
+ setBounds(100, 100, 277, 169);
|
|
|
+ getContentPane().setLayout(new BorderLayout());
|
|
|
+ contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
|
|
|
+ getContentPane().add(contentPanel, BorderLayout.CENTER);
|
|
|
+ contentPanel.setLayout(null);
|
|
|
+ this.canvas = canvas;
|
|
|
+
|
|
|
+ objectEnergyCheckbox = new JCheckBox("Show Total Energy of Objects");
|
|
|
+ objectEnergyCheckbox.setBounds(19, 19, 181, 23);
|
|
|
+ contentPanel.add(objectEnergyCheckbox);
|
|
|
+
|
|
|
+ connectionCheckbox = new JCheckBox("Show Connection Properties");
|
|
|
+ connectionCheckbox.setBounds(19, 57, 181, 23);
|
|
|
+ contentPanel.add(connectionCheckbox);
|
|
|
+
|
|
|
+ objectEnergyCheckbox.setSelected(canvas.getShowedInformation()[1]);
|
|
|
+ connectionCheckbox.setSelected(canvas.getShowedInformation()[0]);
|
|
|
+ btnOk.addActionListener(new ActionListener() {
|
|
|
+ public void actionPerformed(ActionEvent arg0) {
|
|
|
+ setInformation(connectionCheckbox.isSelected(), objectEnergyCheckbox.isSelected());
|
|
|
+ dispose();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ btnOk.setBounds(169, 98, 82, 23);
|
|
|
+ contentPanel.add(btnOk);
|
|
|
+
|
|
|
+ JButton btnCancel = new JButton("Cancel");
|
|
|
+ btnCancel.setActionCommand("Cancel");
|
|
|
+ btnCancel.addActionListener(new ActionListener() {
|
|
|
+ public void actionPerformed(ActionEvent arg0) {
|
|
|
+ dispose();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ btnCancel.setBounds(70, 98, 89, 23);
|
|
|
+ contentPanel.add(btnCancel);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void setInformation(boolean connection, boolean object){
|
|
|
+ canvas.setShowedInformation(connection, object);
|
|
|
+ }
|
|
|
+}
|