|
|
@ -9,6 +9,8 @@ import javax.swing.JTextField; |
|
|
|
import java.awt.Image; |
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
import java.awt.event.ActionListener; |
|
|
|
import java.awt.event.KeyEvent; |
|
|
|
import java.awt.event.KeyListener; |
|
|
|
|
|
|
|
import javax.swing.ImageIcon; |
|
|
|
import javax.swing.JButton; |
|
|
@ -29,7 +31,7 @@ import javax.swing.border.BevelBorder; |
|
|
|
import javax.swing.border.TitledBorder; |
|
|
|
import javax.swing.UIManager; |
|
|
|
|
|
|
|
public class MeinGui extends JFrame implements ActionListener { |
|
|
|
public class MeinGui extends JFrame implements ActionListener, KeyListener { |
|
|
|
|
|
|
|
private JPanel contentPane; |
|
|
|
public static JTextField text1; |
|
|
@ -208,11 +210,17 @@ public class MeinGui extends JFrame implements ActionListener { |
|
|
|
scrollPane_1.setViewportView(myTable); |
|
|
|
|
|
|
|
text1.addActionListener(this); |
|
|
|
text1.addKeyListener(this); |
|
|
|
text2.addActionListener(this); |
|
|
|
text2.addKeyListener(this); |
|
|
|
senden.addActionListener(this); |
|
|
|
senden.addKeyListener(this); |
|
|
|
berechne.addActionListener(this); |
|
|
|
berechne.addKeyListener(this); |
|
|
|
loeschen.addActionListener(this); |
|
|
|
loeschen.addKeyListener(this); |
|
|
|
exit.addActionListener(this); |
|
|
|
exit.addKeyListener(this); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
@ -273,4 +281,28 @@ public class MeinGui extends JFrame implements ActionListener { |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void keyTyped(KeyEvent e) { |
|
|
|
// TODO Auto-generated method stub |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void keyPressed(KeyEvent e) { |
|
|
|
|
|
|
|
if (e.getKeyCode() == KeyEvent.VK_ENTER) { |
|
|
|
if (text1.getText().length() > 0) { |
|
|
|
budgetDispaly.setText(setBudgetView()); |
|
|
|
} else { |
|
|
|
JOptionPane.showMessageDialog(text1, "Füllen Sie alle Felder aus!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void keyReleased(KeyEvent e) { |
|
|
|
// TODO Auto-generated method stub |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |