Below is the part of code i need help with:
JLabel aValueLabel = new JLabel(" ",SwingConstants.LEFT);
aValueLabel.setForeground(Color.red);
aValueLabel.setFont(new Font("TimesRoman", Font.BOLD,20));
aValueLabel.setText("0.00");
if(e.getActionCommand() == "cashcard")
{cashcardSales();}
private void cashcardSales()
{
double randomValue;
double min = 0.0;
double max = 10.0;
for (int i = 0; i < 500; i++)
randomValue = (int) (Math.random() * (max - min + 1) ) + min;
aValueLabel.setText(randomValue);
I want to set my aValueLabel to a randomvalue, but there is an error. The program should work like this.
"cashcard" button clicked -> aValueLabel change from 0.00 to randomValue.
Hope someone can help me with this code. I am using javax.swing.
THanks
Rizal
getTextProblem with my code
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote


|