Customize JOptionPane Dialog
问题 I am learning java swing. The code below is a catch block which handles an IOException and shows a error message. catch(IOException e) { System.out.println("IOException"); JOptionPane.showMessageDialog(null,"File not found",null, JOptionPane.ERROR_MESSAGE); } I was thinking of declaring and customizing a JOptionPane of my own inside the catch block like the code below: JOptionPane jop=new JOptionPane(); jop.setLayout(new BorderLayout()); JLabel im=new JLabel("Java Technology Dive Log", new