W3R6 – Testing and Updating all the Multi-Tab Functionality

This commit is contained in:
bobbert committed 2025-02-15 22:49:57 +00:00
1 parent 140a0a70d6
commit ef5dd52711
3 files changed
+29 -6

No files matched your search

@@ -116,5 +116,22 @@ public class UserGroup {
return count;
}
public static String getUserRow(int row, String file) {
String text = "";
String[] values = null;
try (BufferedReader br = new BufferedReader(new FileReader(file))) {
for (int i = 0; i < row-1; i++)
br.readLine();
String line = br.readLine();
values = line.split(",");
text = values[0];
return text;
}
catch (Exception e) {
System.out.println("error with reader");
}
return text;
}
}
@@ -34,16 +34,18 @@ public class MainViewer {
int row = count+1;
JPanel RowPanel = new JPanel();
// setting the border title to the correct title
TitledBorder RowTitle;
RowTitle = BorderFactory.createTitledBorder(UserGroup.getUserRow(row, file));
RowPanel.setBorder(RowTitle);
// end of border title code
JRadioButton JR = new JRadioButton(UserGroup.getUser(row, Pname, file));
JButton JEdit = new JButton("Edit");
JButton JDelete = new JButton("Delete");
// setting the border title to the correct title
TitledBorder RowTitle;
RowTitle = BorderFactory.createTitledBorder("User" + row);
RowPanel.setBorder(RowTitle);
// end of border title code
RowPanel.add(JR);
@@ -168,6 +170,7 @@ public class MainViewer {
fileOpen.showSaveDialog(null);
file = (fileOpen.getSelectedFile()).toString();
System.out.println(file);
viewer.repaint();
};
open.addActionListener(opener);
@@ -184,7 +187,7 @@ public class MainViewer {
JMenuItem quit = new JMenuItem("Quit");
menu.add(quit);
ActionListener quitter = e -> {
viewer.dispose();
System.exit(0);
};
quit.addActionListener(quitter);
+3
View File
@@ -0,0 +1,3 @@
User1,Dr,David Livingstone,d.livingstone@kingston.ac.uk
User2,Mr,Dave Livingstone,dave@googlemail.com
User3,HRH,DextroseDave,dex@twitter.com
1 User1 Dr David Livingstone d.livingstone@kingston.ac.uk
2 User2 Mr Dave Livingstone dave@googlemail.com
3 User3 HRH DextroseDave dex@twitter.com