Example #1
0
 @Override
 public void closeTextPanel() {
   // Confirm save before open another file
   if (this.isContentChanged()) {
     int ans =
         JOptionPane.showConfirmDialog(
             this,
             "The contents of "
                 + CurrentFileName
                 + " has been modified. \nDo you want to save the changes?",
             "Save to file?",
             JOptionPane.YES_NO_CANCEL_OPTION);
     if (ans == JOptionPane.CANCEL_OPTION) {
       return;
     } else if (ans == JOptionPane.YES_OPTION) {
       this.cmdSaveActionPerformed(null);
     }
   }
   if (ContainerComponent instanceof Frame) {
     ((Frame) ContainerComponent).dispose();
   } else if (ContainerComponent instanceof Dialog) {
     ((Dialog) ContainerComponent).dispose();
   } else if (ContainerComponent instanceof JTabbedPane && TabId > 0) {
     // ((JTabbedPane)ContainerComponent).remove(this.TabId);
     ((JTabbedPane) ContainerComponent).remove(this);
     TabId = 0;
   }
 }
 /**
  * Method for removing a Panel by object reference
  *
  * @param object The object to remove
  */
 public void removePanel(GPropertiesPanel object) {
   pane.remove(object);
   objects.remove(object);
 }
 /**
  * Method for removing a Panel by index reference
  *
  * @param index The index of the object to remove
  */
 public void removePanel(int index) {
   pane.remove((GPropertiesPanel) objects.get(index));
   objects.remove(index);
 }