Browse Source

Commit_43 Key_1 + message fuer MeinGui class hinzugefuegt

Mohamed
Adah Boukhari 5 years ago
parent
commit
08fd412840
  1. BIN
      Budget Projekt/bin/MeinBudgetView/MeinGui$1.class
  2. BIN
      Budget Projekt/bin/MeinBudgetView/MeinGui.class
  3. 34
      Budget Projekt/src/MeinBudgetView/MeinGui.java

BIN
Budget Projekt/bin/MeinBudgetView/MeinGui$1.class

BIN
Budget Projekt/bin/MeinBudgetView/MeinGui.class

34
Budget Projekt/src/MeinBudgetView/MeinGui.java

@ -9,6 +9,8 @@ import javax.swing.JTextField;
import java.awt.Image; import java.awt.Image;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import javax.swing.JButton; import javax.swing.JButton;
@ -29,7 +31,7 @@ import javax.swing.border.BevelBorder;
import javax.swing.border.TitledBorder; import javax.swing.border.TitledBorder;
import javax.swing.UIManager; import javax.swing.UIManager;
public class MeinGui extends JFrame implements ActionListener {
public class MeinGui extends JFrame implements ActionListener, KeyListener {
private JPanel contentPane; private JPanel contentPane;
public static JTextField text1; public static JTextField text1;
@ -208,11 +210,17 @@ public class MeinGui extends JFrame implements ActionListener {
scrollPane_1.setViewportView(myTable); scrollPane_1.setViewportView(myTable);
text1.addActionListener(this); text1.addActionListener(this);
text1.addKeyListener(this);
text2.addActionListener(this); text2.addActionListener(this);
text2.addKeyListener(this);
senden.addActionListener(this); senden.addActionListener(this);
senden.addKeyListener(this);
berechne.addActionListener(this); berechne.addActionListener(this);
berechne.addKeyListener(this);
loeschen.addActionListener(this); loeschen.addActionListener(this);
loeschen.addKeyListener(this);
exit.addActionListener(this); exit.addActionListener(this);
exit.addKeyListener(this);
} }
@ -273,4 +281,28 @@ public class MeinGui extends JFrame implements ActionListener {
return result; 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
}
} }
Loading…
Cancel
Save