From 4e2df3e216cf8ddef8ce6fda3342f886dc705426 Mon Sep 17 00:00:00 2001
From: Etudiant Master SESI <irina.lee@etu.upmc.fr>
Date: Thu, 21 Jun 2018 11:15:09 +0200
Subject: [PATCH] added dynamic size in jdialog

---
 src/main/java/ui/window/JDialogELNComponentCapacitor.java    | 5 ++---
 .../JDialogELNComponentCurrentControlledCurrentSource.java   | 5 ++---
 .../JDialogELNComponentCurrentControlledVoltageSource.java   | 5 ++---
 src/main/java/ui/window/JDialogELNComponentGyrator.java      | 5 ++---
 .../java/ui/window/JDialogELNComponentIdealTransformer.java  | 5 ++---
 .../window/JDialogELNComponentIndependentCurrentSource.java  | 5 ++---
 .../window/JDialogELNComponentIndependentVoltageSource.java  | 5 ++---
 src/main/java/ui/window/JDialogELNComponentInductor.java     | 5 ++---
 src/main/java/ui/window/JDialogELNComponentNullor.java       | 5 ++---
 src/main/java/ui/window/JDialogELNComponentResistor.java     | 5 ++---
 .../java/ui/window/JDialogELNComponentTransmissionLine.java  | 5 ++---
 .../JDialogELNComponentVoltageControlledCurrentSource.java   | 5 ++---
 .../JDialogELNComponentVoltageControlledVoltageSource.java   | 5 ++---
 13 files changed, 26 insertions(+), 39 deletions(-)

diff --git a/src/main/java/ui/window/JDialogELNComponentCapacitor.java b/src/main/java/ui/window/JDialogELNComponentCapacitor.java
index 877e7da280..180498bb0c 100644
--- a/src/main/java/ui/window/JDialogELNComponentCapacitor.java
+++ b/src/main/java/ui/window/JDialogELNComponentCapacitor.java
@@ -93,7 +93,6 @@ public class JDialogELNComponentCapacitor extends JDialog implements ActionListe
 	public JDialogELNComponentCapacitor(ELNComponentCapacitor _c) {
 		/** Set JDialog **/
 		setTitle("Setting the capacitor");
-		setSize(500, 190);
 		setLocationRelativeTo(null);
 		setVisible(true);
 		setAlwaysOnTop(true);
@@ -275,7 +274,7 @@ public class JDialogELNComponentCapacitor extends JDialog implements ActionListe
 		downPanel.add(cancelButton);
 
 		mainPanel.add(downPanel, BorderLayout.CENTER);
-		
+		pack();
 		this.getRootPane().setDefaultButton(saveCloseButton);
 	}
 
@@ -335,4 +334,4 @@ public class JDialogELNComponentCapacitor extends JDialog implements ActionListe
 			this.dispose();
 		}
 	}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/ui/window/JDialogELNComponentCurrentControlledCurrentSource.java b/src/main/java/ui/window/JDialogELNComponentCurrentControlledCurrentSource.java
index 1aa691c926..e8c8cb6df4 100644
--- a/src/main/java/ui/window/JDialogELNComponentCurrentControlledCurrentSource.java
+++ b/src/main/java/ui/window/JDialogELNComponentCurrentControlledCurrentSource.java
@@ -87,7 +87,6 @@ public class JDialogELNComponentCurrentControlledCurrentSource extends JDialog i
 	public JDialogELNComponentCurrentControlledCurrentSource(ELNComponentCurrentControlledCurrentSource _cccs) {
 		/** Set JDialog **/
 		setTitle("Setting the current controlled current source");
-		setSize(500, 150);
 		setLocationRelativeTo(null);
 		setVisible(true);
 		setAlwaysOnTop(true);
@@ -177,7 +176,7 @@ public class JDialogELNComponentCurrentControlledCurrentSource extends JDialog i
 		downPanel.add(cancelButton);
 
 		mainPanel.add(downPanel, BorderLayout.CENTER);
-		
+		pack();
 		this.getRootPane().setDefaultButton(saveCloseButton);
 	}
 
@@ -210,4 +209,4 @@ public class JDialogELNComponentCurrentControlledCurrentSource extends JDialog i
 			this.dispose();
 		}
 	}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/ui/window/JDialogELNComponentCurrentControlledVoltageSource.java b/src/main/java/ui/window/JDialogELNComponentCurrentControlledVoltageSource.java
