-- 作者:xiweiwang
-- 发布时间:12/16/2010 9:35:00 AM
-- 请高手帮忙看看,我的代码错在哪里?
package yeya; import java.util.Iterator; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; import com.hp.hpl.jena.ontology.OntClass; import com.hp.hpl.jena.ontology.OntModel; import com.hp.hpl.jena.rdf.model.ModelFactory; import com.hp.hpl.jena.util.iterator.ExtendedIterator; import com.swtdesigner.SWTResourceManager; public class ChaXun { private static Text text; private static Text text_1; private static Text text_2; static String j; private static String z; /** * Launch the application. * @param args */ public static void main(String[] args) { Display display = Display.getDefault(); Shell shell = new Shell(); shell.setSize(450, 382); shell.setText("液压支架查询"); Label label = new Label(shell, SWT.NONE); label.setFont(SWTResourceManager.getFont("宋体", 17, SWT.NORMAL)); label.setBounds(21, 10, 247, 34); label.setText("\u8BF7\u8F93\u5165\u8981\u67E5\u8BE2\u7684\u5185\u5BB9\uFF1A"); text = new Text(shell, SWT.BORDER); text.setFont(SWTResourceManager.getFont("宋体", 13, SWT.NORMAL)); text.setBounds(31, 55, 207, 23); Button button = new Button(shell, SWT.NONE); button.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { j= text.getText(); //text_1.setText(j); OntModel m= ModelFactory.createOntologyModel(); m.read("file:C://11.owl"); OntClass k=m.createClass(j); OntClass v=k.getSubClass(); System.out.println(v.getLocalName()); // Iterator iter1= ((OntClass) k).listSubClasses(); //while(iter1.hasNext()){ // OntClass h1=( OntClass)iter1.next(); // text_1.setText((( OntClass )v).getLocalName()); // z=h1.getLocalName(); //text_1.setText(z); //} }} ); button.setBounds(284, 55, 72, 28); button.setText("\u786E\u5B9A"); Label label_1 = new Label(shell, SWT.NONE); label_1.setText("\u5176\u4E0A\u4F4D\u6982\u5FF5\uFF1A"); label_1.setFont(SWTResourceManager.getFont("宋体", 17, SWT.NORMAL)); label_1.setBounds(31, 97, 138, 28); text_1 = new Text(shell, SWT.BORDER | SWT.MULTI); text_1.setBounds(31, 131, 390, 63); Label label_2 = new Label(shell, SWT.NONE); label_2.setText("\u5176\u4E0B\u4F4D\u6982\u5FF5\uFF1A"); label_2.setFont(SWTResourceManager.getFont("宋体", 17, SWT.NORMAL)); label_2.setBounds(31, 200, 138, 28); text_2 = new Text(shell, SWT.BORDER | SWT.MULTI); text_2.setFont(SWTResourceManager.getFont("宋体", 15, SWT.NORMAL)); text_2.setBounds(31, 234, 390, 88); shell.open(); shell.layout(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } } } 老是查不出来
|