Projects STRLCPY vucsa Commits c81a5065
🤬
  • ■ ■ ■ ■ ■ ■
    vucsa-client/src/main/java/com/warxim/vucsa/client/gui/GuiApplication.java
    skipped 26 lines
    27 27  import javafx.scene.Scene;
    28 28  import javafx.stage.Stage;
    29 29   
     30 +import javax.imageio.ImageIO;
     31 +import java.awt.Taskbar;
     32 +import java.util.logging.Level;
     33 +import java.util.logging.Logger;
     34 + 
    30 35  /**
    31 36   * Client GUI application.
    32 37   * <p>Starts Vulnerable Client GUI.</p>
    skipped 1 lines
    34 39  public class GuiApplication extends Application {
    35 40   @Override
    36 41   public void start(Stage stage) throws Exception {
     42 + setupIcons(stage);
     43 + 
    37 44   Application.setUserAgentStylesheet(Application.STYLESHEET_MODENA);
    38 45   StyleManager.getInstance().addUserAgentStylesheet(getClass().getResource(GuiConstant.MAIN_CSS_PATH).toString());
    39 46   
    skipped 7 lines
    47 54   
    48 55   var scene = new Scene(root);
    49 56   stage.setTitle("VuCSA Client v" + Constant.VERSION);
    50  - stage.getIcons().add(GuiBundle.getInstance().getLogo());
    51 57   stage.setWidth(1200);
    52 58   stage.setHeight(900);
    53 59   stage.setScene(scene);
    skipped 12 lines
    66 72   
    67 73   Bundle.getInstance().destroy();
    68 74   GuiBundle.getInstance().destroy();
     75 + }
     76 + 
     77 + /**
     78 + * Sets up icons for the application
     79 + */
     80 + protected void setupIcons(Stage stage) {
     81 + // Set stage icons (WIN, LINUX)
     82 + stage.getIcons().add(GuiBundle.getInstance().getLogo());
     83 + 
     84 + // Little workaround to set icons for macOS taskbar using AWT
     85 + try {
     86 + if (!Taskbar.isTaskbarSupported()) {
     87 + return;
     88 + }
     89 + var iconImage = ImageIO.read(getClass().getResourceAsStream(GuiConstant.ICON_PATH));
     90 + var taskbar = Taskbar.getTaskbar();
     91 + taskbar.setIconImage(iconImage);
     92 + } catch (Exception e) {
     93 + Logger.getGlobal().log(Level.SEVERE, "Could not set taskbar icon!", e);
     94 + }
    69 95   }
    70 96  }
    71 97   
  • ■ ■ ■ ■
    vucsa-client/src/main/java/com/warxim/vucsa/client/gui/GuiBundle.java
    skipped 48 lines
    49 49   private HostServices hostServices;
    50 50   
    51 51   private GuiBundle() {
    52  - logo = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/img/Logo.png")));
     52 + logo = new Image(Objects.requireNonNull(getClass().getResourceAsStream(GuiConstant.ICON_PATH)));
    53 53   }
    54 54   
    55 55   /**
    skipped 54 lines
  • ■ ■ ■ ■ ■
    vucsa-client/src/main/java/com/warxim/vucsa/client/gui/GuiConstant.java
    skipped 20 lines
    21 21   * Path to main CSS file of the application
    22 22   */
    23 23   public static final String MAIN_CSS_PATH = "/css/Main.css";
     24 + public static final String ICON_PATH = "/img/Logo.png";
    24 25   
    25 26   public static final int LOG_TAB_ORDER = 1;
    26 27   public static final int SETTINGS_TAB_ORDER = 2;
    skipped 5 lines
Please wait...
Page is in error, reload to recover