index 652b6026e4..8c22a22071 100644
--- a/src/main/java/ui/window/JDialogELNComponentCurrentControlledVoltageSource.java
+++ b/src/main/java/ui/window/JDialogELNComponentCurrentControlledVoltageSource.java
@@ -90,7 +90,6 @@ public class JDialogELNComponentCurrentControlledVoltageSource extends JDialog i
 	public JDialogELNComponentCurrentControlledVoltageSource(ELNComponentCurrentControlledVoltageSource _ccvs) {
 		/** Set JDialog **/
 		setTitle("Setting the current controlled voltage source");
-		setSize(500, 150);
 		setLocationRelativeTo(null);
 		setVisible(true);
 		setAlwaysOnTop(true);
@@ -218,7 +217,7 @@ public class JDialogELNComponentCurrentControlledVoltageSource extends JDialog i
 		downPanel.add(cancelButton);
 
 		mainPanel.add(downPanel, BorderLayout.CENTER);
-		
+		pack();
 		this.getRootPane().setDefaultButton(saveCloseButton);
 	}
 
@@ -252,4 +251,4 @@ public class JDialogELNComponentCurrentControlledVoltageSource extends JDialog i
 			this.dispose();
 		}
 	}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/ui/window/JDialogELNComponentGyrator.java b/src/main/java/ui/window/JDialogELNComponentGyrator.java
index 20c0e17c72..5a34c734e2 100644
--- a/src/main/java/ui/window/JDialogELNComponentGyrator.java
+++ b/src/main/java/ui/window/JDialogELNComponentGyrator.java
@@ -93,7 +93,6 @@ public class JDialogELNComponentGyrator extends JDialog implements ActionListene
 	public JDialogELNComponentGyrator(ELNComponentGyrator _gyrator) {
 		/** Set JDialog **/
 		setTitle("Setting the gyrator");
-		setSize(500, 190);
 		setLocationRelativeTo(null);
 		setVisible(true);
 		setAlwaysOnTop(true);
@@ -275,7 +274,7 @@ public class JDialogELNComponentGyrator extends JDialog implements ActionListene
 		downPanel.add(cancelButton);
 
 		mainPanel.add(downPanel, BorderLayout.CENTER);
-		
+		pack();
 		this.getRootPane().setDefaultButton(saveCloseButton);
 	}
 
@@ -328,4 +327,4 @@ public class JDialogELNComponentGyrator extends JDialog implements ActionListene
 			this.dispose();
 		}
 	}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/ui/window/JDialogELNComponentIdealTransformer.java b/src/main/java/ui/window/JDialogELNComponentIdealTransformer.java
index d6cbf2bd7b..3dea278110 100644
--- a/src/main/java/ui/window/JDialogELNComponentIdealTransformer.java
+++ b/src/main/java/ui/window/JDialogELNComponentIdealTransformer.java
@@ -87,7 +87,6 @@ public class JDialogELNComponentIdealTransformer extends JDialog implements Acti
 	public JDialogELNComponentIdealTransformer(ELNComponentIdealTransformer _idealTransformer) {
 		/** Set JDialog **/
 		setTitle("Setting the ideal transformer");
-		setSize(500, 150);
 		setLocationRelativeTo(null);
 		setVisible(true);
 		setAlwaysOnTop(true);
@@ -177,7 +176,7 @@ public class JDialogELNComponentIdealTransformer extends JDialog implements Acti
 		downPanel.add(cancelButton);
 
 		mainPanel.add(downPanel, BorderLayout.CENTER);
-		
+		pack();
 		this.getRootPane().setDefaultButton(saveCloseButton);
 	}
 
@@ -210,4 +209,4 @@ public class JDialogELNComponentIdealTransformer extends JDialog implements Acti
 			this.dispose();
 		}
 	}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/ui/window/JDialogELNComponentIndependentCurrentSource.java b/src/main/java/ui/window/JDialogELNComponentIndependentCurrentSource.java
index 8465522bc8..723391569a 100644
--- a/src/main/java/ui/window/JDialogELNComponentIndependentCurrentSource.java
+++ b/src/main/java/ui/window/JDialogELNComponentIndependentCurrentSource.java
@@ -99,7 +99,6 @@ public class JDialogELNComponentIndependentCurrentSource extends JDialog impleme
 	public JDialogELNComponentIndependentCurrentSource(ELNComponentIndependentCurrentSource _isource) {
 		/** Set JDialog **/
 		setTitle("Setting the independent current source");
-		setSize(500, 390);
 		setLocationRelativeTo(null);
 		setVisible(true);
 		setAlwaysOnTop(true);
@@ -372,7 +371,7 @@ public class JDialogELNComponentIndependentCurrentSource extends JDialog impleme
 		downPanel.add(cancelButton);
 
 		mainPanel.add(downPanel, BorderLayout.CENTER);
-		
+		pack();
 		this.getRootPane().setDefaultButton(saveCloseButton);
 	}
 
