Skip to content

Commit

Permalink
Fix 1 (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgrothe committed Aug 10, 2024
1 parent 50a71a8 commit a035f38
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/main/java/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ public void close() throws Exception {
System.out.println("Closing connection to: " + account.host());
if (emailFolder != null) {
emailFolder.close();
emailFolder = null;
}
if (emailStore != null) {
emailStore.close();
emailStore = null;
}
}
}
Expand Down Expand Up @@ -146,12 +148,8 @@ private static List<Account> getAccounts() {
static class MultiLineTableModel extends AbstractTableModel {
private final List<String[]> data = new ArrayList<>();

public void addRow(Message message) {
try {
data.add(new String[] {getDate(message), getFrom(message), getSubject(message)});
} catch (Exception e) {
throw new RuntimeException(e);
}
public void addRow(Message message) throws Exception {
data.add(new String[] {getDate(message), getFrom(message), getSubject(message)});
fireTableDataChanged();
}

Expand Down Expand Up @@ -230,7 +228,7 @@ private void updateLastIndex() {
}

private static Map<Account, List<Message>> messages = new LinkedHashMap<>();
private static int max_mails = 6;
private static volatile int max_mails = 6;

private static String getDate(Message message) throws Exception {
return message.getSentDate().toString();
Expand Down Expand Up @@ -315,18 +313,18 @@ private static void createGUI() {
.addDocumentListener(
new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
upd();
update();
}

public void removeUpdate(DocumentEvent e) {
upd();
update();
}

public void insertUpdate(DocumentEvent e) {
upd();
update();
}

public void upd() {
public void update() {
String s = maxField.getText();
if (!s.isBlank()) {
try {
Expand Down Expand Up @@ -398,7 +396,7 @@ public void windowClosing(WindowEvent e) {

public static void main(String[] args) {
try {
createGUI();
SwingUtilities.invokeLater(Main::createGUI);
} catch (Exception e) {
JOptionPane.showMessageDialog(
null,
Expand Down

0 comments on commit a035f38

Please sign in to comment.