我需要if语句,它将反转用户输入的内容以应用于我的jt文本字段,但无论我尝试什么,它都行不通!
public class MorseCodeFinch extends JFrame{
private static final long serialVersionUID = 1L;
JTextField jt = new JTextField(15);
JButton jb = new JButton("Enter");
JLabel jl = new JLabel();
JPanel jp = new JPanel();
@SuppressWarnings("unused")
public MorseCodeFinch(){
String s = "";
if( s.contains(",") ) {
s = s.replaceAll(",","");
StringBuilder builder = new StringBuilder(s);
builder.reverse();
System.out.println(builder);
}
else {
System.out.println(s);
}
}