Update
parent
d7836fd17c
commit
7aa59568dc
|
@ -6,7 +6,7 @@
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="src" path="Programmierung2/src"/>
|
<classpathentry kind="src" path="Programmierung2/src"/>
|
||||||
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5">
|
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="module" value="true"/>
|
<attribute name="module" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
package BankSystemGUI;
|
package BankSystemGUI;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
|
||||||
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
|
||||||
class JTest {
|
class JTest {
|
||||||
User obai;
|
User obai;
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
package BinaryTree;
|
package BinaryTree;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
class JuintTeste {
|
class JuintTeste {
|
||||||
|
|
||||||
@Test
|
|
||||||
void test() {
|
void test() {
|
||||||
BinaryBaumList b1 = new BinaryBaumList();
|
BinaryBaumList b1 = new BinaryBaumList();
|
||||||
b1.addElement(15);
|
b1.addElement(15);
|
||||||
|
|
|
@ -3,32 +3,34 @@ package BinaryTree;
|
||||||
public class Test {
|
public class Test {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
BinaryBaumList b1 = new BinaryBaumList();
|
// BinaryBaumList b1 = new BinaryBaumList();
|
||||||
b1.addElement(50);
|
// b1.addElement(50);
|
||||||
b1.addElement(30);
|
// b1.addElement(30);
|
||||||
b1.addElement(70);
|
// b1.addElement(70);
|
||||||
b1.addElement(20);
|
// b1.addElement(20);
|
||||||
b1.addElement(40);
|
// b1.addElement(40);
|
||||||
b1.addElement(60);
|
// b1.addElement(60);
|
||||||
b1.addElement(80);
|
// b1.addElement(80);
|
||||||
b1.addElement(15);
|
// b1.addElement(15);
|
||||||
b1.addElement(22);
|
// b1.addElement(22);
|
||||||
b1.addElement(35);
|
// b1.addElement(35);
|
||||||
b1.addElement(45);
|
// b1.addElement(45);
|
||||||
b1.addElement(21);
|
// b1.addElement(21);
|
||||||
b1.addElement(25);
|
// b1.addElement(25);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// System.out.print("[");
|
||||||
|
// b1.printDepth();
|
||||||
|
// System.out.print("]");
|
||||||
|
// System.out.println();
|
||||||
|
// b1.removNode(30);
|
||||||
|
// System.out.print("[");
|
||||||
|
// b1.printDepth();
|
||||||
|
// System.out.print("]");
|
||||||
|
|
||||||
|
System.out.println('G' > 'F');
|
||||||
|
|
||||||
|
|
||||||
System.out.print("[");
|
|
||||||
b1.printDepth();
|
|
||||||
System.out.print("]");
|
|
||||||
System.out.println();
|
|
||||||
b1.removNode(30);
|
|
||||||
System.out.print("[");
|
|
||||||
b1.printDepth();
|
|
||||||
System.out.print("]");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -2,14 +2,12 @@ package GUIAnwendungen;
|
||||||
|
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.BorderFactory;
|
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JTextField;
|
import javax.swing.JTextField;
|
||||||
import javax.swing.JComboBox;
|
import javax.swing.JComboBox;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
|
@ -30,7 +28,6 @@ public class Jpanel {
|
||||||
|
|
||||||
// و وضعنا له حدود و عنوان Layout Manager لا يستخدم أي Panel هنا قمنا بتعريف
|
// و وضعنا له حدود و عنوان Layout Manager لا يستخدم أي Panel هنا قمنا بتعريف
|
||||||
JPanel panel = new JPanel(null);
|
JPanel panel = new JPanel(null);
|
||||||
panel.setBorder(BorderFactory.createTitledBorder("Add User"));
|
|
||||||
panel.setBounds(50, 30, 290, 300);
|
panel.setBounds(50, 30, 290, 300);
|
||||||
|
|
||||||
// Frame في الـ Panel هنا وضعنا الـ
|
// Frame في الـ Panel هنا وضعنا الـ
|
||||||
|
|
|
@ -9,7 +9,6 @@ import java.awt.Font;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
|
@ -28,7 +27,6 @@ public class Labels {
|
||||||
JLabel label = new JLabel();
|
JLabel label = new JLabel();
|
||||||
|
|
||||||
// Erstelle einen Border für das Fenster
|
// Erstelle einen Border für das Fenster
|
||||||
Border b1 = BorderFactory.createLineBorder(Color.GREEN,5);
|
|
||||||
|
|
||||||
// füge den Text auf dem Fenster hinzu
|
// füge den Text auf dem Fenster hinzu
|
||||||
label.setText("Hall Welt");
|
label.setText("Hall Welt");
|
||||||
|
@ -60,7 +58,6 @@ public class Labels {
|
||||||
label.setOpaque(true);
|
label.setOpaque(true);
|
||||||
|
|
||||||
//zeige den Border auf dem Fenster
|
//zeige den Border auf dem Fenster
|
||||||
label.setBorder(b1);
|
|
||||||
|
|
||||||
|
|
||||||
//füge ein Bild hinzu
|
//füge ein Bild hinzu
|
||||||
|
|
|
@ -2,7 +2,6 @@ package GUIAnwendungen;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
package Hashmap;
|
package Hashmap;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import org.junit.jupiter.api.Test;
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import Hashmap.MyGenericHashMap.Entry;
|
|
||||||
|
|
||||||
class JunitTest {
|
class JunitTest {
|
||||||
private MyGenericHashMap<Integer,String> h1;
|
private MyGenericHashMap<Integer,String> h1;
|
||||||
|
|
|
@ -10,7 +10,7 @@ public class TimerKlasse extends TimerTask {
|
||||||
Timer timer = new Timer();
|
Timer timer = new Timer();
|
||||||
TimerTask task = new TimerKlasse();
|
TimerTask task = new TimerKlasse();
|
||||||
|
|
||||||
timer.schedule(task,1000);
|
timer.schedule(task,5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -96,6 +96,24 @@ public class GUI_addTask extends JFrame {
|
||||||
submitTask = new JButton("Submit");
|
submitTask = new JButton("Submit");
|
||||||
submitTask.setBounds(24, 323, 123, 23);
|
submitTask.setBounds(24, 323, 123, 23);
|
||||||
panel.add(submitTask);
|
panel.add(submitTask);
|
||||||
|
|
||||||
|
JScrollPane scrollPane = new JScrollPane();
|
||||||
|
scrollPane.setBounds(229, 333, 2, 2);
|
||||||
|
panel.add(scrollPane);
|
||||||
|
|
||||||
|
JCheckBox chckbxNewCheckBox = new JCheckBox("New check box");
|
||||||
|
chckbxNewCheckBox.setBounds(148, 383, 97, 23);
|
||||||
|
panel.add(chckbxNewCheckBox);
|
||||||
|
|
||||||
|
JButton resest = new JButton("Reset");
|
||||||
|
resest.setForeground(new Color(64, 0, 128));
|
||||||
|
resest.setFont(new Font("Microsoft Tai Le", Font.BOLD, 14));
|
||||||
|
resest.setBounds(221, 317, 144, 34);
|
||||||
|
panel.add(resest);
|
||||||
|
|
||||||
|
JCheckBox chckbxNewCheckBox_1 = new JCheckBox("New check box");
|
||||||
|
chckbxNewCheckBox_1.setBounds(268, 240, 112, 23);
|
||||||
|
panel.add(chckbxNewCheckBox_1);
|
||||||
setLocationRelativeTo(null);
|
setLocationRelativeTo(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package VorlesungsFolien.Verebung;
|
||||||
|
|
||||||
public class A {
|
public class A {
|
||||||
|
|
||||||
void f() {
|
public void f() {
|
||||||
System.out.println("A");
|
System.out.println("A");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,17 +11,13 @@ public class A {
|
||||||
A a2 = new B();
|
A a2 = new B();
|
||||||
B b = new B();
|
B b = new B();
|
||||||
|
|
||||||
a1.f();
|
|
||||||
// Ausgabe B:
|
|
||||||
// Das passiert aufgrund des Konzepts des Polymorphismus
|
|
||||||
// Dies liegt am Prinzip der dynamischen Bindung
|
|
||||||
a2.f();
|
a2.f();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class B extends A {
|
class B extends A {
|
||||||
|
|
||||||
void f() {
|
public void f() {
|
||||||
System.out.println("B");
|
System.out.println("B");
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -23,7 +23,7 @@ public class Firma {
|
||||||
|
|
||||||
// nein, weil nicht jeder manager ein Geschaeftsfuehrer ist, aber jeder Geschaeftsfuehrer ist ein manager
|
// nein, weil nicht jeder manager ein Geschaeftsfuehrer ist, aber jeder Geschaeftsfuehrer ist ein manager
|
||||||
if (mi instanceof Geschaeftsfuehrer)
|
if (mi instanceof Geschaeftsfuehrer)
|
||||||
System.out.println("Ja");
|
System.out.println("Jalll");
|
||||||
|
|
||||||
if (null instanceof Geschaeftsfuehrer )
|
if (null instanceof Geschaeftsfuehrer )
|
||||||
System.out.println("null");
|
System.out.println("null");
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
module Programmierung2 {
|
module Programmierung2 {
|
||||||
requires java.desktop;
|
requires java.desktop;
|
||||||
requires org.junit.jupiter.api;
|
requires org.junit.jupiter.api;
|
||||||
requires junit;
|
|
||||||
requires java.sql;
|
requires java.sql;
|
||||||
requires java.logging;
|
requires java.logging;
|
||||||
exports Übungen.TaschenrechnerGUI to junit; // Exportiere das Paket für das JUnit-Modul
|
|
||||||
}
|
}
|
Binary file not shown.
|
@ -1,5 +1,7 @@
|
||||||
package oop.Generics;
|
package oop.Generics;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
public class Pocket<T> {
|
public class Pocket<T> {
|
||||||
|
|
||||||
private T value;
|
private T value;
|
||||||
|
@ -9,6 +11,9 @@ public class Pocket<T> {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <G> G getT(G g) {
|
||||||
|
return g;
|
||||||
|
}
|
||||||
|
|
||||||
public T getValue() {
|
public T getValue() {
|
||||||
return value;
|
return value;
|
||||||
|
@ -26,12 +31,7 @@ public class Pocket<T> {
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Pocket<Pocket<String>> pocketOfPockets = new Pocket<>();
|
List<Object> stringList = new ArrayList<>();
|
||||||
pocketOfPockets.setValue(new Pocket<String>());
|
|
||||||
pocketOfPockets.getValue().setValue("Innere Pocket");
|
|
||||||
System.out.println(pocketOfPockets.getValue().getValue());
|
|
||||||
//-----------------------------------------------------------------
|
|
||||||
Pocket<String>[] pocket = new Pocket[10]; // mit 10 Plätzen
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
package oop.Generics;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class RawType{
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ArrayList<Integer> t = new ArrayList<>();
|
||||||
|
t.add(22);
|
||||||
|
t.add(12);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void printList(ArrayList<Object> list) {
|
||||||
|
for (Object elem : list)
|
||||||
|
System.out.println(elem + " ");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -6,38 +6,10 @@ public class Beispiele {
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Integer[] myArray = new Integer[] { 10, 20, 22, 30, 50 };
|
|
||||||
Stream<Integer> myStream = Arrays.stream(myArray);
|
|
||||||
/*
|
|
||||||
* Hier macht der Stream nichts, weil die Intermediate-Operation filter keine
|
|
||||||
* Aktion auslöst, solange keine Terminal-Operation aufgerufen wird.
|
|
||||||
*/
|
|
||||||
// myStream.filter(i -> (i % 2 == 0));//Keine Wirkung, da keine Terminal-Operation folgt
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Hier wird eine Intermediate-Operation (filter) auf dem Stream aufgerufen, die
|
|
||||||
* die geraden Zahlen aus dem Stream herausfiltert. Danach wird die
|
|
||||||
* Terminal-Operation count() aufgerufen, die die Anzahl der gefilterten
|
|
||||||
* Elemente zählt und als long zurückgibt.
|
|
||||||
*/
|
|
||||||
long x = myStream.filter(i -> (i % 2 == 0)).count(); // count gibt Long zurück
|
|
||||||
System.out.println(x);
|
|
||||||
|
|
||||||
// Wiederverwendung von myStream liefert einen Compiler-Fehler, da der Stream
|
|
||||||
// bereits abgeschlossen ist.
|
|
||||||
// Ein Stream kann nur einmal verwendet werden, und nach einer
|
|
||||||
// Terminal-Operation wie count()
|
|
||||||
// ist der Stream geschlossen und nicht wiederverwendbar.
|
|
||||||
x = myStream.filter(i -> (i % 2 == 1)).count(); // Compiler-Fehler
|
|
||||||
System.out.println(x);
|
|
||||||
|
|
||||||
// Compiler-Fehler: Stream has already been operated upon or closed
|
|
||||||
// Dieser Fehler tritt auf, weil myStream nach der ersten count()-Operation
|
|
||||||
// nicht erneut verwendet werden kann.
|
|
||||||
long y = myStream.filter(i -> (i % 2 == 1)).count(); // Compiler-Fehler
|
|
||||||
System.out.println(y);
|
|
||||||
|
|
||||||
int[] array = { 1, 2, 3, 45, 6 };
|
int[] array = { 1, 2, 3, 45, 6 };
|
||||||
|
IntStream.of(array).forEach(System.out::print);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package Übungen.BlackJack;
|
package Übungen.BlackJack;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package Übungen.MyBankSystem;
|
package Übungen.MyBankSystem;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import org.junit.jupiter.api.Test;
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
package Übungen;
|
package Übungen;
|
||||||
|
|
||||||
import java.awt.EventQueue;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.border.EmptyBorder;
|
import javax.swing.border.EmptyBorder;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
@ -11,16 +8,10 @@ public class Stopuhr extends JFrame {
|
||||||
|
|
||||||
JPanel contentPane;
|
JPanel contentPane;
|
||||||
JLabel zeige_zeit;
|
JLabel zeige_zeit;
|
||||||
JButton start_zeit, stop_zeit_1;
|
JButton start_zeit;
|
||||||
JTextArea zeige_alleZeiten;
|
Timer timer;
|
||||||
|
|
||||||
Timer timer, print_alleZeiten;
|
|
||||||
boolean aktiv;
|
|
||||||
long startzeit;
|
long startzeit;
|
||||||
|
|
||||||
int speichere_alle_zeiten_index = 0;
|
|
||||||
ArrayList<String> speichere_alle_zeiten = new ArrayList<>();
|
|
||||||
|
|
||||||
public Stopuhr() {
|
public Stopuhr() {
|
||||||
this.setTitle("Stopuhr");
|
this.setTitle("Stopuhr");
|
||||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
@ -31,69 +22,33 @@ public class Stopuhr extends JFrame {
|
||||||
contentPane.setLayout(null);
|
contentPane.setLayout(null);
|
||||||
zeite_elemente();
|
zeite_elemente();
|
||||||
start_programm();
|
start_programm();
|
||||||
|
|
||||||
|
|
||||||
this.setVisible(true);
|
this.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start_programm() {
|
public void start_programm() {
|
||||||
aktiv = false;
|
timer = new Timer(1000, e -> update_zeit());
|
||||||
timer = new Timer(100, e -> update_zeit());
|
|
||||||
print_alleZeiten = new Timer(100, e -> print_next_time());
|
|
||||||
start_zeit.addActionListener(e -> start_stopuhr());
|
start_zeit.addActionListener(e -> start_stopuhr());
|
||||||
stop_zeit_1.addActionListener(e -> stop_stopuhr());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start_stopuhr() {
|
public void start_stopuhr() {
|
||||||
if (!aktiv) {
|
|
||||||
timer.start();
|
timer.start();
|
||||||
startzeit = System.currentTimeMillis(); // Milisekunden
|
startzeit = System.currentTimeMillis(); // Milisekunden
|
||||||
aktiv = true;
|
|
||||||
speichere_alle_zeiten_index = 0;
|
|
||||||
|
|
||||||
}else
|
|
||||||
print_alleZeiten.start();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stop_stopuhr() {
|
|
||||||
if (aktiv) {
|
|
||||||
timer.stop();
|
|
||||||
print_alleZeiten.stop();
|
|
||||||
start_zeit.setEnabled(false);
|
|
||||||
aktiv = false;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
zeige_alleZeiten.setText("");
|
|
||||||
zeige_zeit.setText("Zeit: 0.0 s");
|
|
||||||
start_zeit.setEnabled(true);
|
|
||||||
speichere_alle_zeiten.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void update_zeit() {
|
public void update_zeit() {
|
||||||
double rest = (System.currentTimeMillis() - startzeit) / 1000.0;
|
double rest = (System.currentTimeMillis() - startzeit) / 1000.0;
|
||||||
String formatiere_zahl = String.format("Zeit: %.1f s", rest);
|
String formatiere_zahl = String.format("Zeit: %.1f s", rest);
|
||||||
speichere_alle_zeiten.add(formatiere_zahl);
|
|
||||||
zeige_zeit.setText(formatiere_zahl);
|
zeige_zeit.setText(formatiere_zahl);
|
||||||
|
System.out.println(formatiere_zahl);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void print_next_time() {
|
|
||||||
|
|
||||||
zeige_alleZeiten.append(speichere_alle_zeiten_index + 1 + ".: " + speichere_alle_zeiten.get(speichere_alle_zeiten_index) + "\n");
|
|
||||||
speichere_alle_zeiten_index++;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
new Stopuhr();
|
new Stopuhr();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<String> getalleZeiten() {
|
|
||||||
return speichere_alle_zeiten;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void zeite_elemente() {
|
public void zeite_elemente() {
|
||||||
zeige_zeit = new JLabel("Zeit: 0.0 s");
|
zeige_zeit = new JLabel("Zeit: 0.0 s");
|
||||||
zeige_zeit.setFont(new Font("Tahoma", Font.BOLD, 16));
|
zeige_zeit.setFont(new Font("Tahoma", Font.BOLD, 16));
|
||||||
|
@ -102,14 +57,5 @@ public class Stopuhr extends JFrame {
|
||||||
start_zeit = new JButton("Start/Lap");
|
start_zeit = new JButton("Start/Lap");
|
||||||
start_zeit.setBounds(10, 484, 190, 54);
|
start_zeit.setBounds(10, 484, 190, 54);
|
||||||
contentPane.add(start_zeit);
|
contentPane.add(start_zeit);
|
||||||
|
|
||||||
stop_zeit_1 = new JButton("Stop/Löschen");
|
|
||||||
stop_zeit_1.setBounds(252, 484, 190, 54);
|
|
||||||
contentPane.add(stop_zeit_1);
|
|
||||||
|
|
||||||
zeige_alleZeiten = new JTextArea();
|
|
||||||
zeige_alleZeiten.setFont(new Font("Arial", Font.BOLD, 15));
|
|
||||||
zeige_alleZeiten.setBounds(10, 53, 417, 376);
|
|
||||||
contentPane.add(zeige_alleZeiten);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,8 @@
|
||||||
package Übungen.TaschenrechnerGUI;
|
package Übungen.TaschenrechnerGUI;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import org.junit.jupiter.api.Test;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Disabled;
|
import org.junit.jupiter.api.Disabled;
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class View extends JFrame {
|
||||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
this.setLocationRelativeTo(null);
|
this.setLocationRelativeTo(null);
|
||||||
this.setVisible(true);
|
this.setVisible(true);
|
||||||
this.setLayout(null);
|
getContentPane().setLayout(null);
|
||||||
|
|
||||||
ergebnisse.setBounds(40, 60, 300, 40);
|
ergebnisse.setBounds(40, 60, 300, 40);
|
||||||
error.setBounds(40, 60, 100, 30);
|
error.setBounds(40, 60, 100, 30);
|
||||||
|
@ -59,6 +59,8 @@ public class View extends JFrame {
|
||||||
button5.setBounds(120,190,buttonWidth,buttonheight);
|
button5.setBounds(120,190,buttonWidth,buttonheight);
|
||||||
button6.setBounds(200,190,buttonWidth,buttonheight);
|
button6.setBounds(200,190,buttonWidth,buttonheight);
|
||||||
button7.setBounds(40,230,buttonWidth,buttonheight);
|
button7.setBounds(40,230,buttonWidth,buttonheight);
|
||||||
|
button8.setBackground(new Color(0, 64, 0));
|
||||||
|
button8.setForeground(new Color(0, 64, 0));
|
||||||
button8.setBounds(120,230,buttonWidth,buttonheight);
|
button8.setBounds(120,230,buttonWidth,buttonheight);
|
||||||
button9.setBounds(200,230,buttonWidth,buttonheight);
|
button9.setBounds(200,230,buttonWidth,buttonheight);
|
||||||
button0.setBounds(40,270,buttonWidth*2 + 20,buttonheight);
|
button0.setBounds(40,270,buttonWidth*2 + 20,buttonheight);
|
||||||
|
@ -91,27 +93,27 @@ public class View extends JFrame {
|
||||||
berechnen.setForeground(Color.WHITE);
|
berechnen.setForeground(Color.WHITE);
|
||||||
berechnen.setBounds(360, 230, buttonWidth, buttonheight* 2 + 10);
|
berechnen.setBounds(360, 230, buttonWidth, buttonheight* 2 + 10);
|
||||||
|
|
||||||
this.add(clear);
|
getContentPane().add(clear);
|
||||||
this.add(error);
|
getContentPane().add(error);
|
||||||
this.add(ergebnisse);
|
getContentPane().add(ergebnisse);
|
||||||
this.add(eingabe);
|
getContentPane().add(eingabe);
|
||||||
this.add(button1);
|
getContentPane().add(button1);
|
||||||
this.add(button2);
|
getContentPane().add(button2);
|
||||||
this.add(button3);
|
getContentPane().add(button3);
|
||||||
this.add(button4);
|
getContentPane().add(button4);
|
||||||
this.add(button5);
|
getContentPane().add(button5);
|
||||||
this.add(button6);
|
getContentPane().add(button6);
|
||||||
this.add(button7);
|
getContentPane().add(button7);
|
||||||
this.add(button8);
|
getContentPane().add(button8);
|
||||||
this.add(button9);
|
getContentPane().add(button9);
|
||||||
this.add(button0);
|
getContentPane().add(button0);
|
||||||
this.add(punkt);
|
getContentPane().add(punkt);
|
||||||
this.add(plus);
|
getContentPane().add(plus);
|
||||||
this.add(minus);
|
getContentPane().add(minus);
|
||||||
this.add(multi);
|
getContentPane().add(multi);
|
||||||
this.add(divid);
|
getContentPane().add(divid);
|
||||||
this.add(berechnen);
|
getContentPane().add(berechnen);
|
||||||
this.add(back);
|
getContentPane().add(back);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class SpielfeldGUI {
|
||||||
panel.setLayout(new GridLayout(3, 3));
|
panel.setLayout(new GridLayout(3, 3));
|
||||||
|
|
||||||
// Erstelle das Spielfeld mit 3x3 Buttons
|
// Erstelle das Spielfeld mit 3x3 Buttons
|
||||||
buttons = new JButton[3][3];
|
buttons = new JButton[4][4];
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
|
|
Loading…
Reference in New Issue