int h)
{constraint=new GridBagConstraints () ;. fill=GridBagConstraints.BOTH; ins=new Insets (1,1,1,1) ;. insets=ins; .weightx=100; .weighty= 100; .gridx=x; .gridy=y; .gridwidth=w; .gridheight=h; constraint;
} class SmallButton extends JButton
{SmallButton ()
{(color0); (new MouseHandler ());
} class MouseHandler extends MouseAdapter
{void mousePressed (MouseEvent event) {} void mouseReleased (MouseEvent event) {} void mouseClicked (MouseEvent event)
{c=getBackground (); (c == color0) setBackground (color1); (c == color1) setBackground (color0);
}
}
} class UprPanel extends JPanel
{UprPanel (final JDialog owner)
{okButton=new JButton ( ok ) ;. addActionListener (new ()
{void actionPerformed (ActionEvent event)
{= true; (int i=0; i lt; kN; i ++)
{s=(SmallButton) kartinka.get (i); c=s.getBackground (); (c == color0) massiv [i]=0; (c == color1) massiv [ i]=1;
}. setVisible (false);
}
}); cancelButton=new JButton ( Cancel ) ;. addActionListener (new ()
{void actionPerformed (ActionEvent event)
{. setVisible (false);
}
}); (okButton); (cancelButton);
}
}
} boolean showIt ()
{= false; (true); ok;
} double [] getMassiv ()
{massiv;
} Color color1=new Color (100,100,100); Color color0=new Color (200,200,200); boolean ok; String input; ArrayList kartinka; int kN; double [] massiv; int strok; int stolbcov;
}
Листинги класу діалогового вікна для виведення зображення моделі нейронної мережі
package classWindow; java.awt. *; java.awt.geom. *; java.util. *; javax.swing. *; classNet. *; class ImagePanel extends JDialog
{ImagePanel (Net net1)
{contentPane=getContentPane (); ( Схема нейронної мережі ); (false); (false);=net1.getIn ();=net1.getsubS ();=new int [ asubS];=net1.getsub ();=net1.getout ();=2 + asubS;=ain; (int i=0; i lt; asubS; i ++)
{(temp lt; asub [i]) temp=asub [i];
} (temp lt; aout) temp=aout;=500/temp; (temp/3 lt; 25) r=temp/3; r=25;=700/kL; (width, height ); panel=new DrPanel () ;. add (panel, BorderLayout.CENTER); (true);
} class DrPanel extends JPanel
{void paintComponent (Graphics g)
{. paintComponent (g); D g2=(Graphics2D) g;=dX/2;=height/(1 + ain);=dY/2;=new ArrayList ();=new ArrayList (); (int i=0; i lt; ain; i ++)
{= new Ellipse2D.Double () ;. setFrameFromCenter (centerX, centerY, centerX + r, centerY + r) ;. setStroke (new BasicStroke (1.0F)) ;. draw (neiron); =new Point2D.Double (centerX + r, centerY) ;. add (p) ;. setStroke (new BasicStroke (2.0F)) ;. draw (new Line2D.Double (centerX-r, centerY, centerX-r-dX/ 3, centerY)) ;. draw (new Line2D.Double (centerX-r, centerY, centerX-r - 10, centerY - 4)) ;. draw (new Line2D.Double (centerX-r, centerY, centerX-r -10, centerY + 4));=centerY + dY;
}=new Ellipse2D.Double () ;. setFrameFromCenter (centerX + dX/2,520-4 * r, centerX + dX/2 + r, 520-4 * r + r) ;. setStroke ( new BasicStroke (2.0F)) ;. draw (neiron);=new Point2D.Double (centerX + dX/2 + r, 520-4 * r) ;. add (p); (int j=0; j lt; asubS ; j ++)
{= centerX + dX;=height/(1 + asub [j]);=dY/2; (int i=0; i lt; asub [j]; i ++)
{= new Ellipse2D.Double () ;. setFrameFromCenter (centerX, centerY, centerX + r, centerY + r) ;. setStroke (new BasicStroke (1.0F)) ;. draw (neiron); =new Point2D.Double (centerX-r, centerY); (int k=0; k lt; massivPoint.size (); k ++)
{. draw (new Line2D.Double ((Point2D) massivPoint.get (k), p));
}=new Point2D.Double (centerX + r, centerY) ;. add (p);=centerY + dY;
}=new Ellipse2D.Double () ;. setFrameFromCenter (centerX + dX/2,520-4 * r, centerX + dX/2 + r, 520-4 * r + r) ;. setStroke ( new BasicStroke (2.0F)) ;. draw (neiron);=new Point2D.Double (centerX + dX/2 + r, 520-4 * r) ;. add (p) ;. clear (); (int k= 0; k lt; tempMassivPoint.size (); k ++)
{. add (tempMassivPoint.get (k));
}. clear ();
}=centerX + dX;=height/(1 + aout);=dY/2; ...