import java.awt.event.*; import java.net.*; import java.io.*; import java.util.*; import javax.swing.*; import java.applet.*; /** * Listener for main application and drawing panel. * Place to find selected words. */ class OntoListener implements ActionListener, ItemListener, Runnable, MouseListener, MouseMotionListener{ OntoApp oa; boolean continousCalculating=false; int selectedWord=-1; int mx=-1, my=-1; public void actionPerformed(ActionEvent e){ if(e.getSource()==oa.b1){ int n=Integer.parseInt(oa.btf1.getText()); iterateN(n); } if(e.getSource()==oa.b2){ oa.od.randomCoordinates(); oa.op.calculateKoef(); oa.repaint(); } if(e.getSource()==oa.b3){ if(!continousCalculating){ new Thread(this).start(); } else { continousCalculating=false; } } if(e.getSource()==oa.b4){ openDataFrame(); } if(e.getSource()==oa.bReset){ oa.os.resetSliders(); } } void openDataFrame(){ oa.odf.setVisible(true); oa.odf.ta.setText(oa.od.getDataAsText()); String[] ps=new String[oa.od.params.length]; for(int k=0; k-1){ if((e.getModifiers()&MouseEvent.CTRL_MASK)>0){ int[] selected=oa.odf.gwordlist.getSelectedIndices(); boolean found=false; for(int i=0; i0){ try{ if(oa.od.links!=null){ String linkurl=oa.od.links[selectedWord]; AppletContext ac=oa.getAppletContext(); ac.showDocument(new java.net.URL(linkurl), "_blank"); } }catch(Exception ex){ // ex.printStackTrace(); System.out.println(ex.getMessage()+" - not in web page"); } } oa.odf.gwordlist.setSelectedIndex(selectedWord); } oa.table.setRowSelectionInterval(selectedWord, selectedWord); // for(int i=0; i0){ int[] selected=oa.odf.gwordlist.getSelectedIndices(); int[] newselected=new int[selected.length+inarea.length]; for(int i=0; i-1){ String tiptext=oa.od.names[mSelectedWord]; if(oa.od.links!=null){ if(oa.od.links[mSelectedWord].length()>3){ tiptext+="\n "+oa.od.links[mSelectedWord]; } } for(int i=0; i=0){ oa.od.coordinates[selectedWord][0]=oa.op.wx(e.getX()); oa.od.coordinates[selectedWord][1]=oa.op.wy(e.getY()); oa.repaint(); } } /* public void keyPressed(KeyEvent e){ System.out.println(e); if(e.getKeyCode()=='k'){ openDataFrame(); } } public void keyReleased(KeyEvent e){ } public void keyTyped(KeyEvent e){ } */ }