lign="justify"> {(s == null) return; (s == current)
{st=current.getWidth (); (st == SIDELENGTH * 2) oSloyExist=false; (st == SIDELENGTH) sSloyExist=false; (st == SIDELENGTH/2) iSloyExist=false ;=null;
}. remove (s); ();
} class MouseHandler extends MouseAdapter
{void mousePressed (MouseEvent event)
{= find (event.getPoint ());
(current == null amp; amp; (event.getModifiersEx () amp; InputEvent.BUTTON1_DOWN_MASK)!=0)
{((iSloy amp; amp; iSloyExist) || (oSloy amp; amp; oSloyExist))
{
txtArea.append ( nТакой шар вже є !!!! n );
}
{(event.getPoint ());
}
} (current!=null amp; amp; (event.getModifiersEx () amp; InputEvent.BUTTON1_DOWN_MASK)!=0)
{last_x=(int) current.getX () - event.getX (); last_y=(int) current.getY () - event.getY ();
} (event.isPopupTrigger () amp; amp; current!=null)
{. show (event.getComponent (), event.getX (), event.getY ());
}
} void mouseClicked (MouseEvent event)
{= find (event.getPoint ()); (event.isPopupTrigger () amp; amp; current!=null)
{. show (event.getComponent (), event.getX (), event.getY ());
}
} void mouseReleased (MouseEvent event)
{= find (event.getPoint ()); (event.isPopupTrigger () amp; amp; current!=null)
{. show (event.getComponent (), event.getX (), event.getY ());
}
}
} class MouseMotionHandler implements MouseMotionListener
{void mouseMoved (MouseEvent event)
{(find (event.getPoint ()) == null) setCursor (Cursor.getDefaultCursor ()); setCursor (Cursor.getPredefinedCursor (Cursor.CROSSHAIR_CURSOR));
} void mouseDragged (MouseEvent event)
{(current!=null)
{= getSize (); sideHeight=current.getHeight (); sideWidth=current.getWidth (); ((current.getY () + sideHeight) gt; dim.getHeight ())
{_ y=dim.getHeight () - sideHeight/2-1;
}
{(current.getY () lt; 0)
{_ y=1 + sideHeight/2;
}
{_ y=event.getY ();
}
} ((current.getX () + sideWidth) gt; dim.getWidth ())
{_ x=dim.getWidth () - sideWidth/2-1;
}
{(current.getX () lt; 0)
{_ x=sideWidth/2 + 1;
}
{_ x=event.getX ();
}
}. setFrame (new_x-sideWidth/2, new_y-sideHeight/2, sideWidth, sideHeight); ();
}
}
} Frame owner; double new_x; double new_y; Dimension dim; MyMenu mMenu; boolean iSloyExist=false; boolean sSloyExist=false; boolean oSloyExist=false; boolean iSloy=false; boolean sSloy=false; boolean oSloy=false; JTextArea txtArea; JPopupMenu popup; static final int SIDELENGTH=50; ArrayList squares; Rectangle2D current; Net net1; String ainput; int ain; int asubS; int [] asub=new int [0]; int aout; int atemp;
}
Листинги класу менюclassWindow;classNet.*;classNet.classLayer.*;classWindow.ImagePanel;java.awt.*;java.awt.event.*;javax.swing.*;javax.swing.event.*;javax.swing.filechooser.FileFilter;java.io.*;java.util.*;class MyMenu extends JMenu
{MyMenu (JTextArea textArea, JMenuBar menuBar)
{= (Frame) SwingUtilities.getAncestorOfClass (MyMenu.class, this);=textArea;=new JFileChooser () ;. setMultiSelectionEnabled (false) ;. setFileSelectionMode (JFileChooser.FILES_AND_DIRECTORIES) ;. setAcceptAllFileFilterUsed ( false); filter=new NetFileFilter () ;. setDescription ( Net Files ) ;. setFileFilter (filter); showNet=new ShowNet (); saveNet=new SaveNetAction (); openNet=new OpenNetAction (); ras4etNet=new Ras4etNetAction (); studyNet=new StudyNetAction (); showNetImage=new ShowNetImageAction (); fileMenu=new JMenu ( Файл ) ;. add (fileMenu); openNetItem=new JMenuItem ( Відкрити .. ) ;. addActionListener (openNet) ;. add (openNetItem);=new JMenuItem ( Зберегти як ) ;. addActionListener (saveNet) ;. add (saveNetItem) ;. setEnabled (false) ;. addSeparator (); exitItem=new JMenuItem ( Вихід ) ;. addActionListener (new ()