Hi,
I'm learning java and I have a problem. The getText() doesn't seem to work. What I am trying to do is to write a simple code, where I assign the text of a button to a string variable and print that string variable on the command line. I get the error
cannot resolve symbol
Symbol: getText()
Class : java.awt.Button
import java.io.*;
import java.awt.*;
import java.event.*;
import java.*;
import java.util.*
class tests
{
public static void main(String[] args)
{
Frame f = new Frame();
Button b1 = new Button("Text");
f.add(b1);
f.setSize(500,500);
f.setVisible(true);
String x = b1.getText();
System.out.println(x);
}
}
Thanks,