Created buffered Reader, edited it so that it uses the first two parts of a line to determine which section it is to be in.

This commit is contained in:
bobbert committed 2025-04-02 14:24:17 +01:00
1 parent e48e5305f3
commit faeab294c0
3 files changed
+51 -21

No files matched your search

+20 -10
View File
@@ -12,17 +12,22 @@ public class MainViewer {
public MainViewer() {
userGroup = UserGroup.getInstance();
// Create the main frame
JFrame viewer = new JFrame("CV Builder");
viewer.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
viewer.setSize(800, 500);
viewer.setVisible(true);
// Create menu bar
JMenuBar menuBar = new JMenuBar();
JMenu menu = new JMenu("File");
JMenu menu = new JMenu("Menu");
menuBar.add(menu);
viewer.setJMenuBar(menuBar);
// Add content to the frame
populateMainPanel(viewer);
// Make the frame visible after all content is added
viewer.setVisible(true);
}
public void populateMainPanel(JFrame viewer) {
@@ -60,7 +65,8 @@ public class MainViewer {
contactT.addTab("Address", address);
outer.addTab("Contact", contactT);
viewer.add(outer);
viewer.getContentPane().add(outer);
viewer.revalidate();
}
private void populatePanel(JPanel panel) {
@@ -68,14 +74,18 @@ public class MainViewer {
ButtonGroup group = new ButtonGroup();
String panelName = panel.getName();
if (userGroup.getUsers().isEmpty()) {
panel.add(new JLabel("No users available"));
return;
}
for (User user : userGroup.getUsers()) {
JRadioButton radioButton = new JRadioButton(user.getUserAttribute(panelName));
group.add(radioButton);
panel.add(radioButton);
String value = user.getUserAttribute(panelName);
if (value != null && !value.isEmpty()) {
JRadioButton radioButton = new JRadioButton(value);
group.add(radioButton);
panel.add(radioButton);
}
}
}
public static void main(String[] args) {
SwingUtilities.invokeLater(MainViewer::new);
}
}