我知道有很多这样的话题,但我找不到我的错误,因为我觉得我做的一切都还好。简单地说,我想做的是创建一个gui,它会想要一个来自我的数字让我们说它是“x”,如果x< 50它会说“Geçtin”别的“Kaldın”但它看起来我不能在“文本”上设置任何东西。 那是我的鳕鱼,
@media print{
body:not(#myModal){
display:none;
visibility:hidden;
}
#myModal{ /*shouldn't have to but doesn't work anyway */
display:block;
visibility:visible;
}
}
public static void main(String[]args) {
gui a = new gui();
a.guii();
}
}
import java.awt.event.ActionEvent; import java.awt.event.ActionListener;
public class Action实现ActionListener {
import javax.swing.*;
public class gui extends JFrame {
JButton tıkla = new JButton("Tıkla beni");
JTextField Text = new JTextField();
public void guii() {
this.setTitle("Ahmet");
this.setLayout(null);
this.setSize(1000,1000);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
Text.setSize(200,50);
Text.setLocation(250,250);
Text.setVisible(true);
Text.setVisible(true);
this.getContentPane().add(Text);
tıkla.addActionListener(new Action());
tıkla.setSize(100,100);
tıkla.setLocation(250,350);
tıkla.setVisible(true);
this.getContentPane().add(tıkla);
String getText = JOptionPane.showInputDialog(null,"Bir sayı gir");
Text.setText(getText);
}
}