start
This commit is contained in:
parent
0303e85db4
commit
5f45b492ba
9
.idea/libraries/mariadb_java_client_3_1_0.xml
generated
9
.idea/libraries/mariadb_java_client_3_1_0.xml
generated
@ -1,9 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="mariadb-java-client-3.1.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/../../../../Schule/Datenbanken/12/Hue/Projekt/mariadb-java-client-3.1.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
9
.idea/libraries/mariadb_java_client_3_1_01.xml
generated
Normal file
9
.idea/libraries/mariadb_java_client_3_1_01.xml
generated
Normal file
@ -0,0 +1,9 @@
|
||||
<component name="libraryTable">
|
||||
<library name="mariadb-java-client-3.1.01">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/MariaDB/mariadb-java-client-3.1.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
@ -7,6 +7,6 @@
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="mariadb-java-client-3.1.0" level="project" />
|
||||
<orderEntry type="library" name="mariadb-java-client-3.1.01" level="project" />
|
||||
</component>
|
||||
</module>
|
Binary file not shown.
@ -28,6 +28,7 @@ public class Menu extends JFrame implements ActionListener {
|
||||
|
||||
a = new JButton("Anzeigen");
|
||||
a.setBounds(200, 200, 150, 70);
|
||||
a.setFont(new Font("Arial",Font.PLAIN,15));
|
||||
a.addActionListener(e -> {
|
||||
try (Connection conn = DriverManager.getConnection(url, "root", "")){
|
||||
String table = list.getSelectedValue().toString();
|
||||
|
@ -52,10 +52,10 @@ public class Tabellen extends JFrame implements TableModelListener {
|
||||
|
||||
|
||||
del = new JButton("Löschen");
|
||||
del.setBounds(290, 480, 100, 50);
|
||||
del.setBounds(180, 480, 100, 50);
|
||||
del.addActionListener(e -> {
|
||||
Löschen l = new Löschen(tab, t, table);
|
||||
|
||||
table.clearSelection();
|
||||
|
||||
});
|
||||
this.add(del);
|
||||
@ -64,7 +64,12 @@ public class Tabellen extends JFrame implements TableModelListener {
|
||||
int zeile = table.getSelectedRow();
|
||||
int spalte = table.getSelectedColumn();
|
||||
if (spalte > 0 && zeile > 0) {
|
||||
int response = JOptionPane.showConfirmDialog(null, "Wollen Sie dein Eintrag in Zeile " + (zeile+1) +", Spalte "+(spalte +1)+ " ändern?", "Bestätigen", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
|
||||
int response = 0;
|
||||
try {
|
||||
response = JOptionPane.showConfirmDialog(null, "Wollen Sie dein Eintrag in Zeile " + (zeile + 1) + ", Spalte :" + (rm.getColumnName(spalte + 1)) + " ändern?", "Bestätigen", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
|
||||
} catch (SQLException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
if (response == 0) {
|
||||
try (Connection conn = DriverManager.getConnection(url, "root", "")) {
|
||||
Statement s = conn.createStatement();
|
||||
@ -79,14 +84,13 @@ public class Tabellen extends JFrame implements TableModelListener {
|
||||
ResultSet r = s.executeQuery("Update " + tab + " set " + t.getColumnName(spalte) + "= " + t.getValueAt(zeile, spalte).toString() + " WHERE " + t.getColumnName(0) + " = " + t.getValueAt(zeile, 0));
|
||||
|
||||
}
|
||||
t.removeTableModelListener(this::tableChanged);
|
||||
table.clearSelection();
|
||||
} catch (SQLException f) {
|
||||
throw new RuntimeException(f);
|
||||
}
|
||||
t.fireTableDataChanged();
|
||||
} else if (response == 1) {
|
||||
einfügen(tab);
|
||||
t.fireTableDataChanged();
|
||||
} else {
|
||||
table.clearSelection();
|
||||
}
|
||||
|
||||
}
|
||||
@ -134,6 +138,5 @@ public class Tabellen extends JFrame implements TableModelListener {
|
||||
System.out.println(table.getSelectedRow() + "" + table.getSelectedColumn());
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,2 +0,0 @@
|
||||
public class Ändern {
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user