@@ -540,4 +539,4 @@ public class JDialogELNComponentIndependentCurrentSource extends JDialog impleme
 			this.dispose();
 		}
 	}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/ui/window/JDialogELNComponentIndependentVoltageSource.java b/src/main/java/ui/window/JDialogELNComponentIndependentVoltageSource.java
index 88dbcf1169..3ae2e7caff 100644
--- a/src/main/java/ui/window/JDialogELNComponentIndependentVoltageSource.java
+++ b/src/main/java/ui/window/JDialogELNComponentIndependentVoltageSource.java
@@ -99,7 +99,6 @@ public class JDialogELNComponentIndependentVoltageSource extends JDialog impleme
 	public JDialogELNComponentIndependentVoltageSource(ELNComponentIndependentVoltageSource _vsource) {
 		/** Set JDialog **/
 		setTitle("Setting the independent voltage source");
-		setSize(500, 390);
 		setLocationRelativeTo(null);
 		setVisible(true);
 		setAlwaysOnTop(true);
@@ -372,7 +371,7 @@ public class JDialogELNComponentIndependentVoltageSource extends JDialog impleme
 		downPanel.add(cancelButton);
 
 		mainPanel.add(downPanel, BorderLayout.CENTER);
-		
+		pack();
 		this.getRootPane().setDefaultButton(saveCloseButton);
 	}
 
@@ -540,4 +539,4 @@ public class JDialogELNComponentIndependentVoltageSource extends JDialog impleme
 			this.dispose();
 		}
 	}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/ui/window/JDialogELNComponentInductor.java b/src/main/java/ui/window/JDialogELNComponentInductor.java
index 56a3eb9da6..14681319b4 100644
--- a/src/main/java/ui/window/JDialogELNComponentInductor.java
+++ b/src/main/java/ui/window/JDialogELNComponentInductor.java
@@ -93,7 +93,6 @@ public class JDialogELNComponentInductor extends JDialog implements ActionListen
 	public JDialogELNComponentInductor(ELNComponentInductor _l) {
 		/** Set JDialog **/
 		setTitle("Setting the inductor");
-		setSize(500, 190);
 		setLocationRelativeTo(null);
 		setVisible(true);
 		setAlwaysOnTop(true);
@@ -275,7 +274,7 @@ public class JDialogELNComponentInductor extends JDialog implements ActionListen
 		downPanel.add(cancelButton);
 
 		mainPanel.add(downPanel, BorderLayout.CENTER);
-		
+		pack();
 		this.getRootPane().setDefaultButton(saveCloseButton);
 	}
 
@@ -335,4 +334,4 @@ public class JDialogELNComponentInductor extends JDialog implements ActionListen
 			this.dispose();
 		}
 	}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/ui/window/JDialogELNComponentNullor.java b/src/main/java/ui/window/JDialogELNComponentNullor.java
index afd7db66cd..c64b3ab9a5 100644
--- a/src/main/java/ui/window/JDialogELNComponentNullor.java
+++ b/src/main/java/ui/window/JDialogELNComponentNullor.java
@@ -85,7 +85,6 @@ public class JDialogELNComponentNullor extends JDialog implements ActionListener
 	public JDialogELNComponentNullor(ELNComponentNullor _nullor) {
 		/** Set JDialog **/
 		setTitle("Setting the nullor");
-		setSize(500, 120);
 		setLocationRelativeTo(null);
 		setVisible(true);
 		setAlwaysOnTop(true);
@@ -159,7 +158,7 @@ public class JDialogELNComponentNullor extends JDialog implements ActionListener
 		downPanel.add(cancelButton);
 
 		mainPanel.add(downPanel, BorderLayout.CENTER);
-		
+		pack();
 		this.getRootPane().setDefaultButton(saveCloseButton);
 	}
 
@@ -174,4 +173,4 @@ public class JDialogELNComponentNullor extends JDialog implements ActionListener
 			this.dispose();
 		}
 	}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/ui/window/JDialogELNComponentResistor.java b/src/main/java/ui/window/JDialogELNComponentResistor.java
index 66d39a67be..a53f9499da 100644
--- a/src/main/java/ui/window/JDialogELNComponentResistor.java
+++ b/src/main/java/ui/window/JDialogELNComponentResistor.java
@@ -90,7 +90,6 @@ public class JDialogELNComponentResistor extends JDialog implements ActionListen
 	public JDialogELNComponentResistor(ELNComponentResistor _r) {
 		/** Set JDialog **/
 		setTitle("Setting the resistance");
-		setSize(500, 150);
 		setLocationRelativeTo(null);
 		setVisible(true);
 		setAlwaysOnTop(true);
@@ -218,7 +217,7 @@ public class JDialogELNComponentResistor extends JDialog implements ActionListen
 		downPanel.add(cancelButton);
 
 		mainPanel.add(downPanel, BorderLayout.CENTER);
-		
+		pack();
 		this.getRootPane().setDefaultButton(saveCloseButton);
 	}
 
