Buggy code:
private HashSet < Subatomic > protons ; private HashSet < Subatomic > electrons ; private int electronNum = 1 ; private int protonNum = 1 ; private String [ ] elements = new String [ ] { "Hydrogen" , "Helium" , "Lithium" , "Beryllium" , "Boron" , "Carbon" , "Nitrogen" , "Oxygen" , "Fluorine" , "Neon" , "Sodium" , "Magnesium" , "Aluminium" , "Silicon" , "Phosphorus" , "Sulfur" , "Chlorine" , "Argon" , "Potassium" , "Calcium" , "Scandium" , "Titanium" , "Vanadium" , "Chromium" , "Manganese" , "Iron" , "Cobalt" , "Nickel" , "Copper" , "Zinc" , "Gallium" , "Germanium" , "Arsenic" , "Selenium" , "Bromine" , "Krypton" , "Rubidium" , "Strontium" , "Yttrium" , "Zirconium" , "Niobium" , "Molybdenum" , "Technetium" , "Ruthenium" , "Rhodium" , "Palladium" , "Silver" , "Cadmium" , "Indium" , "Tin" , "Antimony" , "Tellurium" , "Iodine" , "Xenon" , "Caesium" , "Barium" , "Lanthanum" , "Cerium" , "Praseodymium" , "Neodymium" , "Promethium" , "Samarium" , "Europium" , "Gadolinium" , "Terbium" , "Dysprosium" , "Holmium" , "Erbium" , "Thulium" , "Ytterbium" , "Lutetium" , "Hafnium" , "Tantalum" , "Tungsten" , "Rhenium" , "Osmium" , "Iridium" , "Platinum" , "Gold" , "Mercury" , "Thallium" , "Lead" , "Bismuth" , "Polonium" , "Astatine" , "Radon" , "Francium" , "Radium" , "Actinium" , "Thorium" , "Protactinium" , "Uranium" , "Neptunium" , "Plutonium" , "Americium" , "Curium" , "Berkelium" , "Californium" , "Einsteinium" , "Fermium" , "Mendelevium" , "Nobelium" , "Lawrencium" , "Rutherfordium" , "Dubnium" , "Seaborgium" , "Bohrium" , "Hassium" , "Meitnerium" , "Darmstadtium" , "Roentgenium" , "Copernicium" , "Ununtrium" , "Flerovium" , "Ununpentium" , "Livermorium" , "Ununseptium" , "Ununoctium" } ; private String [ ] elems = new String [ ] { "H" , "He" , "Li" , "Be" , "B" , "C" , "N" , "O" , "F" , "Ne" , "Na" , "Mg" , "Al" , "Si" , "P" , "S" , "Cl" , "Ar" , "K" , "Ca" , "Sc" , "Ti" , "V" , "Cr" , "Mn" , "Fe" , "Co" , "Ni" , "Cu" , "Zn" , "Ga" , "Ge" , "As" , "Se" , "Br" , "Kr" , "Rb" , "Sr" , "Y" , "Zr" , "Nb" , "Mo" , "Tc" , "Ru" , "Rh" , "Pd" , "Ag" , "Cd" , "In" , "Sn" , "Sb" , "Te" , "I" , "Xe" , "Cs" , "Ba" , "La" , "Ce" , "Pr" , "Nd" , "Pm" , "Sm" , "Eu" , "Gd" , "Tb" , "Dy" , "Ho" , "Er" , "Tm" , "Yb" , "Lu" , "Hf" , "Ta" , "W" , "Re" , "Os" , "Ir" , "Pt" , "Au" , "Hg" , "Tl" , "Pb" , "Bi" , "Po" , "At" , "Rn" , "Fr" , "Ra" , "Ac" , "Th" , "Pa" , "U" , "Np" , "Pu" , "Am" , "Cm" , "Bk" , "Cf" , "Es" , "Fm" , "Md" , "No" , "Lr" , "Rf" , "Db" , "Sg" , "Bh" , "Hs" , "Mt" , "Ds" , "Rg" , "Cn" , "Uut" , "Fl" , "Uup" , "Lv" , "Uus" , "Uuo" } ; public Screen ( ) { } @ Override public void paintComponent ( Graphics g ) { } class Key extends KeyAdapter { public void keyPressed ( KeyEvent e ) { } } class Listener implements ActionListener { public final double PROBABILITY = 0.005 ; public void actionPerformed ( ActionEvent e ) { if ( ( Math . random ( ) ) < 0.005 ) { if ( ( Math . random ( ) ) < 0.5 ) { electrons . add ( new Electron ( ( ( ( ( int ) ( ( Math . random ( ) ) * 760 ) ) + 20 ) + ( frame . x ) ) , ( ( ( ( int ) ( ( Math . random ( ) ) * 560 ) ) + 20 ) + ( frame . y ) ) ) ) ; } else { protons . add ( new Proton ( ( ( ( ( int ) ( ( Math . random ( ) ) * 760 ) ) + 20 ) + ( frame . x ) ) , ( ( ( ( int ) ( ( Math . random ( ) ) * 560 ) ) + 20 ) + ( frame . y ) ) ) ) ; } } buffer . setColor ( Color . WHITE ) ; buffer . fillRect ( 0 , 0 , getWidth ( ) , getHeight ( ) ) ; player . update ( ) ; <START_BUG> player . draw ( buffer , frame . x , frame . y ) ; <END_BUG> frame . setBounds ( ( ( player . getX ( ) ) - ( ( getWidth ( ) ) // 2 ) ) , ( ( player . getY ( ) ) - ( ( getHeight ( ) ) // 2 ) ) , getWidth ( ) , getHeight ( ) ) ; HashSet < Subatomic > copy = new HashSet < Subatomic > ( electrons ) ; for ( Subatomic electron : copy ) { if ( frame . contains ( electron . getX ( ) , electron . getY ( ) ) ) { if ( player . intersect ( electron ) ) { ( electronNum ) ++ ; electrons . remove ( electron ) ; System . out . println ( ( ( ( electron . getX ( ) ) + "<seq2seq4repair_space>" ) + ( electron . getY ( ) ) ) ) ; } else electron . draw ( buffer , frame . x , frame . y ) ; } } copy = new HashSet < Subatomic > ( protons ) ;

Fix:
player . draw ( buffer , frame . x , frame . y , getWidth ( ) , getHeight ( ) ) ;