How to generate exceptions from RepaintManager

后端 未结 2 1981
[愿得一人]
[愿得一人] 2020-11-22 04:59

In connection with my question (may be), I found another exception type that I not able to catch and print-out from SwingWorker thread.

2条回答
  •  一向
    一向 (楼主)
    2020-11-22 05:20

    Create your own Exception

    class RepaintManagerException extends Exception
    {
       String msg;
    
       RepaintManagerException()
       {
            msg = new String("type message here");
        }
    }
    

    Usage

    public class My_Exception
    {
        public static void main (String args [ ])
        {
            try
            {
                // your code
    
                if (expression) throw new RepaintManagerException( );
            }
            catch (RepaintManagerException e)
            {
            System.out.println (e);
            }
        }
    }
    

提交回复
热议问题