From: Patrick B. <bi...@st...> - 2004-02-09 13:10:14
|
Hi Guys, This is how it is in java... public void setSystemLookAndFeel() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException ex) { ex.printStackTrace(); } catch (InstantiationException ex) { ex.printStackTrace(); } catch (IllegalAccessException ex) { ex.printStackTrace(); } catch (UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } } And this is how it is in my jython-module... try: swing.UIManager.setLookAndFeel(swing.UIManager.getSystemLookAndFeelClassName ()) except: print "set look and feel failed" But how can you trap the various kinds of errors ??? For example, when it is a ClassNotFoundException, how do i trap this in the except to print various output to the console when various errors occour ? so it it okay to use... except ClassNotFoundException: print "Class not Found" except InstantiationException: print "InstantiationException" except IllegalAccessException: print "Illegal Access to Class" except UnsupportedLookAndFeelException: print "Provided look and feel is not supported" or is there a better solution ? Strange that this code works anyway in jython, cause java normally requires you to add all the exceptions in the code. If avoiding to add one of them results in a compile error on javac, telling that you need to obtain all the exceptions. Best Regards, Sysop/Java-programmer Stafa Holland BV Administrator/Programmer Memoranda-project (SourceForge) Programmer TN5250J-project (SourceForge) Programmer DBPirate-project (Java.net) |