私はラベルとプログレスバーを表示したいと思っていたeclipseプラグインを開発しています。残念ながら、私はlabelとprogressBarのsetBounds属性でsizeを変更することはできません。私座標:長方形{3、3、70、15}と長方形{3、21、170、17}eclipseプラグインsetBounds属性が機能しません
以下は私のハンドラのコードです:
private ProgressBar progressBar;
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
Display display = Display.getDefault();
Shell p_shell = new Shell(display,SWT.DIALOG_TRIM);
p_shell.setText("Translating..");
p_shell.setLayout(new RowLayout(SWT.VERTICAL));
p_shell.setSize(250, 70);
Label label = new Label(p_shell, SWT.NONE);
label.setBounds(10, 20, 180, 20);
//LINE 101 gives Rectangle {3, 3, 70, 15}
label.setText("Please wait ...");
progressBar = new ProgressBar(p_shell, SWT.SMOOTH);
//progressBar.setBounds(10, 50, 200, 20);
//LINE 100 gives Rectangle {3, 21, 170, 17}
progressBar.setBounds(new Rectangle(5, 30, 150, 10));
//LINE 100 gives Rectangle {3, 21, 170, 17}
progressBar.setMinimum(30);
progressBar.setMaximum(100);
p_shell.open();
System.out.println("progress bar ==> " + progressBar.getBounds());//LINE 100
System.out.println("label ==> " + label.getBounds());//LINE 101
while(!p_shell.isDisposed()){
if(!display.readAndDispatch()){
display.sleep();
}
}
}
私はfurther.Anyを続行することができません助けていただければ幸いです。
null setLayout。それは良い習慣ではありません。 – msagala25