InstantLauncher.exitProgram();
} catch (final IOException e) {
- ExceptionDialog.showException(e);
+ new ExceptionDialog(e);
}
return true;
final InstantLauncher instantLauncher = new InstantLauncher();
instantLauncher.run();
} catch (final Exception e) {
- ExceptionDialog.showException(e);
+ new ExceptionDialog(e);
}
}
import java.awt.BorderLayout;
import java.awt.Dimension;
-import java.awt.Point;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
public class MainFrame {
- public static class FrameWindowListener implements WindowListener {
-
- @Override
- public void windowActivated(final WindowEvent e) {
- }
-
- @Override
- public void windowClosed(final WindowEvent e) {
- }
-
- @Override
- public void windowClosing(final WindowEvent e) {
- InstantLauncher.exitProgram();
- }
-
- @Override
- public void windowDeactivated(final WindowEvent e) {
- }
-
- @Override
- public void windowDeiconified(final WindowEvent e) {
- }
-
- @Override
- public void windowIconified(final WindowEvent e) {
- }
-
- @Override
- public void windowOpened(final WindowEvent e) {
- }
-
- }
-
private JFrame frame;
private boolean isShowing;
public static final Dimension CONTENT_PANEL_SIZE = new Dimension(1100, 850);
- public static final Point INITIAL_LOCATION = new Point(100, 30);
private final InstantLauncher instantLauncher;
buildContentPane();
- frame.setSize(CONTENT_PANEL_SIZE);
- frame.setVisible(true);
- frame.setLocation(INITIAL_LOCATION);
-
// registor window listener
final FrameWindowListener windowListener = new FrameWindowListener();
frame.addWindowListener(windowListener);
// maximize window
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
+ frame.setVisible(true);
isShowing = true;
}
}
+ public static class FrameWindowListener implements WindowListener {
+
+ @Override
+ public void windowActivated(final WindowEvent e) {
+ }
+
+ @Override
+ public void windowClosed(final WindowEvent e) {
+ }
+
+ @Override
+ public void windowClosing(final WindowEvent e) {
+ InstantLauncher.exitProgram();
+ }
+
+ @Override
+ public void windowDeactivated(final WindowEvent e) {
+ }
+
+ @Override
+ public void windowDeiconified(final WindowEvent e) {
+ }
+
+ @Override
+ public void windowIconified(final WindowEvent e) {
+ }
+
+ @Override
+ public void windowOpened(final WindowEvent e) {
+ }
+
+ }
+
}
buildContentPanel(directory);
};
- /**
- * <pre>
- * Assign specific colors to:
- * Directory
- * Executable file
- * Non executable file
- * </pre>
- */
- public static Color getFileColor(final File file, final boolean selected) {
- if (file.isDirectory()) {
- if (selected) {
- return BUTTON_BG_DIRECTORY_SELECTED;
- } else {
- return BUTTON_BG_DIRECTORY;
- }
- }
-
- if (file.isFile()) {
- if (file.canExecute()) {
- if (selected) {
- return BUTTON_BG_EXECUTABLE_FILE_SELECTED;
- } else {
- return BUTTON_BG_EXECUTABLE_FILE;
- }
- } else {
- if (selected) {
- return BUTTON_BG_NONEXECUTABLE_FILE_SELECTED;
- } else {
- return BUTTON_BG_NONEXECUTABLE_FILE;
- }
- }
- }
-
- if (selected) {
- return BUTTON_BG_LINK_SELECTED;
- } else {
- return BUTTON_BG_LINK;
- }
- }
-
public void addMenuListener(final MenuListener menuListener) {
menuListeners.add(menuListener);
}
this.selectedFile = selectedFile;
}
+ /**
+ * <pre>
+ * Assign specific colors to:
+ * Directory
+ * Executable file
+ * Non executable file
+ * </pre>
+ */
+ public static Color getFileColor(final File file, final boolean selected) {
+ if (file.isDirectory()) {
+ if (selected) {
+ return BUTTON_BG_DIRECTORY_SELECTED;
+ } else {
+ return BUTTON_BG_DIRECTORY;
+ }
+ }
+
+ if (file.isFile()) {
+ if (file.canExecute()) {
+ if (selected) {
+ return BUTTON_BG_EXECUTABLE_FILE_SELECTED;
+ } else {
+ return BUTTON_BG_EXECUTABLE_FILE;
+ }
+ } else {
+ if (selected) {
+ return BUTTON_BG_NONEXECUTABLE_FILE_SELECTED;
+ } else {
+ return BUTTON_BG_NONEXECUTABLE_FILE;
+ }
+ }
+ }
+
+ if (selected) {
+ return BUTTON_BG_LINK_SELECTED;
+ } else {
+ return BUTTON_BG_LINK;
+ }
+ }
+
public static class ButtonMouseListener implements MouseListener {
JButton parentButton;
parentMenu.notifyAlternativeEventListeners(file);
}
} catch (final Exception ex) {
- ExceptionDialog.showException(ex);
+ new ExceptionDialog(ex);
}
}
}
}
} catch (final Exception ex) {
- ExceptionDialog.showException(ex);
+ new ExceptionDialog(ex);
}
}
Runtime.getRuntime().exec(c);
InstantLauncher.exitProgram();
} catch (final IOException e) {
- ExceptionDialog.showException(e);
+ new ExceptionDialog(e);
}
} else {
InstantLauncher.exitProgram();
} catch (final IOException e) {
- ExceptionDialog.showException(e);
+ new ExceptionDialog(e);
}
} else {
chosenFile.setExecutable(!chosenFile.canExecute());