exceptions, GUI - COP 3330 Slides 3/3 Topics Creating your...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
Slides 3/3 COP 3330
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Topics Creating your own exceptions GUI
Background image of page 2
Creating Exceptions Exceptions are defined just like any other class Exceptions must inherit either directly or indirectly from Exception
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Creating Exceptions Example // Checked exception public class MyException extends Exception{ public MyException(String message){ super(message); } }
Background image of page 4
Creating Exceptions Example public void foo(int x) throws MyException { if(x < 0) throw new MyException("x was negative"); else System.out.println("foo"); } public void bar(int x){ try{ foo(x); }catch(MyException e){ System.out.println(e); } }
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
A Good Design … is aesthetically pleasing
Background image of page 6
GUI GUI stands for Graphical User Interface One of Java's advantages is its comparatively easy GUI construction - Note the use of the word "comparatively"
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
GUI Java has two packages in particular that are geared towards GUI design - java.awt: Provides everything you really need if you've got the skill - javax.swing: Designed to make GUI programming easier
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 21

exceptions, GUI - COP 3330 Slides 3/3 Topics Creating your...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online