use of automenta.vivisect.swing.NWindow in project opennars by opennars.
the class SentenceTablePanel method newSelectedGraphPanel.
public void newSelectedGraphPanel() {
Term[] sel = new Term[table.getSelectedRows().length];
int k = 0;
for (int i : table.getSelectedRows()) {
Sentence w = (Sentence) table.getValueAt(i, 1);
sel[k] = w.term;
k++;
}
TermSyntaxVis tt = new TermSyntaxVis(sel);
syntaxPanel = new PCanvas(tt);
syntaxPanel.setZoom(10f);
NWindow w = new NWindow("", syntaxPanel);
w.setSize(400, 400);
w.setVisible(true);
// ProcessingGraphPanel2 pgp = new ProcessingGraphPanel2(getSelectedRows(1)) {
//
// @Override
// public DirectedMultigraph getGraph() {
//
// DefaultGraphizer graphizer = new DefaultGraphizer(true, true, true, true, 0, false, false) {
//
// protected void addSentence(NARGraph g, Sentence s) {
// Term t = s.content;
// addTerm(g, t);
// //g.addEdge(s, s.content, new NARGraph.SentenceContent());
//
// if (t instanceof CompoundTerm) {
// CompoundTerm ct = ((CompoundTerm) t);
// Set<Term> contained = ct.getContainedTerms();
//
// for (Term x : contained) {
// addTerm(g, x);
// if (ct.containsTerm(x)) {
// g.addEdge(x, t, new NARGraph.TermContent());
// }
//
// for (Term y : contained) {
// addTerm(g, y);
//
// if (x != y) {
// if (x.containsTerm(y)) {
// g.addEdge(y, x, new NARGraph.TermContent());
// }
// }
// }
// }
// }
// }
//
// @Override
// public void onTime(NARGraph g, long time) {
// super.onTime(g, time);
//
// for (Object o : getItems()) {
//
// if (o instanceof Task) {
// g.addVertex(o);
// addSentence(g, ((Task) o).sentence);
// } else if (o instanceof Sentence) {
// g.addVertex(o);
// addSentence(g, (Sentence) o);
// }
// }
// //add sentences
// }
//
// };
//
// app.updating = true;
//
// graphizer.setShowSyntax(showSyntax);
//
// NARGraph g = new NARGraph();
// g.add(nar, newSelectedGraphFilter(), graphizer);
// return g;
// }
//
// @Override
// public int edgeColor(Object edge) {
// return NARSwing.getColor(edge.toString(), 0.5f, 0.5f).getRGB();
// }
//
// @Override
// public float edgeWeight(Object edge) {
// return 10;
// }
//
// @Override
// public int vertexColor(Object vertex) {
// return NARSwing.getColor(vertex.toString(), 0.5f, 0.5f).getRGB();
// }
//
// };
// NWindow w = new NWindow("", pgp);
// w.setSize(400, 400);
// w.setVisible(true);
}
use of automenta.vivisect.swing.NWindow in project opennars by opennars.
the class Grid2DSpace method newWindow.
public NWindow newWindow(int width, int height, final boolean exitOnClose) {
NWindow j = new NWindow("") {
@Override
protected void close() {
stop();
destroy();
getContentPane().removeAll();
if (exitOnClose)
System.exit(0);
}
};
Container content = j.getContentPane();
content.setLayout(new BorderLayout());
JPanel menu = new JPanel(new FlowLayout(FlowLayout.LEFT));
/*final JCheckBox syntaxEnable = new JCheckBox("Syntax");
syntaxEnable.addActionListener(new ActionListener() {
@Override public void actionPerformed(ActionEvent e) {
}
});
menu.add(syntaxEnable);
*/
EditorPanel editor = new EditorPanel(this);
NWindow editorWindow = new NWindow("Edit", editor);
editorWindow.setSize(200, 400);
editorWindow.setVisible(true);
content.add(menu, BorderLayout.NORTH);
content.add(this, BorderLayout.CENTER);
// initial size of the window
j.setSize(width, height);
j.setVisible(true);
return j;
}
Aggregations