C# から Java に押された void キーを変換するための sulotion を見つけようとしていますが、まだ誰も sulotion を成功させていませんか?
キー 13(enter) を押すと、Private void doen() が 1 回アクティブになります。
import java.awt.event.*;
import javax.swing.JTextField;
import javax.swing.*;
import java.awt.*;
import java.awt.Toolkit;
import java.util.Timer;
import java.util.TimerTask;
public class Paneel extends JPanel {
private static final long serialVersionUID = 1L;
String text;
String AccountName = "default";
String autosavecheck = "";
String iss;
JProgressBar monsterbar, progressbar;
JButton sendknop, clearknop, creditsknop, saveknop, loadknop, restartknop,
disableautosaveknop;
JTextArea commandstextbox, dialoogtextbox;
JTextField naamtextbox, invoertextbox;
JOptionPane resetdialog;
Toolkit toolkit;
Timer timer;
public Paneel() {
setLayout(null);
// --------------------------------
dialoogtextbox = new JTextArea();
dialoogtextbox.setFont(new Font("sansserif", Font.BOLD, 12));
dialoogtextbox.setBounds(12, 12, 838, 207);
dialoogtextbox.list();
invoertextbox = new JTextField(12);
invoertextbox.setBounds(12, 330, 982, 20);
invoertextbox.setEnabled(false);
commandstextbox = new JTextArea();
commandstextbox.setBounds(856, 28, 138, 191);
naamtextbox = new JTextField(12);
naamtextbox.setBounds(772, 263, 220, 20);
toolkit = Toolkit.getDefaultToolkit();
timer1 = new Timer();
toolkit = Toolkit.getDefaultToolkit();
autosave = new Timer();
toolkit = Toolkit.getDefaultToolkit();
monstertimer = new Timer();
toolkit = Toolkit.getDefaultToolkit();
autodisabletimer = new Timer();
sendknop = new JButton("Send");
sendknop.setBounds(12, 260, 75, 23);
sendknop.addActionListener(new sendknopHandler());
add(sendknop);
}
private void keypressed() {
if (e.KeyChar == (char) Keys.Return) {
doen();
}
}
private void doen() {
text = invoertextbox.getText();
invoertextbox.setText("");
}
}