public void deletePage(int i) {
        if (this.numPages == 0) {
            return;
        }
        this.pages.get(i).destroyPage();
        this.pages.remove(i);
        for (int x=0; x < this.pages.size(); x++) {
            this.pages.get(x).setIndex(x);
        }

        this.numPages--;
        this.curPage--;
        if (curPage <= 0) {
            curPage = 0;
        }
        if (this.numPages == 0) {
            if (this.deviceFrame != null) {
                this.deviceFrame.enableMidiMenu(false);
                deviceFrame.clearPage();
            }
        } else {
            switchPage(pages.get(curPage), curPage, true);
        }
        String[] pageNames = new String[this.pages.size()];
        for (int i1 = 0; i1 < this.pages.size(); i1++) {
            TPage tmpPage = this.pages.get(i1);
            String pageName = tmpPage.getName();
            pageNames[i1] = pageName;
        }
        if (this.deviceFrame != null) {
            this.deviceFrame.updateShowPageMenuItems(pageNames);
        }
    }