getText

Problem with my code

Page 1 of 1

0 Replies - 6179 Views - Last Post: 28 January 2006 - 02:16 AM Rate Topic: -----

#1 rezal_21  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 28-January 06

getText

Posted 28 January 2006 - 02:16 AM

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

Is This A Good Question/Topic? 0
  • +

Page 1 of 1