Class Utils

java.lang.Object
ece.ing3.java.projet.utils.Utils

public class Utils extends Object
Utility functions
Author:
Virgile, Nicolas, Louis-Félix
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    confirm(String title, String message)
    Demande à l'utilisateur un choix
    static boolean
    confirm(JFrame parent, String title, String message)
    Demande à l'utilisateur un choix
    static void
    error(String message)
    Affiche un message d'erreur à l'utilisateur
    static void
    error(JFrame parent, String message)
    Affiche un message d'erreur à l'utilisateur
    static Image
    Get a resource's stream from a path relative to either the execution directory, JAR, or other paths supported by the JVM.
    Get a resource's stream from a path relative to either the execution directory, JAR, or other paths supported by the JVM.
    static String
    Get a resource's stream from a path relative to either the execution directory, JAR, or other paths supported by the JVM.
    static void
    message(String message)
    Affiche un message général à l'utilisateur
    static void
    message(JFrame parent, String message)
    Affiche un message général à l'utilisateur

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Utils

      public Utils()
  • Method Details

    • getResource

      public static InputStream getResource(String path) throws IOException
      Get a resource's stream from a path relative to either the execution directory, JAR, or other paths supported by the JVM.
      Parameters:
      path - Relative resource path
      Returns:
      Resource's stream
      Throws:
      IOException - Resource not found at the provided path
    • getImageResource

      public static Image getImageResource(String path) throws IOException
      Get a resource's stream from a path relative to either the execution directory, JAR, or other paths supported by the JVM.
      Parameters:
      path - Relative resource path
      Returns:
      Resource's stream
      Throws:
      IOException - Loading error
    • getTextResource

      public static String getTextResource(String path) throws IOException
      Get a resource's stream from a path relative to either the execution directory, JAR, or other paths supported by the JVM.
      Parameters:
      path - Relative resource path
      Returns:
      Resource's stream
      Throws:
      IOException - Loading error
    • message

      public static void message(String message)
      Affiche un message général à l'utilisateur
      Parameters:
      message - Message à afficher
    • message

      public static void message(JFrame parent, String message)
      Affiche un message général à l'utilisateur
      Parameters:
      parent - Fenêtre parente
      message - Message à afficher
    • error

      public static void error(String message)
      Affiche un message d'erreur à l'utilisateur
      Parameters:
      message - Message d'erreur à afficher
    • error

      public static void error(JFrame parent, String message)
      Affiche un message d'erreur à l'utilisateur
      Parameters:
      parent - Fenêtre parente
      message - Message d'erreur à afficher
    • confirm

      public static boolean confirm(String title, String message)
      Demande à l'utilisateur un choix
      Parameters:
      title - Titre de la boîte de dialogue
      message - Message à afficher
    • confirm

      public static boolean confirm(JFrame parent, String title, String message)
      Demande à l'utilisateur un choix
      Parameters:
      parent - Fenêtre parente
      title - Titre de la boîte de dialogue
      message - Message à afficher