StudenMangament System

master
obai 2024-10-01 14:33:16 +02:00
parent c42b14f39a
commit e947031e9e
7 changed files with 321 additions and 9 deletions

View File

@ -0,0 +1,139 @@
package GUIAnwendungen.StudentManagementSystem;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.Color;
import javax.swing.JLabel;
import javax.swing.JButton;
import javax.swing.JTextField;
import javax.swing.JToggleButton;
import javax.swing.JList;
import javax.swing.AbstractListModel;
import javax.swing.JRadioButton;
import javax.swing.ListSelectionModel;
public class Login_Student extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel contentPane;
private JTextField eingabeID;
private JTextField eingabeName;
private JTextField eingabeVorname;
private JTextField einagbeGeburtstag;
private JTextField eingabeTeleN;
private JTextField eingabeAdresse;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Login_Student frame = new Login_Student();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public Login_Student() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 617, 421);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JPanel panel = new JPanel();
panel.setBackground(new Color(98, 160, 234));
panel.setBounds(12, 28, 244, 381);
contentPane.add(panel);
panel.setLayout(null);
JLabel studentId = new JLabel("ID: ");
studentId.setBounds(12, 12, 77, 17);
panel.add(studentId);
JLabel name = new JLabel("Name: ");
name.setBounds(12, 52, 98, 17);
panel.add(name);
JLabel geburtstag = new JLabel("Geburtstag: ");
geburtstag.setBounds(12, 130, 98, 17);
panel.add(geburtstag);
JLabel geschlecht = new JLabel("Geschlecht:");
geschlecht.setBounds(12, 170, 98, 17);
panel.add(geschlecht);
JLabel tele = new JLabel("TeleN: ");
tele.setBounds(12, 212, 60, 17);
panel.add(tele);
JLabel adresse = new JLabel("Adresse: ");
adresse.setBounds(12, 251, 60, 17);
panel.add(adresse);
JLabel vorname = new JLabel("Vorname: ");
vorname.setBounds(12, 91, 98, 17);
panel.add(vorname);
JButton insertStudent = new JButton("Insert");
insertStudent.setBounds(5, 294, 105, 27);
panel.add(insertStudent);
JButton updateStudent = new JButton("Update");
updateStudent.setBounds(127, 294, 105, 27);
panel.add(updateStudent);
eingabeID = new JTextField();
eingabeID.setBounds(118, 10, 114, 21);
panel.add(eingabeID);
eingabeID.setColumns(10);
eingabeName = new JTextField();
eingabeName.setColumns(10);
eingabeName.setBounds(118, 50, 114, 21);
panel.add(eingabeName);
eingabeVorname = new JTextField();
eingabeVorname.setColumns(10);
eingabeVorname.setBounds(118, 89, 114, 21);
panel.add(eingabeVorname);
einagbeGeburtstag = new JTextField();
einagbeGeburtstag.setColumns(10);
einagbeGeburtstag.setBounds(118, 128, 114, 21);
panel.add(einagbeGeburtstag);
eingabeTeleN = new JTextField();
eingabeTeleN.setColumns(10);
eingabeTeleN.setBounds(118, 210, 114, 21);
panel.add(eingabeTeleN);
eingabeAdresse = new JTextField();
eingabeAdresse.setColumns(10);
eingabeAdresse.setBounds(118, 249, 114, 21);
panel.add(eingabeAdresse);
JList list = new JList();
list.setValueIsAdjusting(true);
list.setBounds(127, 169, 1, 1);
panel.add(list);
JList geshlechtAuswaehlen = new JList();
geshlechtAuswaehlen.setToolTipText("");
geshlechtAuswaehlen.setBounds(118, 170, 114, 17);
panel.add(geshlechtAuswaehlen);
}
}

View File

@ -0,0 +1,20 @@
package GUIAnwendungen.StudentManagementSystem;
public class Main {
public static void main(String[] args) {
Student st = new Student.StudenBuilder()
.setName("Albek")
.setVorname("Obai")
.setAdresse("Gärtnerstr.25")
.setEmail("Obai@gmail.com")
.setGeburtstag("01.01.2001")
.setGeschlecht('M')
.setTele("00493213213")
.setId(100)
.build();
}
}

