![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Programmer
Join Date: Nov 2005
Posts: 35
Rep Power: 0
![]() |
Exception troubles dealing with GUIs
I've written an application that runs fine from a console, so I am now building a GUI on top of it.
When the user clicks on the "Run" button I provide, the GUI takes 3 strings (paths and file names) the user inputted and passes them off to the rest of the program. The methods that handle the files can throw FileNotFound and IO Exceptions. Here is the method that passes control from the GUI to the rest of the program: private void runWidgetSelected(SelectionEvent evt) throws IOException {
try{
BandTrack.runFromGUI(rosterLoc.getText(), swipeLoc.getText(),
exportLoc.getText());
}
catch (IOException e){
e.printStackTrace();
}
}The problem that I am having is with the Listener that checks to see if the Run button has been selected: run = new Button(this, SWT.PUSH | SWT.CENTER);
run.setText("Run!");
run.setBounds(280, 147, 63, 21);
run.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) throws IOException {
runWidgetSelected(evt);
}
});Eclipse has that block underlined with the message "Exception IOException is not compatible with throws clause in SelectionAdapter.widgetSelected (SelectionEvent)." What does that mean? What is the way that it should be fixed? |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|