The list of methods to do Desktop are organized into topic(s).
void
browse(File file, Component component) Browse to a folder.
try {
Desktop.getDesktop().browse(new URL("file://" + file.getAbsolutePath()).toURI());
} catch (IOException e) {
JOptionPane.showMessageDialog(component,
"Unable to open '" + file.getAbsolutePath() + "'. Maybe it doesn't exist?", "Open failed",
JOptionPane.ERROR_MESSAGE);
} catch (URISyntaxException e) {
JMenu
build(File appDir) build
JMenu helpMenu = new JMenu("Help");
JMenu manuals = buildManualsMenu(appDir);
if (manuals.getItemCount() > 0) {
helpMenu.add(manuals);
helpMenu.addSeparator();
helpMenu.add(buildWebsiteMenuItem());
helpMenu.add(buildForumMenuItem());
...
void
centerOnDesktop(Component comp, Component parent, boolean bAdjust) Centers a child window or dialog on a JDesktopPane.
if (!(parent instanceof JDesktopPane)) {
center(comp, parent, bAdjust);
} else {
JViewport jvp = (JViewport) parent.getParent();
final Dimension dimParentSize = jvp.getSize();
final Point pParentLocation = jvp.getViewPosition();
placeComponent(comp, pParentLocation, dimParentSize, bAdjust);
boolean
openFile(String filePath) open File
File exec = new File(filePath);
if (exec.exists()) {
try {
Desktop.getDesktop().open(exec);
} catch (IOException e) {
logError(e);
return false;
} else {
showMessage("file_not_found", filePath);
return false;
return true;