| | |
throw exception
![]() |
•
•
Join Date: Oct 2008
Posts: 4
Reputation:
Solved Threads: 0
Java Syntax (Toggle Plain Text)
import java.awt.*; import java.applet.*; import java.util.Scanner; import java.io.*; public class SuperSaver extends Applet { TextField inputField; Button saveButton; Button clearButton; Label titleLabel; public void init() { setLayout(null); titleLabel = new Label("Super saver"); titleLabel.reshape(260,20,80,30); add(titleLabel); inputField = new TextField(); inputField.reshape(100,60,400,100); add(inputField); saveButton = new Button("SAVE"); saveButton.reshape(100,175,70,30); add(saveButton); clearButton = new Button("CLEAR"); clearButton.reshape(430,175,70,30); add(clearButton); resize(600,300); } public boolean handleEvent(Event event) { if (event.target == saveButton && event.id == Event.ACTION_EVENT) { PrintStream outwrite = new PrintStream(new FileOutputStream("Saver.txt")); String xxx = inputField.getText(); outwrite.println(xxx); return true; } return super.handleEvent(event); } }
Last edited by ~s.o.s~; Oct 21st, 2008 at 10:39 am. Reason: Added code tags, learn to use them.
•
•
Join Date: Aug 2008
Posts: 1,160
Reputation:
Solved Threads: 137
Not sure if this what you are asking, but you'll need this at the top of the method signature
Java Syntax (Toggle Plain Text)
public boolean handleEvent(Event event) throws IOException { }
Custom Application & Software Development
www.houseshark.net
www.houseshark.net
![]() |
Similar Threads
- Throwing an Exception (C++)
- Custom exception - throw-delay (C++)
- add(Ta) and deleting(int i) taking on consideration to throw exception for duplicatio (C)
- purpose of exception handling 'finally' clause (Java)
- fr.dyade.aaa.jndi.Naming ContextFactory (Java)
Other Threads in the Java Forum
- Previous Thread: Can someone help?
- Next Thread: precedence of operators in java
| Thread Tools | Search this Thread |
add android api applet application applications array arrays automation bank binary bluetooth chat class clear client code codesnippet collections component converter database development dice digit ebook eclipse equation error event formatingtextintooltipjava fractal functiontesting game givemetehcodez graphics gui health html hyper ide idea image infinite input int integer invokingapacheantprogrammatically j2me java javame javaprojects jni jpanel julia linux list loop looping main map method methods mobile myregfun mysql netbeans newbie nonstatic openjavafx parameter pearl php problem program programming project recursion repositories scanner scrollbar server set sms sort sorting spamblocker sql sqlserver state storm string superclass swing swt text-file thread threads tree windows






