1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-24 00:38:52 -05:00

* allow switching between filebot app and groovy pad app

This commit is contained in:
Reinhard Pointner 2014-03-07 17:42:40 +00:00
parent 97263aa5d3
commit db75f66b7b
2 changed files with 38 additions and 8 deletions

View File

@ -51,6 +51,12 @@ public class GroovyPad extends JFrame {
public GroovyPad() throws IOException {
super("Groovy Pad");
List<Image> images = new ArrayList<Image>(3);
for (String i : new String[] { "window.icon.large", "window.icon.medium", "window.icon.small" }) {
images.add(ResourceManager.getImage(i));
}
setIconImages(images);
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, createEditor(), createOutputLog());
splitPane.setResizeWeight(0.7);
@ -327,12 +333,6 @@ public class GroovyPad extends JFrame {
try {
GroovyPad pad = new GroovyPad();
List<Image> images = new ArrayList<Image>(3);
for (String i : new String[] { "window.icon.large", "window.icon.medium", "window.icon.small" }) {
images.add(ResourceManager.getImage(i));
}
pad.setIconImages(images);
// ignore analytics in developer mode
Analytics.setEnabled(false);

View File

@ -7,6 +7,8 @@ import static javax.swing.ScrollPaneConstants.*;
import static net.sourceforge.filebot.ui.NotificationLogging.*;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dialog.ModalExclusionType;
import java.awt.FlowLayout;
import java.awt.Image;
import java.awt.dnd.DropTarget;
@ -15,8 +17,13 @@ import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetEvent;
import java.awt.event.ActionEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.AbstractAction;
import javax.swing.JComponent;
@ -117,8 +124,31 @@ public class MainFrame extends JFrame {
@Override
public void actionPerformed(ActionEvent evt) {
MainFrame.this.setVisible(false);
GroovyPad.main(new String[0]);
try {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); // loading Groovy might take a while
GroovyPad pad = new GroovyPad();
pad.addWindowListener(new WindowAdapter() {
public void windowOpened(WindowEvent e) {
MainFrame.this.setState(ICONIFIED);
MainFrame.this.setVisible(false);
};
public void windowClosing(WindowEvent e) {
MainFrame.this.setVisible(true);
MainFrame.this.setState(NORMAL);
};
});
pad.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
pad.setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE);
pad.setLocationByPlatform(true);
pad.setVisible(true);
} catch (IOException e) {
Logger.getLogger(GroovyPad.class.getName()).log(Level.WARNING, e.getMessage(), e);
} finally {
setCursor(Cursor.getDefaultCursor());
}
}
});
}