View File

@ -0,0 +1,87 @@
package GUIAnwendungen.StudentManagementSystem;
public class Student {
private String name;
private String vorname;
private char geschlecht;
private String email;
private String tele;
private String adresse;
private String geburtstag;
private int id;
private Student(StudenBuilder student) {
this.name = student.name;
this.vorname = student.vorname;
this.geschlecht = student.geschlecht;
this.email = student.email;
this.tele = student.tele;
this.adresse = student.adresse;
this.geburtstag = student.geburtstag;
this.id = student.id;
}
public static class StudenBuilder {
private String name;
private String vorname;
private char geschlecht;
private String email;
private String tele;
private String adresse;
private String geburtstag;
private int id;
public StudenBuilder setName(String name) {
this.name = name;
return this;
}
public StudenBuilder setVorname(String vorname) {
this.vorname = vorname;
return this;
}
public StudenBuilder setGeschlecht(char geschlecht) {
this.geschlecht = geschlecht;
return this;
}
public StudenBuilder setEmail(String email) {
this.email = email;
return this;
}
public StudenBuilder setTele(String tele) {
this.tele = tele;
return this;
}
public StudenBuilder setAdresse(String adresse) {
this.adresse = adresse;
return this;
}
public StudenBuilder setGeburtstag(String geburtstag) {
this.geburtstag = geburtstag;
return this;
}
public StudenBuilder setId(int id) {
this.id = id;
return this;
}
public Student build() {
return new Student(this);
}
}
@Override
public String toString() {
return "Student [name=" + name + ", vorname=" + vorname + ", geschlecht=" + geschlecht + ", email=" + email
+ ", tele=" + tele + ", adresse=" + adresse + ", geburtstag=" + geburtstag + ", id=" + id + "]";
}
}

View File

@ -0,0 +1,21 @@
package VorlesungsFolien;
import java.util.ArrayList;
public class Gebäude {
private ArrayList<Hörsaal> räume = new ArrayList<>();
public int berechneGesamtzahlPlätze() {
int plätze = 0;
for (Hörsaal h : this.räume)
plätze += h.getPlätze();
return plätze;
}
public void addHörsaal(Hörsaal hs) {
this.räume.add(hs);
}
}

View File

@ -0,0 +1,20 @@
package VorlesungsFolien;
public class Hörsaal {
private int plätze;
private String name;
Hörsaal(String name, int plätze) {
this.name = name;
this.plätze = plätze;
}
public int getPlätze() {
return plätze;
}
public String getName() {
return name;
}
}

View File

@ -0,0 +1,14 @@
package VorlesungsFolien;
public class Main {
public static void main(String[] args) {
Gebäude a = new Gebäude();
a.addHörsaal(new Hörsaal("A210",50));
a.addHörsaal(new Hörsaal("A212",40));
System.out.println(a.berechneGesamtzahlPlätze());
}
}

View File

@ -1,6 +1,8 @@
package Übungen.MyChat_App;
import java.util.ArrayList;
import java.util.Scanner;
public class ChatRom {
@ -17,10 +19,8 @@ public class ChatRom {
}
public void zeigeChatHistorie() {
System.out.println("Chatverlauf:");
for (String message : saveMessagesBetweenUsers)
System.out.println(message);
for (String s : saveMessagesBetweenUsers)
System.out.println(s);
}
public static void main(String[] args) {
@ -29,10 +29,21 @@ public class ChatRom {
ChatRom chatRoom = new ChatRom();
chatRoom.sendeNachricht(obai, omar, "Hallo Omar, wie geht es dir?");
Scanner textEingabe = new Scanner(System.in);
String message;
while (true) {
System.out.print("> ");
message = textEingabe.nextLine();
chatRoom.sendeNachricht(obai, omar, message);
chatRoom.zeigeChatHistorie();
chatRoom.sendeNachricht(omar, obai, "Mir geht's gut, Obai. Danke!");
System.out.print("> ");
message = textEingabe.nextLine();
chatRoom.sendeNachricht(omar, obai, message);
chatRoom.zeigeChatHistorie();
}
}
}