* make sure window task bar icons are not visible on Linux / Windows (no such thing on Mac anyway)
This commit is contained in:
parent
7269939ad3
commit
20de652f11
|
@ -9,7 +9,6 @@ import static net.filebot.util.ui.SwingUI.*;
|
||||||
|
|
||||||
import java.awt.Desktop;
|
import java.awt.Desktop;
|
||||||
import java.awt.Dialog.ModalityType;
|
import java.awt.Dialog.ModalityType;
|
||||||
import java.awt.Image;
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.WindowAdapter;
|
import java.awt.event.WindowAdapter;
|
||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
|
@ -30,8 +29,6 @@ import java.security.PermissionCollection;
|
||||||
import java.security.Permissions;
|
import java.security.Permissions;
|
||||||
import java.security.Policy;
|
import java.security.Policy;
|
||||||
import java.security.ProtectionDomain;
|
import java.security.ProtectionDomain;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
@ -277,11 +274,7 @@ public class Main {
|
||||||
MacAppUtilities.setDefaultMenuBar(FileBotMenuBar.createHelp());
|
MacAppUtilities.setDefaultMenuBar(FileBotMenuBar.createHelp());
|
||||||
} else {
|
} else {
|
||||||
// Windows / Linux specific configuration
|
// Windows / Linux specific configuration
|
||||||
List<Image> images = new ArrayList<Image>(3);
|
frame.setIconImages(ResourceManager.getApplicationIcons());
|
||||||
for (String i : new String[] { "window.icon.large", "window.icon.medium", "window.icon.small" }) {
|
|
||||||
images.add(ResourceManager.getImage(i));
|
|
||||||
}
|
|
||||||
frame.setIconImages(images);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// start application
|
// start application
|
||||||
|
|
|
@ -1,23 +1,22 @@
|
||||||
|
|
||||||
package net.filebot;
|
package net.filebot;
|
||||||
|
|
||||||
|
import static java.util.Arrays.*;
|
||||||
|
|
||||||
import java.awt.Image;
|
import java.awt.Image;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import javax.swing.Icon;
|
import javax.swing.Icon;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
|
|
||||||
|
|
||||||
public final class ResourceManager {
|
public final class ResourceManager {
|
||||||
|
|
||||||
public static Icon getIcon(String name) {
|
public static Icon getIcon(String name) {
|
||||||
return getIcon(name, null);
|
return getIcon(name, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static Icon getIcon(String name, String def) {
|
public static Icon getIcon(String name, String def) {
|
||||||
URL resource = getImageResource(name, def);
|
URL resource = getImageResource(name, def);
|
||||||
|
|
||||||
|
@ -27,12 +26,18 @@ public final class ResourceManager {
|
||||||
return new ImageIcon(resource);
|
return new ImageIcon(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<Image> getApplicationIcons() {
|
||||||
|
Image[] images = new Image[3];
|
||||||
|
images[0] = ResourceManager.getImage("window.icon.small");
|
||||||
|
images[1] = ResourceManager.getImage("window.icon.medium");
|
||||||
|
images[2] = ResourceManager.getImage("window.icon.large");
|
||||||
|
return asList(images);
|
||||||
|
}
|
||||||
|
|
||||||
public static Icon getFlagIcon(String languageCode) {
|
public static Icon getFlagIcon(String languageCode) {
|
||||||
return getIcon(String.format("flags/%s", languageCode));
|
return getIcon(String.format("flags/%s", languageCode));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static Image getImage(String name) {
|
public static Image getImage(String name) {
|
||||||
try {
|
try {
|
||||||
return ImageIO.read(getImageResource(name));
|
return ImageIO.read(getImageResource(name));
|
||||||
|
@ -41,19 +46,17 @@ public final class ResourceManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the URL of an image resource in this jar. Image must be located in <code>resources/</code> and the file type
|
* Get the URL of an image resource in this jar. Image must be located in <code>resources/</code> and the file type is assumed to be png.
|
||||||
* is assumed to be png.
|
|
||||||
*
|
*
|
||||||
* @param name simple name of the resource (without extension)
|
* @param name
|
||||||
|
* simple name of the resource (without extension)
|
||||||
* @return URL of the resource or null if resource does not exist
|
* @return URL of the resource or null if resource does not exist
|
||||||
*/
|
*/
|
||||||
private static URL getImageResource(String name) {
|
private static URL getImageResource(String name) {
|
||||||
return ResourceManager.class.getResource("resources/" + name + ".png");
|
return ResourceManager.class.getResource("resources/" + name + ".png");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static URL getImageResource(String name, String def) {
|
private static URL getImageResource(String name, String def) {
|
||||||
URL resource = getImageResource(name);
|
URL resource = getImageResource(name);
|
||||||
|
|
||||||
|
@ -63,7 +66,6 @@ public final class ResourceManager {
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dummy constructor to prevent instantiation.
|
* Dummy constructor to prevent instantiation.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package net.filebot.ui;
|
package net.filebot.ui;
|
||||||
|
|
||||||
|
import static net.filebot.Settings.*;
|
||||||
|
|
||||||
import java.awt.Desktop;
|
import java.awt.Desktop;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
@ -12,6 +14,7 @@ import javafx.scene.paint.Color;
|
||||||
import javafx.scene.web.WebEngine;
|
import javafx.scene.web.WebEngine;
|
||||||
import javafx.scene.web.WebView;
|
import javafx.scene.web.WebView;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
import javafx.stage.StageStyle;
|
||||||
import net.filebot.Main;
|
import net.filebot.Main;
|
||||||
import net.filebot.Settings;
|
import net.filebot.Settings;
|
||||||
|
|
||||||
|
@ -26,6 +29,14 @@ public class GettingStartedStage {
|
||||||
Stage stage = new Stage();
|
Stage stage = new Stage();
|
||||||
stage.setResizable(false);
|
stage.setResizable(false);
|
||||||
|
|
||||||
|
if (isMacApp()) {
|
||||||
|
// Mac OS X specific configuration
|
||||||
|
stage.initStyle(StageStyle.DECORATED);
|
||||||
|
} else {
|
||||||
|
// Windows / Linux specific configuration
|
||||||
|
stage.initStyle(StageStyle.UTILITY);
|
||||||
|
}
|
||||||
|
|
||||||
GettingStartedStage view = new GettingStartedStage(stage);
|
GettingStartedStage view = new GettingStartedStage(stage);
|
||||||
view.show();
|
view.show();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue