events - Java: Exception in thread "AWT-EventQueue-0" -
good evening all,
i making assignment java hall exhibition system , somehow working not always, used work , crash in other moments.
that related codes (add hall) :
try (dataoutputstream dataoutputstream = new dataoutputstream(new fileoutputstream("d:" + file.separator + "halls.txt", true))) { dataoutputstream.writebytes(hallno + " " + tb_hallfloor.gettext() + " " + halltype + " " + dimensions + " " + area + " " + seatingstyle + " " + tb_capacity.gettext() + " persons " + tb_rental.gettext() + "rm " + facilities + " available"); dataoutputstream.writebytes("\n"); dataoutputstream.close(); } catch (ioexception e) { system.err.println(e); }
and damaged part (show available halls):
string no, f, htype, d, a, style, c, rental, fa, s; try { string fname = "d:/halls.txt"; scanner infile; infile = new scanner(new file(fname)); while (infile.hasnext()){ no = infile.next(); f = infile.next(); htype = infile.next(); d = infile.next(); = infile.next(); style = infile.next(); c = infile.next(); rental = infile.next(); fa = infile.next(); s = infile.next(); if(s.equals("available")) list1.add(no + " " + f + " " + htype + " " + d + " " + + " " + style + " " + c + " " + rental + " " + fa); else continue; } infile.close(); } catch(ioexception e) {system.err.println("sorry no halls availble."); system.err.println(e);} }
and these errors had :
exception in thread "awt-eventqueue-0" java.util.inputmismatchexception @ java.util.scanner.throwfor(scanner.java:909) @ java.util.scanner.next(scanner.java:1530) @ java.util.scanner.nextint(scanner.java:2160) @ java.util.scanner.nextint(scanner.java:2119) @ ehms.addhall.gethno(addhall.java:267) @ ehms.addhall.jbutton1actionperformed(addhall.java:303) @ ehms.addhall.access$000(addhall.java:7) @ ehms.addhall$1.actionperformed(addhall.java:52) @ javax.swing.abstractbutton.fireactionperformed(abstractbutton.java:2018) @ javax.swing.abstractbutton$handler.actionperformed(abstractbutton.java:2341) @ javax.swing.defaultbuttonmodel.fireactionperformed(defaultbuttonmodel.java:402) @ javax.swing.defaultbuttonmodel.setpressed(defaultbuttonmodel.java:259) @ javax.swing.plaf.basic.basicbuttonlistener.mousereleased(basicbuttonlistener.java:252) @ java.awt.component.processmouseevent(component.java:6504) @ javax.swing.jcomponent.processmouseevent(jcomponent.java:3321) @ java.awt.component.processevent(component.java:6269) @ java.awt.container.processevent(container.java:2229) @ java.awt.component.dispatcheventimpl(component.java:4860) @ java.awt.container.dispatcheventimpl(container.java:2287) @ java.awt.component.dispatchevent(component.java:4686) @ java.awt.lightweightdispatcher.retargetmouseevent(container.java:4832) @ java.awt.lightweightdispatcher.processmouseevent(container.java:4492) @ java.awt.lightweightdispatcher.dispatchevent(container.java:4422) @ java.awt.container.dispatcheventimpl(container.java:2273) @ java.awt.window.dispatcheventimpl(window.java:2713) @ java.awt.component.dispatchevent(component.java:4686) @ java.awt.eventqueue.dispatcheventimpl(eventqueue.java:707) @ java.awt.eventqueue.access$000(eventqueue.java:101) @ java.awt.eventqueue$3.run(eventqueue.java:666) @ java.awt.eventqueue$3.run(eventqueue.java:664) @ java.security.accesscontroller.doprivileged(native method) @ java.security.protectiondomain$1.dointersectionprivilege(protectiondomain.java:76) @ java.security.protectiondomain$1.dointersectionprivilege(protectiondomain.java:87) @ java.awt.eventqueue$4.run(eventqueue.java:680) @ java.awt.eventqueue$4.run(eventqueue.java:678) @ java.security.accesscontroller.doprivileged(native method) @ java.security.protectiondomain$1.dointersectionprivilege(protectiondomain.java:76) @ java.awt.eventqueue.dispatchevent(eventqueue.java:677) @ java.awt.eventdispatchthread.pumponeeventforfilters(eventdispatchthread.java:211) @ java.awt.eventdispatchthread.pumpeventsforfilter(eventdispatchthread.java:128) @ java.awt.eventdispatchthread.pumpeventsforhierarchy(eventdispatchthread.java:117) @ java.awt.eventdispatchthread.pumpevents(eventdispatchthread.java:113) @ java.awt.eventdispatchthread.pumpevents(eventdispatchthread.java:105) @ java.awt.eventdispatchthread.run(eventdispatchthread.java:90)
line 267 code:
no = infile.nextint();
line 303 code:
string hallno = anh.gethno();
used code store in file (add hall):
try (dataoutputstream dataoutputstream = new dataoutputstream(new fileoutputstream("d:" + file.separator + "halls.txt", true))) { dataoutputstream.writebytes(hallno + " " + tb_hallfloor.gettext() + " " + halltype + " " + dimensions + " " + area + " " + seatingstyle + " " + tb_capacity.gettext() + " persons " + tb_rental.gettext() + "rm " + facilities + " available"); dataoutputstream.writebytes("\n"); dataoutputstream.close(); } catch (ioexception e) { system.err.println(e); }
i have read many topics , " event dispatcher" or eof scanner object tried fix without positive change, appreciated.
Comments
Post a Comment