repositories
/
Persons_Comparator.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Go back to JList on the EyeView, JComboBox will be used somewhere else.
[Persons_Comparator.git]
/
src
/
MainWindowsView.java
diff --git
a/src/MainWindowsView.java
b/src/MainWindowsView.java
index bc7951152f608bfdd4f8633efc2a9b99120cc8f1..0b89d5d44868d5e267c28ae68919018251f3f0fe 100644
(file)
--- a/
src/MainWindowsView.java
+++ b/
src/MainWindowsView.java
@@
-5,7
+5,8
@@
import java.awt.event.ActionListener;
import java.util.ArrayList;
public class MainWindowsView extends JFrame {
import java.util.ArrayList;
public class MainWindowsView extends JFrame {
- MainWindowsView(String title) {
+
+ MainWindowsView(String title, JPanel panel) {
//Create and set up the window.
setTitle(title);
setSize(300, 300);
//Create and set up the window.
setTitle(title);
setSize(300, 300);
@@
-25,18
+26,10
@@
public class MainWindowsView extends JFrame {
});
fileMenu.add(exit);
});
fileMenu.add(exit);
- //Main pane
- JPanel panel = new PersonView();
-
- //Get all Swing/AWT primitive components in the views and add them to the panel.
+ //Get all Swing/AWT JPanel in the views and add them to the main panel.
ArrayList<Component> components = new ArrayList<>();
for (int i = 0; i < panel.getComponentCount(); i++) {
ArrayList<Component> components = new ArrayList<>();
for (int i = 0; i < panel.getComponentCount(); i++) {
- if ((panel.getComponent(i) instanceof Container)) {
- Container subContainer = (Container) panel.getComponent(i);
- for (int j = 0; j < subContainer.getComponentCount(); j++) {
- components.add(subContainer.getComponent(j));
- }
- }
+ components.add(panel.getComponent(i));
}
for (Component component : components) {
panel.add(component);
}
for (Component component : components) {
panel.add(component);
@@
-56,5
+49,4
@@
public class MainWindowsView extends JFrame {
//this.pack();
this.setVisible(true);
}
//this.pack();
this.setVisible(true);
}
-
}
\ No newline at end of file
}
\ No newline at end of file