Java 操作侦听器/抛出IOException冲突

Java 操作侦听器/抛出IOException冲突,java,actionlistener,ioexception,Java,Actionlistener,Ioexception,我试图为一个程序制作一个GUI,该程序可以从随机访问文件中读取和写入信息,并随意显示。除了GUI,我不能操作任何东西,并且必须引用预构建的方法。如果这些方法确实不可用,那么我可以破例 我遇到的问题是在写入文件时处理IOException public static class EdtButtonHandler implements ActionListener { public void actionPerformed(ActionEvent e)

我试图为一个程序制作一个GUI,该程序可以从随机访问文件中读取和写入信息,并随意显示。除了GUI,我不能操作任何东西,并且必须引用预构建的方法。如果这些方法确实不可用,那么我可以破例

我遇到的问题是在写入文件时处理IOException

public static class  EdtButtonHandler implements ActionListener 
    {


        public void actionPerformed(ActionEvent e) 
        {

            if (e.getActionCommand().equals("Confirm")) //if the confirm button is pressed
            {

                    writeAll(); //runs all write methods using the strings from the text field

                frameAddMovie.setVisible(false);
            }
writeAll指的是一系列根据传递的字符串从文件写入的方法,这些字符串来自我的GUI窗口上的文本字段。它们看起来都像这样

public static void writeDirector(int recordNum, String directorIn)throws IOException
    {
        int position;
        RandomAccessFile recordFile = new RandomAccessFile("RecordFile", "rw");
        position = recSize * (recordNum-1)+32; // read 32 spaces into the record to the start of the director line
        recordFile.seek(position);
        recordFile.writeBytes(directorIn);

    }
在按下确认按钮并运行writeAll时,抛出的IOException无法用方法或类捕获

if (e.getActionCommand().equals("Confirm")) //if the confirm button is pressed
你不想这样吗


如果e.getSource=buttonname

您能给出完整的异常,如IOException File Not found或任何其他异常吗?