tasks Zeigen
parent
3826d33c6b
commit
509f9372dd
|
@ -13,6 +13,7 @@ public class GUI_UserInterface extends JFrame {
|
|||
private JButton addTask;
|
||||
private JButton zeigeAlleTasks;
|
||||
private JTextArea AllTasksArea;
|
||||
private JButton clear;
|
||||
|
||||
public GUI_UserInterface() {
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );
|
||||
|
@ -57,6 +58,10 @@ public class GUI_UserInterface extends JFrame {
|
|||
zeigeAlleTasks.setBounds(193, 506, 159, 29);
|
||||
panel.add(zeigeAlleTasks);
|
||||
|
||||
clear = new JButton("Clear TextArea");
|
||||
clear.setBounds(384, 506, 159, 29);
|
||||
panel.add(clear);
|
||||
setLocationRelativeTo(null);
|
||||
this.setVisible(true);
|
||||
|
||||
}
|
||||
|
@ -76,6 +81,14 @@ public class GUI_UserInterface extends JFrame {
|
|||
public void setAllTasksArea(JTextArea allTasksArea) {
|
||||
AllTasksArea = allTasksArea;
|
||||
}
|
||||
public void showInfo(String message) {
|
||||
JOptionPane.showMessageDialog(null, message, "Studen angemeldet", JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
|
||||
public JButton getClear() {
|
||||
return clear;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.awt.*;
|
|||
import javax.swing.*;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.border.LineBorder;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
|
||||
import TodoListApp.Domain.*;
|
||||
|
||||
|
@ -97,6 +96,7 @@ public class GUI_addTask extends JFrame {
|
|||
submitTask = new JButton("Submit");
|
||||
submitTask.setBounds(24, 323, 123, 23);
|
||||
panel.add(submitTask);
|
||||
setLocationRelativeTo(null);
|
||||
}
|
||||
|
||||
public void zeigeFensterAddTask() {
|
||||
|
|
|
@ -8,6 +8,7 @@ public class Userverwalter {
|
|||
private ProgrammSystem system;
|
||||
private GUI_UserInterface user;
|
||||
private GUI_addTask taskHinziFuegenFenster;
|
||||
private int index = 0;
|
||||
|
||||
public Userverwalter() {
|
||||
this.system = new ProgrammSystem();
|
||||
|
@ -34,13 +35,13 @@ public class Userverwalter {
|
|||
});
|
||||
|
||||
user.getZeigeAlleTasks().addActionListener(e -> showAllTasks());
|
||||
user.getClear().addActionListener(e -> clearTextArea());
|
||||
|
||||
}
|
||||
|
||||
public void zeigeFenster() throws FalscheEinagebException {
|
||||
taskHinziFuegenFenster.zeigeFensterAddTask();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void addTask() throws FalscheEinagebException {
|
||||
|
@ -63,9 +64,23 @@ public class Userverwalter {
|
|||
}
|
||||
|
||||
public void showAllTasks() {
|
||||
for (String s : system.showAllTasks()) {
|
||||
user.getAllTasksArea().append(s);
|
||||
if (system.showAllTasks().size() == 0)
|
||||
user.showInfo("Momentan befinden sich keine Taks");
|
||||
|
||||
else if (index >= system.showAllTasks().size())
|
||||
user.showInfo("Es gibt keine Tasks mehr!");
|
||||
|
||||
else {
|
||||
while (index < system.showAllTasks().size()) {
|
||||
user.getAllTasksArea().append(system.showAllTasks().get(index++));
|
||||
user.getAllTasksArea().append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void clearTextArea() {
|
||||
user.getAllTasksArea().setText("");
|
||||
index = 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue