java中SWT插件项目 未对参数类型 String 定义运算符 + 怎么解决?
packagecn.com.sino.swt1;importorg.eclipse.swt.SWT;importorg.eclipse.swt.widgets.Displ...
package cn.com.sino.swt1;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
public class TextTest1 {
static Display display;
static Shell shell;
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Display display=new Display();
final Shell shell=new Shell(display);
shell.setText("文本框样式演示");
shell.setSize(700,700);
shell.open();
Group g1=new Group(shell,SWT.SHADOW_ETCHED_OUT);
g1.setText("各种文本框");
g1.setBounds(1,2,600,600);
Text text1=new Text(g1,SWT.CENTER);
text1.setBounds(15,20,200,30);
text1.setText("居中样式");
Text text2=new Text(g1,SWT.LEFT);
text2.setBounds(15,55,200,30);
text2.setText("靠左");
Text text3=new Text(g1,SWT.RIGHT);
text3.setBounds(15, 90, 200, 30);
text3.setText("靠右");
Text text4=new Text(g1,SWT.MULTI);
text4.setBounds(15, 125, 200, 30);
text4.setText("多行输入"+“\n”+"(需按回车)");
while(!shell.isDisposed())
{
if(!display.readAndDispatch())
display.sleep();
}
shell.dispose();
}
}
在text4.setText("多行输入"+“\n”+"(需按回车)");这一行报错,提示: 未对参数类型 String 定义运算符 + 哪位知道这是怎么一回事??? 展开
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
public class TextTest1 {
static Display display;
static Shell shell;
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Display display=new Display();
final Shell shell=new Shell(display);
shell.setText("文本框样式演示");
shell.setSize(700,700);
shell.open();
Group g1=new Group(shell,SWT.SHADOW_ETCHED_OUT);
g1.setText("各种文本框");
g1.setBounds(1,2,600,600);
Text text1=new Text(g1,SWT.CENTER);
text1.setBounds(15,20,200,30);
text1.setText("居中样式");
Text text2=new Text(g1,SWT.LEFT);
text2.setBounds(15,55,200,30);
text2.setText("靠左");
Text text3=new Text(g1,SWT.RIGHT);
text3.setBounds(15, 90, 200, 30);
text3.setText("靠右");
Text text4=new Text(g1,SWT.MULTI);
text4.setBounds(15, 125, 200, 30);
text4.setText("多行输入"+“\n”+"(需按回车)");
while(!shell.isDisposed())
{
if(!display.readAndDispatch())
display.sleep();
}
shell.dispose();
}
}
在text4.setText("多行输入"+“\n”+"(需按回车)");这一行报错,提示: 未对参数类型 String 定义运算符 + 哪位知道这是怎么一回事??? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询