私はユーザーから価値を得てそれを表示したいと思います。 どうすれば可能ですか? 私はすでに.getText()で何かをしましたが、うまくいきません。JFrameスキャナーとsystem.out.print
これは私がすでにやったです: パブリッククラスCryptographieJFrame5 {
public static void main(String[] args) {
//This is what I want to do:
Scanner keyboard = new Scanner (System.in);
String n = keyboard.nextLine();
System.out.println(n);
//This is what I try to do:
public CryptographieJFrame5 ()
{
super();
setSize(600,600);
setResizable(false);
setDefaultCloseOperation(EXIT_ON_CLOSE);
JTextField MessageToEncrypt = new JTextField();
MessageToEncrypt.setBackground(new Color(204, 204, 204));
MessageToEncrypt.setBounds(24, 66, 197, 75);
String message = MessageToEncrypt.getText();
JLabel label = new JLabel();
setLayout (message);
add(label);
}
}
}
しばらくお待ちください。あなたが試したことを私たちに教えてください。 – 23k
'JTextField'、' ActionListener'、おそらく 'JButton'でも必要なすべてのリソースです。 「SwingによるUIの作成」(https://docs.oracle.com/javase/tutorial/uiswing/index.html)から始めることがあります。 – MadProgrammer
'.getText()'でどうしましたか? ( – qwerty