0
"LeftRightPanel.java:45: setText(java.lang.String) in javax.swing.JLabel cannot be applied to (int)
        label.setText(num1);"

I'm guessing that this is because I'm trying to imput a int in a line where there's supposed to be text. Can I do something like .setNumber, .setNum, or .setInt? Or is this an issue that I need to adrress earlier in the program..... Thanks for any help!
EDIT:
Also tried this (referring to it as a "toString" I believe???

private class ButtonListener implements ActionListener{

public void actionPerformed (ActionEvent event){

int numPlus, numMinus, count;
String text = label.getText();
 numPlus = count + 50;
 numMinus = 50 - count;

 if (event.getSource() == plus)
 count++;
 label.setText(numPlus);
 if (event.getSource() == minus)
 count++;
 label.setText(numMinus);

That's still giving me:

LeftRightPanel.java:47: setText(java.lang.String) in javax.swing.JLabel cannot be applied to (int)
 label.setText(numPlus);
      ^

John

Edited by mike_2000_17: Fixed formatting

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Eric Cute
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.