justify"> {void actionPerformed (ActionEvent event)
{. exit (0);
}
}) ;. add (exitItem); netMenu=new JMenu ( Нейро-мережу ) ;. add (netMenu); etNetItem=new JMenuItem ( Розрахунок ); etNetItem.addActionListener (ras4etNet) ;. add (ras4etNetItem); etNetItem.setEnabled (false);=new JMenuItem ( Навчання ) ;. addActionListener (studyNet) ;. add (studyNetItem) ;. setEnabled (false) ;. addSeparator (); =new JMenuItem ( параметри мережі ) ;. addActionListener (showNet) ;. add (aboutNetItem) ;. setEnabled (false);=new JMenuItem ( схема мережі ) ;. addActionListener (showNetImage) ;. add (showNetImageItem ) ;. setEnabled (false);
} void setNet (Net n)
{= n; .setEnabled (true) ;. setEnabled (true); etNetItem.setEnabled (true) ;. setEnabled (true) ;. setEnabled (true);
} class ShowNetImageAction implements ActionListener
{void actionPerformed (ActionEvent event)
{(net2!=null amp; amp; imPanel == null) {imPanel=new ImagePanel (net2);} (net2!=null amp; amp; imPanel!=null) {imPanel. setVisible (true);}
}
} class SaveNetAction implements ActionListener
{void actionPerformed (ActionEvent event)
{. setCurrentDirectory (new File (. )); result=chooser.showSaveDialog (null); filename=chooser.getSelectedFile (). getPath () ;. SaveNet (filename);
}
} class Ras4etNetAction implements ActionListener
{void actionPerformed (ActionEvent event)
{. MakeRas4et (txtArea);
}
} class StudyNetAction implements ActionListener
{void actionPerformed (ActionEvent event)
{. Study (txtArea);
}
} class OpenNetAction implements ActionListener
{void actionPerformed (ActionEvent event)
{. setCurrentDirectory (new File (. )); result=chooser.showOpenDialog (null); (result == JFileChooser.APPROVE_OPTION)
{filename=chooser.getSelectedFile (). getPath ();=new Net (owner, filename); (imPanel!=null)
{. setVisible (false);
}=new ImagePanel (net2) ;. setEnabled (true) ;. setEnabled (true); etNetItem.setEnabled (true) ;. setEnabled (true) ;. setEnabled (true);
}
}
} class ShowNet implements ActionListener
{void actionPerformed (ActionEvent event)
{. ShowNetInfo (txtArea);
}
} ImagePanel imPanel; Frame owner; JMenuItem showNetImageItem; JMenuItem studyNetItem; JMenuItem ras4etNetItem; JMenuItem saveNetItem; JMenuItem aboutNetItem; JFileChooser chooser; Net net2; JTextArea txtArea;
} NetFileFilter extends FileFilter
{void setDescription (String aDescription)
{= aDescription;
} String getDescription ()
{description;
} boolean accept (File f)
{(f.isDirectory ()) return true; name=f.getName (). toLowerCase (); (name.endsWith ( )) return true; false;
} String description= raquo ;;
}
Листинги класу вікна для введення інформації в нейронну мережу
package classWindow; java.awt. *; java.awt.event. *; java.util. *; javax.swing. *; class VvodKartinki extends JDialog
{VvodKartinki (Frame owner, int aStolbcov, int aStrok)
{
super (owner, Зображення для обробки raquo ;, true);
stolbcov=aStolbcov;=aStrok;=strok * stolbcov;=new ArrayList (kN);=new double [kN]; contentPane=getContentPane (); (stolbcov * 40, (strok + 1) * 40); panel=new InpPanel (VvodKartinki.this) ;. add (panel, BorderLayout.CENTER); (false);
} class InpPanel extends JPanel
{InpPanel (final JDialog owner)
{layout=new GridBagLayout (); (layout); constraints=new GridBagConstraints (); (int i=0; i lt; strok; i ++)
{(int j=0; j lt; stolbcov; j ++)
{= getConstr (j, i, 1, 1); sb=new SmallButton (); (sb, constraints) ;. add (sb);
}
} panel22=new UprPanel (owner);=getConstr (0, strok + 1, stolbcov, 1); (panel22, constraints);
} GridBagConstraints getConstr (int x, int y, int w,...