網(wǎng)站制作NEWS
eclipse中想要用按鈕(button1)使界面跳轉(zhuǎn)怎么寫(xiě),想要從activity_main.xml跳到activity_second.xml
例如: button1 里有_MouseClick 而 button2 沒(méi)有 事件_MouseClick 、 、
public class MainFace {
private static Text text_1;
private static Text text_2;
private static Table table;
public static TableViewer tableViewer;
public static void main(String[] args) {
Display display = Display.getDefault();
Shell shlWelcomeToPhonebook = new Shell();
shlWelcomeToPhonebook.setSize(505, 300);
shlWelcomeToPhonebook.setText("welcome to Phonebook1.0");
TableViewer tableViewer = new TableViewer(shlWelcomeToPhonebook,
SWT.BORDER | SWT.FULL_SELECTION);
table = tableViewer.getTable();
table.setHeaderVisible(true);
table.setBackground(SWTResourceManager.getColor(255, 255, 204));
table.setBounds(183, 23, 296, 203);
TableColumn tableColumn = new TableColumn(table, SWT.NONE);
tableColumn.setMoveable(true);
tableColumn.setWidth(40);
tableColumn.setText("序號(hào)");
TableColumn tableColumn_2 = new TableColumn(table, SWT.CENTER);
tableColumn_2.setWidth(100);
tableColumn_2.setText("\u59D3\u540D");
TableColumn tableColumn_1 = new TableColumn(table, SWT.CENTER);
tableColumn_1.setWidth(140);
tableColumn_1.setText("\u53F7\u7801");
Button button = new Button(shlWelcomeToPhonebook, SWT.NONE);
button.setBounds(70, 140, 80, 27);
button.setText("查 詢(xún)");
Button button_1 = new Button(shlWelcomeToPhonebook, SWT.NONE);
button_1.setBounds(70, 174, 80, 27);
button_1.setText("New Button");
button.addSelectionListener(new ButtonSearch());
/////////////////////////這里的try查詢(xún)成功
try{ tableViewer.setContentProvider(new TableViewerConnProvider());
tableViewer.setLabelProvider(new TableViewerLabelProvider());
tableViewer.setInput(PeopleFactory.selePeople("''","''")); }catch
(Exception e3){);
}
shlWelcomeToPhonebook.open();
shlWelcomeToPhonebook.layout();
while (!shlWelcomeToPhonebook.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
private static final class ButtonSearch extends SelectionAdapter {
public void widgetSelected(SelectionEvent e) {
///////////////////////////////////這里的try怎么就不行???
///////////////////////////錯(cuò)誤提示(包括打印的catch事件e:SelectionEvent{Button {查 詢(xún)} time=30602965 data=null item=null detail=0 x=0 y=0 width=0 height=0 stateMask=0 text=null doit=true}/////////////////
try {tableViewer.refresh();
tableViewer.setContentProvider(new TableViewerConnProvider());
tableViewer.setLabelProvider(new TableViewerLabelProvider());
tableViewer.setInput(PeopleFactory.selePeople("''","''"));
} catch (Exception el) {
}
}
}
}
多重隨機(jī)標(biāo)簽