@@ -252,4 +251,4 @@ public class JDialogELNComponentResistor extends JDialog implements ActionListen
 			this.dispose();
 		}
 	}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/ui/window/JDialogELNComponentTransmissionLine.java b/src/main/java/ui/window/JDialogELNComponentTransmissionLine.java
index 8f87b52b6a..8ec0bbac77 100644
--- a/src/main/java/ui/window/JDialogELNComponentTransmissionLine.java
+++ b/src/main/java/ui/window/JDialogELNComponentTransmissionLine.java
@@ -95,7 +95,6 @@ public class JDialogELNComponentTransmissionLine extends JDialog implements Acti
 	public JDialogELNComponentTransmissionLine(ELNComponentTransmissionLine _transmission_line) {
 		/** Set JDialog **/
 		setTitle("Setting the transmission line");
-		setSize(500, 220);
 		setLocationRelativeTo(null);
 		setVisible(true);
 		setAlwaysOnTop(true);
@@ -293,7 +292,7 @@ public class JDialogELNComponentTransmissionLine extends JDialog implements Acti
 		downPanel.add(cancelButton);
 
 		mainPanel.add(downPanel, BorderLayout.CENTER);
-		
+		pack();
 		this.getRootPane().setDefaultButton(saveCloseButton);
 	}
 
@@ -353,4 +352,4 @@ public class JDialogELNComponentTransmissionLine extends JDialog implements Acti
 			this.dispose();
 		}
 	}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/ui/window/JDialogELNComponentVoltageControlledCurrentSource.java b/src/main/java/ui/window/JDialogELNComponentVoltageControlledCurrentSource.java
index f6b4e83046..22b8fdd49a 100644
--- a/src/main/java/ui/window/JDialogELNComponentVoltageControlledCurrentSource.java
+++ b/src/main/java/ui/window/JDialogELNComponentVoltageControlledCurrentSource.java
@@ -90,7 +90,6 @@ public class JDialogELNComponentVoltageControlledCurrentSource extends JDialog i
 	public JDialogELNComponentVoltageControlledCurrentSource(ELNComponentVoltageControlledCurrentSource _vccs) {
 		/** Set JDialog **/
 		setTitle("Setting the voltage controlled current source");
-		setSize(500, 150);
 		setLocationRelativeTo(null);
 		setVisible(true);
 		setAlwaysOnTop(true);
@@ -218,7 +217,7 @@ public class JDialogELNComponentVoltageControlledCurrentSource extends JDialog i
 		downPanel.add(cancelButton);
 
 		mainPanel.add(downPanel, BorderLayout.CENTER);
-		
+		pack();
 		this.getRootPane().setDefaultButton(saveCloseButton);
 	}
 
@@ -252,4 +251,4 @@ public class JDialogELNComponentVoltageControlledCurrentSource extends JDialog i
 			this.dispose();
 		}
 	}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/ui/window/JDialogELNComponentVoltageControlledVoltageSource.java b/src/main/java/ui/window/JDialogELNComponentVoltageControlledVoltageSource.java
index d44c8d38fc..2c2febca11 100644
--- a/src/main/java/ui/window/JDialogELNComponentVoltageControlledVoltageSource.java
+++ b/src/main/java/ui/window/JDialogELNComponentVoltageControlledVoltageSource.java
@@ -87,7 +87,6 @@ public class JDialogELNComponentVoltageControlledVoltageSource extends JDialog i
 	public JDialogELNComponentVoltageControlledVoltageSource(ELNComponentVoltageControlledVoltageSource _vcvs) {
 		/** Set JDialog **/
 		setTitle("Setting the voltage controlled voltage source");
-		setSize(500, 150);
 		setLocationRelativeTo(null);
 		setVisible(true);
 		setAlwaysOnTop(true);
@@ -177,7 +176,7 @@ public class JDialogELNComponentVoltageControlledVoltageSource extends JDialog i
 		downPanel.add(cancelButton);
 
 		mainPanel.add(downPanel, BorderLayout.CENTER);
-		
+		pack();
 		this.getRootPane().setDefaultButton(saveCloseButton);
 	}
 
@@ -210,4 +209,4 @@ public class JDialogELNComponentVoltageControlledVoltageSource extends JDialog i
 			this.dispose();
 		}
 	}
-}
\ No newline at end of file
+}
-- 
GitLab