Permalink
Browse files

fix bug

  • Loading branch information...
1 parent f301c77 commit 359d7a4288a1382dd73fe2ae14447d16b832a3f9 @refacho committed May 23, 2012
Showing with 18 additions and 9 deletions.
  1. +18 −9 src/Gui/GuiAlpha.java
View
@@ -23,8 +23,11 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Random;
+import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
+import javax.swing.DefaultListModel;
+import javax.swing.JList;
import javax.swing.tree.TreePath;
/**
@@ -463,14 +466,19 @@ public void doMouseClicked(MouseEvent me, javax.swing.JTree tree) {
if(tp!=null)
System.out.println(tp.toString());
if (tp != null){
+ listModel.clear();
+
String seleccionar ="";
RDFSClass subclass = ont.getOwlModel().getOWLNamedClass(tp.toString().substring(tp.toString().lastIndexOf(",")+2, tp.toString().lastIndexOf("]")));
+
for (Iterator ti = subclass.getInstances(false).iterator(); ti.hasNext();) {
Instance sintoma = (Instance) ti.next();
- seleccionar+=sintoma.getName().substring(sintoma.getName().lastIndexOf("#")+1,sintoma.getName().length())+"\n";
+ seleccionar += sintoma.getName().substring(sintoma.getName().lastIndexOf("#")+1,sintoma.getName().length());
+ listModel.addElement(sintoma.getName().substring(sintoma.getName().lastIndexOf("#")+1,sintoma.getName().length()));
+
}
-
+ //jList1 = new JList(listModel);
jTextArea1.setText(seleccionar);
}else{
jTextArea1.setText("");
@@ -554,7 +562,7 @@ public void actionButtonPerformed(java.awt.event.ActionEvent evt){
}
}
private void proba(Ontologia ont) {
-
+ listModel = new DefaultListModel();
jTabbedPane1 = new javax.swing.JTabbedPane();
jPanel1 = new javax.swing.JPanel();
jPanel5 = new javax.swing.JPanel();
@@ -563,7 +571,7 @@ private void proba(Ontologia ont) {
jPanel6 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jScrollPane2 = new javax.swing.JScrollPane();
- jList1 = new javax.swing.JList();
+ jList1 = new javax.swing.JList(listModel);
jButton1 = new javax.swing.JButton();
jScrollPane3 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
@@ -616,11 +624,10 @@ public void mouseClicked(MouseEvent me) {
jLabel1.setText("Síntomas");
- jList1.setModel(new javax.swing.AbstractListModel() {
- String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
- public int getSize() { return strings.length; }
- public Object getElementAt(int i) { return strings[i]; }
- });
+ String[] items = {""};
+ for (int i=0; i<items.length; i++) {
+ listModel.add(i, items[i]);
+ }
jScrollPane2.setViewportView(jList1);
jButton1.setText("Seleccionar síntoma");
@@ -817,6 +824,8 @@ public void run() {
}
});
}
+
+ DefaultListModel listModel;
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;

0 comments on commit 359d7a4

Please sign in to comment.