public ContextMenuFileChooser() {
super();
popup.add(new DeleteAction(this));
popup.add(new NewFolderAction(this));
right_click_pane = new RightClickGlassPane(this,popup) {
protected void redispatchMouseEvent
(MouseEvent e,
boolean repaint
) {
Component component
= getRealComponent
(e.
getPoint());
if(component == null) { return; }
"javax.swing.plaf.metal.MetalFileChooserUI$5";
if(component.getClass().getName().equals(chooser_class)) {
super.redispatchMouseEvent(e,repaint);
} else {
doDispatch(e);
}
}
};
}
JDialog dialog
= super.
createDialog(parent
);
// create the right-click glass pane.
dialog.setGlassPane(right_click_pane);
right_click_pane.setVisible(true);
return dialog;
}
super("Delete");
this.chooser = chooser;
}
File file
= chooser.
getSelectedFile();
if(file != null) {
file.delete();
chooser.rescanCurrentDirectory();
}
}
}
super("New Folder");
this.chooser = chooser;
}
File cwd
= chooser.
getCurrentDirectory();
if(cwd != null) {
File new_dir
= new File(cwd,
"New Folder");
new_dir.mkdir();
chooser.rescanCurrentDirectory();
}
}
}
}
public static void main
(String[] args
) {
jfc.showOpenDialog(null);
}
//java/1331