Stefan Schuermans commited on 2013-11-26 22:06:20
Showing 2 changed files, with 30 additions and 1 deletions.
... | ... |
@@ -237,6 +237,32 @@ public class Blimp extends JApplet |
237 | 237 |
updateFrames( 0 ); |
238 | 238 |
} |
239 | 239 |
|
240 |
+ //check file name and issue warning if it is not a known file type |
|
241 |
+ private void checkFilenameAndWarn( String filename ) |
|
242 |
+ { |
|
243 |
+ boolean warn = false; |
|
244 |
+ if( filename.length() < 4 ) { |
|
245 |
+ warn = true; |
|
246 |
+ } else { |
|
247 |
+ String ending = filename.substring(filename.length() - 4); |
|
248 |
+ warn = ! ending.equals(".blm") && |
|
249 |
+ ! ending.equals(".bmm") && |
|
250 |
+ ! ending.equals(".bml") && |
|
251 |
+ ! ending.equals(".bbm"); |
|
252 |
+ } |
|
253 |
+ if( warn ) { |
|
254 |
+ JOptionPane.showMessageDialog( dialogParent, |
|
255 |
+ "Blimp supports 4 different file types:\n" + |
|
256 |
+ "*.bml: Blinkenlights Movie (classic format)\n" + |
|
257 |
+ "*.bmm: BLINKENmini Movie\n" + |
|
258 |
+ "*.bml: Blinkenlights Markup Language (newer XML format)\n" + |
|
259 |
+ "*.bbm: Binary Blinken Movie (smaller and faster)\n" + |
|
260 |
+ "Please make sure your filename has one of those endings!\n", |
|
261 |
+ "Blimp - Supported File Types...", |
|
262 |
+ JOptionPane.INFORMATION_MESSAGE ); |
|
263 |
+ } |
|
264 |
+ } |
|
265 |
+ |
|
240 | 266 |
//load file (filename is taken from curFile) |
241 | 267 |
private void fileLoad( ) |
242 | 268 |
{ |
... | ... |
@@ -250,6 +276,7 @@ public class Blimp extends JApplet |
250 | 276 |
} |
251 | 277 |
else |
252 | 278 |
{ |
279 |
+ checkFilenameAndWarn( curFile.getPath( ) ); |
|
253 | 280 |
//some error |
254 | 281 |
if( frame != null ) |
255 | 282 |
frame.setTitle( "Blimp" ); |
... | ... |
@@ -320,6 +347,7 @@ public class Blimp extends JApplet |
320 | 347 |
} |
321 | 348 |
else |
322 | 349 |
{ |
350 |
+ checkFilenameAndWarn( curFile.getPath( ) ); |
|
323 | 351 |
//some error |
324 | 352 |
labelStatus.setText( "movie \"" + curFile.getPath( ) + "\" could not be saved..." ); |
325 | 353 |
} |
... | ... |
@@ -800,6 +828,7 @@ public class Blimp extends JApplet |
800 | 828 |
movie = new BlinkenMovie( 0, 0, 0, 0 ); |
801 | 829 |
if( ! movie.load( fileChooser.getSelectedFile( ).getPath( ) ) ) |
802 | 830 |
{ |
831 |
+ checkFilenameAndWarn( fileChooser.getSelectedFile( ).getPath( ) ); |
|
803 | 832 |
//some error |
804 | 833 |
labelStatus.setText( "movie \"" + fileChooser.getSelectedFile( ).getPath( ) + "\" could not be imported..." ); |
805 | 834 |
} |
806 | 835 |