Hello,
Im the begginer, and i realy want to proggramin in Java, but have a big problem.
I have a question:"How to show the random text after button is clicked.?"
All day I was searching on the internet and I founded only how to show the random number.
THANK YOU for every answer!
My code now:
//Button 1
JButton button1 = new JButton();
frame.add(panel);
panel.add(button1);
button1.setBounds(50,60,50,50);
panel.setLayout(null);
frame.setVisible(true);
button1.setText("1");
button1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(null, "This is first button");
}
});
What I have tried:
First i was set that show me random number when button is clicked. Then i was trying to convert integer to string. Ind a tried also with ArrayList but then i cannot show text when is button clicked.
I cannot convert this and I dont know where is a problem.