diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..edb389c --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..712ab9d --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..9dc782b --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,12 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/main/java/userprofilebuilder/model/UserProfile.java b/src/main/java/userprofilebuilder/model/UserProfile.java index d3d7c0b..5c2b975 100644 --- a/src/main/java/userprofilebuilder/model/UserProfile.java +++ b/src/main/java/userprofilebuilder/model/UserProfile.java @@ -1,9 +1,13 @@ package userprofilebuilder.model; import javax.swing.*; +import javax.swing.border.TitledBorder; import java.awt.*; import java.awt.event.ActionListener; +import com.sun.tools.javac.Main; +import userprofilebuilder.view.MainViewer; + public class UserProfile { public static void footer(JPanel tab) @@ -20,6 +24,7 @@ public class UserProfile { JButton addProfile = new JButton("Add Profile"); ActionListener adder = e -> { System.out.println("profile add button clicked"); + Adder(); }; addProfile.addActionListener(adder); @@ -32,7 +37,49 @@ public class UserProfile { } + public static void Adder() + { + JPanel panel = new JPanel(); + panel.setLayout(new GridLayout(0,1)); + JTextField JT1 = new JTextField("Enter Profile name"); + JLabel JT11 = new JLabel("Profile:"); + panel.add(JT11); + panel.add(JT1); + + JTextField JT2 = new JTextField("Enter Title"); + JLabel JT21 = new JLabel("Title:"); + panel.add(JT21); + panel.add(JT2); + + JTextField JT3 = new JTextField("Enter Name"); + JLabel JT31 = new JLabel("Name:"); + panel.add(JT31); + panel.add(JT3); + + JTextField JT4 = new JTextField("Enter Email"); + JLabel JT41 = new JLabel("Email:"); + panel.add(JT41); + panel.add(JT4); + + + //JOptionPane pane = new JOptionPane(panel, 3, 2); // content of dialogue box + JOptionPane pane = new JOptionPane(panel, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION); + JDialog dialog = pane.createDialog("Rename Dialogue Box"); // title of dialogue box + dialog.setVisible(true); // changed boiler plate code from .show() to .setVisible(true) because apparently IDE says it's better!! + + // actions. + + int choice = (int) pane.getValue(); + + if (choice == JOptionPane.OK_OPTION) + { + System.out.println("OK option pressed."); + } else if (choice == JOptionPane.CANCEL_OPTION) { + System.out.println("Cancel option pressed."); + dialog.dispose(); + } + } diff --git a/src/main/java/userprofilebuilder/view/MainViewer.java b/src/main/java/userprofilebuilder/view/MainViewer.java index 3e3ac2e..ef48be7 100644 --- a/src/main/java/userprofilebuilder/view/MainViewer.java +++ b/src/main/java/userprofilebuilder/view/MainViewer.java @@ -26,6 +26,8 @@ public class MainViewer { public ArrayList radioButtons = new ArrayList<>(); int TotalRows; + public JTabbedPane JT; + public int a = UserGroup.getLine(file); // this represents a value that is to declare how many rows are to be made -- to be changed by the amount of lines in csv. ROW COUNT @@ -156,7 +158,7 @@ public class MainViewer { - JTabbedPane JT = new JTabbedPane(); + JT = new JTabbedPane(); JMenuBar menuBar = new JMenuBar(); JMenu menu = new JMenu("file"); diff --git a/userprofile.csv b/userprofile.csv index 985bd72..64c2854 100644 --- a/userprofile.csv +++ b/userprofile.csv @@ -1,3 +1,3 @@ User1,Dr,David Livingstone,d.livingstone@kingston.ac.uk -User2,test,Dave Livingstone,dave@googlemail.com +User2,Mr,Dave Livingstone,dave@googlemail.com User3,HRH,DextroseDave,dex@twitter.com \ No newline at end of file