> Inhalt: JavaScout Base-System (JSBS)

JSBS_SystemServices – Basisklasse mit Methoden für die Abfrage von Betriebssystem-Parametern

* Bitte beachten Sie die Hinweise und Bestimmungen bezüglich Urheberrecht, Haftungsausschluß und geschützte Marken oder Warenzeichen die für dieses Web-Dokument und möglicherweise auch für 'verlinkte' Dokumente gelten.

  • Der Betreiber dieser Web-Site (www.javascout.biz) ist nicht verantwortlich für den Inhalt von Web-Sites, die innerhalb dieses Web-Dokumentes oder anderer Dokumente von www.javascout.biz verlinkt sind.

  • Wenn dieses Web-Dokument oder andere Dokumente dieser Web-Site (www.javascout.biz) Rechte von Ihnen verletzen, oder sie glauben, dass Rechte Anderer (Dritter Personen) dadurch verletzt werden, informieren Sie bitte den Betreiber dieser Web-Site.
    Eine E-Mail können Sie ganz einfach durch anklicken des Symbols oder Textes im Frame rechts oben senden.

Dieses Dokument drucken.

 Letzte Bearbeitung dieses  Dokuments:
2010-10-14

Inhaltsverzeichnis

Code 
Erklärungen und Anwendungsbeispiele 
Verwandte Dokumentation
 

Code

package js_base.utilities;
 
import
java.awt.*;
import java.awt.event.*;
import java.util.*;
import
javax.swing.*;
 
import
js_base.frame.*;
import
js_base.structures.JSBS_UniversalParameters;
/**
 *
 * @author kurt[at]javascout(dot)biz
 * @date 2007-05-29
 *
 * @description
 *  Class with static methods that are closely related to the Operating-System
 *  or common functionality
 *  Among many others, methods of this class are like:
 *  * deriving the available Fonts for text;
 *  * defining selectable colors for GUI-Elements;
 *  * deriving the name of the Operating-System;
 
*  * deriving the name of the Logged-On User.
 *
 * @change-log
 * when         who               why
 * --------------------------------------------------------
 *
 */

public class JSBS_SystemServices {
/*
 * --------------------
 * Section for the FONT-NAMES available at the System.
 * -------------------- */
/*
 * --------------------
 
* Method to derive the available Fonts (character sets for letters)
 * that are defined within the Operating-System.
 * The list of Font-Names is returned in the form of an array of Strings. */
    public static String[] getFontNameArray() {
/* Define a 'GraphicsEnvironment' as the array of available Fonts is derived from it. */
      GraphicsEnvironment locGraphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
/* Define the Array that is returned and fill it with the available Fonts. */
      String[] arrayFontList = locGraphicsEnvironment.getAvailableFontFamilyNames();
/* Return the Array. */
      
return arrayFontList;
  
  }
/*
 * --------------------
 * Method to derive the available Fonts (character sets for letters)
 * that are defined within the Operating-System.
 * The list of Font-Names is returned in the form of Strings as elements of a Vector. */
    public static Vector getFontNameVector() {
/* Define an array of Strings and use the existing method to fill it. */
      String[] arrayFontList = getFontNameArray();
/* Define the Vector that is returned */
      Vector vecFontList = new Vector();
/* Read the Font-Names out of the array and fill the Vector. */
      
int intArraySize = arrayFontList.length;
      for (int intArrayIndex = 0; intArrayIndex < intArraySize; intArrayIndex++) {
        String strFontName = arrayFontList[intArrayIndex];
        vecFontList.addElement(strFontName);
      }
/* Return the Vector with the Fonts. */
     
return vecFontList;
  }
/*
 * --------------------
 * Method to fill a JComboBox with the list of available Fonts. */
    public static void fillFontNamesIntoJComboBox(JComboBox parmJComboBox) {
/* Use the method of the JSBS_GUIServices to fill the JComboBox. */
      JSBS_GUIServices.setListToJComboBox(parmJComboBox, getFontNameVector());
  }
/*
 * --------------------
 * Section for the FONT-STYLES
 * -------------------- */
/* Definition of the available Font-Styles. */
    private static short arrayFontStyles[] = {
        Font.
PLAIN, Font.BOLD, Font.ITALIC, Font.BOLD + Font.ITALIC};
/* Definition of the Description in different Languages. */
    private static String arrayFontStylesDesc_en[] = {
        
"normal", "bold", "italic", "bold-italic"};
    private static String arrayFontStylesDesc_de[] = {
        
"normal", "fett", "kursiv", "fett-kursiv"};
/*
 * Method to get the array with the descriptive text.
 * This is maintained in this method to have only one place that has to be
 * maintained when a language is added. */
    private static String[] getDescriptiveFontStyleText(String parmLanguage) {
/* Define the array that is returned. */
      String[] arrayWithDescription = null;
/* Find out which language is passed as parameter and transfer the
 * fitting description into the array to be searched. */
      if (parmLanguage.equals("de")) arrayWithDescription = arrayFontStylesDesc_de;
/* Array to be searches is not filled till now:
 * For the passed language is no Description defined (or the language is english).
 * Use the Description in English. */
      if (arrayWithDescription == null) arrayWithDescription = arrayFontStylesDesc_en;
/* Return the array with the descriptive text. */
     
return arrayWithDescription;
    }
/*
 * Method to fill a JComboBox with the available Font-Styles.
 * The Language is derived from the Task-Frame passed as parameter. */
    public static void fillFontStyleIntoJComboBox(JComboBox parmJComboBox,
                                                  JSBS_TaskFrame parmJSBS_TaskFrame) {
/* Extract the string with the language and let the following method doing the real work. */
      fillFontStyleIntoJComboBox(parmJComboBox,
                      parmJSBS_TaskFrame.
frmCC.structJSBS_UniversalParameters.strLanguageCode);
    }
/*
 * Method to fill a JComboBox with the available Font-Styles.
 * The Language is passed as parameter. */
    public static void fillFontStyleIntoJComboBox(JComboBox parmJComboBox, String parmLanguage) {
/* Check for empty GUI-element or String to avoid a dump. */
      if (parmJComboBox == null) return;
      
if (parmLanguage == null) return;
/* Get the array with the language-dependant description and use it to fill the JComboBox. */
      JSBS_GUIServices.setListToJComboBox(parmJComboBox, getDescriptiveFontStyleText(parmLanguage));
    }
/*
 * --------------------
 * Method to get the integer-value for the selected Font-Style.
 * Integer is used for the return value to signal via 'null' that
 * there was not a valid selection for a Font-Style chosen.
 * This 'Exception' might happen if the method was applied to a JComboBox
 * which does not list Font-Styles or contains descriptions in another language.
*/
    public static Integer getFontStyleFromJComboBox(JComboBox parmJComboBox,
                                                     String parmLanguage) {
/* Check for empty GUI-element to avoid a dump. */
      if (parmJComboBox == null) return null;
/* Check for empty String (parameter for the language); use English as default. */
      if (parmLanguage == null) parmLanguage = "en";
/* Define a new array were the array with the language-specific description is loaded
 * depending on the language passed as parameter.
 * This array can be searched later on. */
      String[] arrayWithDescription = getDescriptiveFontStyleText(parmLanguage);
/* Get the selected Font-Style from the JComboBox. */
      String strSelectedDescription = JSBS_GUIServices.getSelectedTextFromJComboBox(parmJComboBox);
/* Verify if the JComboBox contains at least 1 item; return 'null' if not. */
      if (strSelectedDescription == null) return null;
/* Try to find the selected Style(-Name) within the array to be searched. */
      
int intArraySize = arrayWithDescription.length;
      for (int intArrayIndex = 0; intArrayIndex < intArraySize; intArrayIndex++) {
/* Compare the selected entry from the JComboBox with the language-dependant descriptive text. */
        if (strSelectedDescription.equals(arrayWithDescription[intArrayIndex])) {
/* Matching descritptive text found; double-check that the array with the associated value
 * coincides. This is done do avoid a dump if an error in the definition occured. */
          if (intArrayIndex < arrayFontStyles.length ) {
/* Get the value for the Font-Style out of the array and return it. */
            return new Integer(arrayFontStyles[intArrayIndex]);
          }
        }
      }
/* Selected entry of the JComboBox is not within the list of descriptions;
 * return 'null' to signal that somethind is heavily wrong. */
     
return null;
    }
/*
 * Method to get the integer-value for the selected Font-Style.
 * Same as the method above but the language is derived from the
 * JSBS_TaskFrame passed as parameter. */
    public static Integer getFontStyleFromJComboBox(JComboBox parmJComboBox,
                                                    JSBS_TaskFrame parmJSBS_TaskFrame) {
/* Extract the string with the language and let the above method do the real work. */
      return getFontStyleFromJComboBox (parmJComboBox,
                      parmJSBS_TaskFrame.
frmCC.structJSBS_UniversalParameters.strLanguageCode);
    }
/*
 * --------------------
 * Method to set the descriptive text depending on the value for the Font-Style.
 * The structure with the Universal-Parameters contain the language-code
 * and the color for the 'error'-background if an invalid value for the Font-Style was passed.
 * The parameter 'PopUp' signals, that the list of the JComboBox should pop-up
 * if an invalid value for the Font-Style was passed. */
    public static void setFontStyleToJComboBox(JComboBox parmJComboBox,
                                               
int parmFontStyleValue,
                                               JSBS_UniversalParameters parmJSBS_UniversalParameters,
                                               
boolean parmPopUp) {
/* Check for empty GUI-element to avoid a dump. */
      if (parmJComboBox == null) return;
/* Check for empty structure for the Universal-Parameters to avoid a dump. */
      if (parmJSBS_UniversalParameters == null) return;
/* Define a value that will contain the descriptive text according to the 'parmFontStyle'. */
      String strSelectedDescription = " ";
/* Define a new array were the array with the language-specific description is loaded
 * depending on the language passed as parameter.
 * This array can be searched later on. */
      String[] arrayWithDescription =
                   getDescriptiveFontStyleText(parmJSBS_UniversalParameters.
strLanguageCode);
/* Search the array with the Font-Style for the value passed as parameter. */
      
int intArraySize = arrayFontStyles.length;
      for (int intArrayIndex = 0; intArrayIndex < intArraySize; intArrayIndex++) {
/* Compare the value passed as parameter with the indexed value of the array. */
        if (parmFontStyleValue == arrayFontStyles[intArrayIndex]) {
/* Match found; double-check that the array with the descriptive text
 * coincides. This is done do avoid a dump if an error in the definition occured. */
          if (intArrayIndex < arrayWithDescription.length ) {
/* Get the String with the description out of the array for later use to set the JComboBox-item. */
            strSelectedDescription = arrayWithDescription[intArrayIndex];
            
break;
          }
        }
      }
/* Use the existing method to set the item of the JComboBox.
 * This method also includes 'error-handling' if the String does not match an item. */
      
JSBS_GUIServices.setJComboBoxItem(parmJComboBox,
                                        strSelectedDescription,

                                        parmJSBS_UniversalParameters,
                                        parmPopUp);
    }
/*
 * Method to set the descriptive text depending on the value for the Font-Style.
 * Same as the method above but the Universal-Parameters are derived from the
 * JSBS_TaskFrame passed as parameter. */
    public static void setFontStyleToJComboBox(JComboBox parmJComboBox,
                                               
int parmFontStyleValue,
                                               JSBS_TaskFrame parmJSBS_TaskFrame,
                                               
boolean parmPopUp) {
/* Extract the structure with the Universal-Parameter and let the above method do the real work. */
      setFontStyleToJComboBox(parmJComboBox,
                              parmFontStyleValue,
                              parmJSBS_TaskFrame.
frmCC.structJSBS_UniversalParameters,
                              parmPopUp);
    }
/*
 * --------------------
 * Section for the FONT-SIZES
 * -------------------- */
/* Definition of the available Font-Sizes. */
    private static short arrayFontSizes[] = {
        5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 28, 32,
        36, 40, 44, 48, 56, 64, 72, 80, 88, 96};
/* Definition of the Description in different Languages. */
    private static String arrayFontSizesDesc_en[] = {
        
"5 Point", "6 Point", "7 Point", "8 Point", "9 Point", "10 Point", "11 Point",
        
"12 Point", "14 Point", "16 Point", "18 Point", "20 Point", "22 Point", "24 Point",
        
"28 Point", "32 Point", "36 Point", "40 Point", "44 Point", "48 Point", "56 Point",
        
"64 Point", "72 Point", "80 Point", "88 Point", "96 Point"};
    private static String arrayFontSizesDesc_de[] = {
        
"5 Punkt", "6 Punkt", "7 Punkt", "8 Punkt", "9 Punkt", "10 Punkt", "11 Punkt",
        
"12 Punkt", "14 Punkt", "16 Punkt", "18 Punkt", "20 Punkt", "22 Punkt", "24 Punkt",
        
"28 Punkt", "32 Punkt", "36 Punkt", "40 Punkt", "44 Punkt", "48 Punkt", "56 Punkt",
        
"64 Punkt", "72 Punkt", "80 Punkt", "88 Punkt", "96 Punkt"};
/*
 * Method to get the array with the descriptive text.
 * This is maintained in this method to have only one place that has to be
 * maintained when a language is added. */
    private static String[] getDescriptiveFontSizeText(String parmLanguage) {
/* Define the array that is returned. */
      String[] arrayWithDescription = null;
/* Find out which language is passed as parameter and transfer the
 * fitting description into the array to be searched. */
      if (parmLanguage.equals("de")) arrayWithDescription = arrayFontSizesDesc_de;
/* Array to be searches is not filled till now:
 * For the passed language is no Description defined (or the language is english).
 * Use the description in English. */
      if (arrayWithDescription == null) arrayWithDescription = arrayFontSizesDesc_en;
/* Return the array with the descriptive text. */
     
return arrayWithDescription;
    }
/*
 * Method to fill a JComboBox with the available Font-Sizes.
 * The Language is derived from the Task-Frame passed as parameter. */
    public static void fillFontSizeIntoJComboBox(JComboBox parmJComboBox,
                                                 JSBS_TaskFrame parmJSBS_TaskFrame) {
/* Extract the string with the language and let the following method do the real work. */
      fillFontSizeIntoJComboBox(parmJComboBox,
                      parmJSBS_TaskFrame.
frmCC.structJSBS_UniversalParameters.strLanguageCode);
    }
/*
 * Method to fill a JComboBox with the available Font-Sizes.
 * The Language is passed as parameter. */
    public static void fillFontSizeIntoJComboBox(JComboBox parmJComboBox, String parmLanguage) {
/* Check for empty GUI-element or String to avoid a dump. */
      if (parmJComboBox == null) return;
      
if (parmLanguage == null) return;
/* Get the array with the language-dependant description and use it to fill the JComboBox. */
      JSBS_GUIServices.setListToJComboBox(parmJComboBox, getDescriptiveFontSizeText(parmLanguage));
    }
/*
 * --------------------
 * Method to get the short-value for the selected Font-Size.
 * Short is used for the return value to signal via 'null' that
 * there was not a valid selection for a Font-Sizee chosen.
 * This 'Exception' might happen if the method was applied to a JComboBox
 * which does not list Font-Sizes or contains descriptions in another language. */
    public static Short getFontSizeFromJComboBox(JComboBox parmJComboBox,
                                                 String parmLanguage) {
/* Check for empty GUI-element to avoid a dump. */
      if (parmJComboBox == null) return null;
/* Check for empty String (parameter for the language); use English as default. */
      if (parmLanguage == null) parmLanguage = "en";
/* Define a new array were the array with the language-specific description is loaded
 * depending on the language passed as parameter.
 * This array can be searched later on. */
      String[] arrayWithDescription = getDescriptiveFontSizeText(parmLanguage);
/* Get the selected Font-Size from the JComboBox. */
      String strSelectedDescription = JSBS_GUIServices.getSelectedTextFromJComboBox(parmJComboBox);
/* Verify if the JComboBox contains at least 1 item; return 'null' if not. */
      if (strSelectedDescription == null) return null;
/* Try to find the selected Size within the array to be searched. */
      
int intArraySize = arrayWithDescription.length;
      for (int intArrayIndex = 0; intArrayIndex < intArraySize; intArrayIndex++) {
/* Compare the selected entry from the JComboBox with the language-dependant descriptive text. */
        if (strSelectedDescription.equals(arrayWithDescription[intArrayIndex])) {
/* Matching descritptive text found; double-check that the array with the associated value
 * coincides. This is done do avoid a dump if an error in the definition occured. */
          if (intArrayIndex < arrayFontSizes.length ) {
/* Get the value for the Font-Style out of the array and return it. */
            return new Short(arrayFontSizes[intArrayIndex]);
          }
        }
      }
/* Selected entry of the JComboBox is not within the list of descriptions;
 * return 'null' to signal that somethind is heavily wrong. */
     
return null;
    }
/*
 * Method to get the short-value for the selected Font-Size.
 * Same as the method above but the language is derived from the
 * JSBS_TaskFrame passed as parameter. */
    public static Short getFontSizeFromJComboBox(JComboBox parmJComboBox,
                                                   JSBS_TaskFrame parmJSBS_TaskFrame) {
/* Extract the string with the language and let the above method do the real work. */
      return getFontSizeFromJComboBox (parmJComboBox,
                      parmJSBS_TaskFrame.
frmCC.structJSBS_UniversalParameters.strLanguageCode);
    }
/*
 * --------------------
 * Method to set the descriptive text depending on the value for the Font-Size.
 * The structure with the Universal-Parameters contain the language-code
 * and the color for the 'error'-background if an invalid value for the Font-Style was passed.
 * The parameter 'PopUp' signals, that the list of the JComboBox should pop-up
 * if an invalid value for the Font-Style was passed. */
    public static void setFontSizeToJComboBox(JComboBox parmJComboBox,
                                               
short parmFontSizeValue,
                                               JSBS_UniversalParameters parmJSBS_UniversalParameters,
                                               
boolean parmPopUp) {
/* Check for empty GUI-element to avoid a dump. */
      if (parmJComboBox == null) return;
/* Check for empty structure for the Universal-Parameters to avoid a dump. */
      if (parmJSBS_UniversalParameters == null) return;
/* Define a value that will contain the descriptive text according to the 'parmFontSizeValue'. */
      String strSelectedDescription = " ";
/* Define a new array were the array with the language-specific description is loaded
 * depending on the language passed as parameter.
 * This array can be searched later on. */
      String[] arrayWithDescription =
                   getDescriptiveFontSizeText(parmJSBS_UniversalParameters.
strLanguageCode);
/* Search the array with the Font-Style for the value passed as parameter. */
      
int intArraySize = arrayFontSizes.length;
      for (int intArrayIndex = 0; intArrayIndex < intArraySize; intArrayIndex++) {
/* Compare the value passed as parameter with the indexed value of the array. */
        if (parmFontSizeValue == arrayFontSizes[intArrayIndex]) {
/* Match found; double-check that the array with the descriptive text
 * coincides. This is done do avoid a dump if an error in the definition occured. */
          if (intArrayIndex < arrayWithDescription.length ) {
/* Get the String with the description out of the array for later use to set the JComboBox-item. */
            strSelectedDescription = arrayWithDescription[intArrayIndex];
            
break;
          }
        }
      }
/* Use the existing method to set the item of the JComboBox.
 * This method also includes 'error-handling' if the String does not match an item. */
      
JSBS_GUIServices.setJComboBoxItem(parmJComboBox,
                                        strSelectedDescription,

                                        parmJSBS_UniversalParameters,
                                        parmPopUp);
    }
/*
 * Method to set the descriptive text depending on the value for the Font-Style.
 * Same as the method above but the Universal-Parameters are derived from the
 * JSBS_TaskFrame passed as parameter. */
    public static void setFontSizeToJComboBox(JComboBox parmJComboBox,
                                              
short parmFontSizeValue,
                                              JSBS_TaskFrame parmJSBS_TaskFrame,
                                              
boolean parmPopUp) {
/* Extract the structure with the Universal-Parameter and let the above method do the real work. */
      setFontSizeToJComboBox(parmJComboBox,
                             parmFontSizeValue,
                             parmJSBS_TaskFrame.
frmCC.structJSBS_UniversalParameters,
                             parmPopUp);
    }
/*
 * --------------------
 * Section for the COLORS
 * -------------------- */
/
* Definition of the available Colors. */
    private static int arrayColors[] = {
        0, 255, 255*256, 255*256*256,
        255 + 255*256, 255 + 255*65536, 255*256 + 255*65536, 128*256 + 128*65536,
        255 + 255*256 + 255*65536, 128 + 128*256 + 128*65536, 192 + 192*256 + 192*65536,
        192 + 192*256 + 255*65536, 192 + 64*256 + 192*65536, 255 + 192*256 + 192*65536,
        255 + 192*256 + 255*65536, 192 + 255*256 + 192*65536,
        255 + 255*256 + 192*65536, 192 + 255*256 + 255*65536};
/* Definition of the Description in different Languages. */
    private static String arrayColorsDesc_en[] = {
        
"black", "blue", "green", "red",
        
"cyan", "magenta", "yellow", "brown",
        
"white", "grey", "light grey",
        
"pink", "purple", "light blue",
        
"light magenta", "light green",
        
"light cyan", "light yellow"};
    private static String arrayColorsDesc_de[] = {
        
"schwarz", "blau", "grün", "rot",
        
"cyan", "magenta", "gelb", "braun",
        
"weiß", "grau", "hellgrau",
        
"rosa", "violett", "hellblau",
        
"hellmagenta", "hellgrün",
        
"hellcyan", "hellgelb"};
/*
 * Method to get the array with the descriptive text.
 * This is maintained in this method to have only one place that has to be
 * maintained when a language is added. */
    private static String[] getDescriptiveColorText(String parmLanguage) {
/* Define the array that is returned. */
      String[] arrayWithDescription = null;
/* Find out which language is passed as parameter and transfer the
 * fitting description into the array to be searched. */
      if (parmLanguage.equals("de")) arrayWithDescription = arrayColorsDesc_de;
/* Array to be searches is not filled till now:
 * For the passed language is no Description defined (or the language is english).
 * Use the description in English. */
      if (arrayWithDescription == null) arrayWithDescription = arrayColorsDesc_en;
/* Return the array with the descriptive text. */
     
return arrayWithDescription;
    }
/*
 * Method to fill a JComboBox with the available Color-Names.
 * The Language is derived from the Task-Frame passed as parameter. */
    public static void fillColorIntoJComboBox(JComboBox parmJComboBox,
                                              JSBS_TaskFrame parmJSBS_TaskFrame) {
/* Extract the string with the language and let the following method do the real work. */
      fillColorIntoJComboBox(parmJComboBox,
                      parmJSBS_TaskFrame.
frmCC.structJSBS_UniversalParameters.strLanguageCode);
    }
/*
 * Method to fill a JComboBox with the available Color-Names.
 * The Language is passed as parameter. */
    public static void fillColorIntoJComboBox(JComboBox parmJComboBox, String parmLanguage) {
/* Check for empty GUI-element or String to avoid a dump. */
      if (parmJComboBox == null) return;
      
if (parmLanguage == null) return;
/* Get the array with the language-dependant description and use it to fill the JComboBox. */
      JSBS_GUIServices.setListToJComboBox(parmJComboBox, getDescriptiveColorText(parmLanguage));
    }
/*
 * --------------------
 * Method to get the integer-value for the selected Color.
 * Integer is used for the return value to signal via 'null' that
 * there was not a valid selection for a Font-Sizee chosen.
 * This 'Exception' might happen if the method was applied to a JComboBox
 * which does not list Font-Sizes or contains descriptions in another language. */
    public static Integer getColorFromJComboBox(JComboBox parmJComboBox,
                                                String parmLanguage) {
/* Check for empty GUI-element to avoid a dump. */
      if (parmJComboBox == null) return null;
/* Check for empty String (parameter for the language); use English as default. */
      if (parmLanguage == null) parmLanguage = "en";
/* Define a new array were the array with the language-specific description is loaded
 * depending on the language passed as parameter.
 * This array can be searched later on. */
      String[] arrayWithDescription = getDescriptiveColorText(parmLanguage);
/* Get the selected Color-Name from the JComboBox. */
      String strSelectedDescription = JSBS_GUIServices.getSelectedTextFromJComboBox(parmJComboBox);
/* Verify if the JComboBox contains at least 1 item; return 'null' if not. */
      if (strSelectedDescription == null) return null;
/* Try to find the selected Color within the array to be searched. */
      
int intArraySize = arrayWithDescription.length;
      for (int intArrayIndex = 0; intArrayIndex < intArraySize; intArrayIndex++) {
/* Compare the selected entry from the JComboBox with the language-dependant descriptive text. */
        if (strSelectedDescription.equals(arrayWithDescription[intArrayIndex])) {
/* Matching descritptive text found; double-check that the array with the associated value
 * coincides. This is done do avoid a dump if an error in the definition occured. */
          if (intArrayIndex < arrayColors.length ) {
/* Get the value for the Color out of the array and return it. */
            return new Integer(arrayColors[intArrayIndex]);
          }
        }
      }
/* Selected entry of the JComboBox is not within the list of descriptions;
 * return 'null' to signal that somethind is heavily wrong. */
     
return null;
    }
/*
 * Method to get the integer-value for the selected Color.
 * Same as the method above but the language is derived from the
 * JSBS_TaskFrame passed as parameter. */
    public static Integer getColorFromJComboBox(JComboBox parmJComboBox,
                                                JSBS_TaskFrame parmJSBS_TaskFrame) {
/* Extract the string with the language and let the above method do the real work. */
      return getColorFromJComboBox (parmJComboBox,
                      parmJSBS_TaskFrame.
frmCC.structJSBS_UniversalParameters.strLanguageCode);
    }
/*
 * --------------------
 * Method to set the descriptive text depending on the value for the Color.
 * The structure with the Universal-Parameters contain the language-code
 * and the color for the 'error'-background if an invalid value for the Font-Style was passed.
 * The parameter 'PopUp' signals, that the list of the JComboBox should pop-up
 * if an invalid value for the Font-Style was passed. */
    public static void setColorToJComboBox(JComboBox parmJComboBox,
                                           
int parmColorValue,
                                           JSBS_UniversalParameters parmJSBS_UniversalParameters,
                                           
boolean parmPopUp) {
/* Check for empty GUI-element to avoid a dump. */
      if (parmJComboBox == null) return;
/* Check for empty structure for the Universal-Parameters to avoid a dump. */
      if (parmJSBS_UniversalParameters == null) return;
/* Define a value that will contain the descriptive text according to the 'parmFontSizeValue'. */
      String strSelectedDescription = " ";
/* Define a new array were the array with the language-specific description is loaded
 * depending on the language passed as parameter.
 * This array can be searched later on. */
      String[] arrayWithDescription =
                   getDescriptiveColorText(parmJSBS_UniversalParameters.
strLanguageCode);
/* Search the array with the Colors for the value passed as parameter. */
      
int intArraySize = arrayColors.length;
      for (int intArrayIndex = 0; intArrayIndex < intArraySize; intArrayIndex++) {
/* Compare the value passed as parameter with the indexed value of the array. */
        if (parmColorValue == arrayColors[intArrayIndex]) {
/* Match found; double-check that the array with the descriptive text
 * coincides. This is done do avoid a dump if an error in the definition occured. */
          if (intArrayIndex < arrayWithDescription.length ) {
/* Get the String with the description out of the array for later use to set the JComboBox-item. */
            strSelectedDescription = arrayWithDescription[intArrayIndex];
            
break;
          }
        }
      }
/* Use the existing method to set the item of the JComboBox.
 * This method also includes 'error-handling' if the String does not match an item. */
      
JSBS_GUIServices.setJComboBoxItem(parmJComboBox,
                                        strSelectedDescription,

                                        parmJSBS_UniversalParameters,
                                        parmPopUp);
    }
/*
 * Method to set the descriptive text depending on the value for the Color-Name.
 * Same as the method above but the Universal-Parameters are derived from the
 * JSBS_TaskFrame passed as parameter. */
    public static void setColorToJComboBox(JComboBox parmJComboBox,
                                              
int parmColorValue,
                                              JSBS_TaskFrame parmJSBS_TaskFrame,
                                              
boolean parmPopUp) {
/* Extract the structure with the Universal-Parameter and let the above method do the real work. */
      setColorToJComboBox(parmJComboBox,
                             parmColorValue,
                             parmJSBS_TaskFrame.
frmCC.structJSBS_UniversalParameters,
                             parmPopUp);
    }
/*
 * --------------------

 * de: Bereich für die Funktionstasten
 * en: Section for the Function-Keys
 * -------------------- */

/* de:
 * Array der Codes der verwendeten Tasten die im jeweiligen Betriebssystem
 * (auf dem das Anwendungsprogramm ausgeführt wird) definiert sind.
 * en:
 * Array of the codes of the used keys as they are defined within
 * the operating-system the application is running on. */
    private static int arraySystemKeyCodes[] = {
        KeyEvent.VK_F1, KeyEvent.VK_F2KeyEvent.VK_F3, KeyEvent.VK_F4,
       
KeyEvent.VK_F5, KeyEvent.VK_F6KeyEvent.VK_F7KeyEvent.VK_F8,
       
KeyEvent.VK_F9KeyEvent.VK_F10KeyEvent.VK_F11KeyEvent.VK_F12,
/* de:
 * JSBS-interne Codes für Tastenkombinationen mit 'Alternate', 'Steuerung'
 * und 'Umschalten' haben keine entsprechende Codes des Betriebssystems sondern
 * werden aus mehreren Tasten 'zusammengestzt'.
 * en:
 * JSBS-internal codes for key-combinations with 'Alternate', 'Control' and
 * 'Shift' have no adjacent codes from the operating-system as they are made
 * up with several keys. */
        
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* de:
 * Die folgenden Codes des Betriebssystem sind für die Zuordnung von 'Mnemonics'.
 * Diese Tasten können nicht zu JButton zugeordnet werden sondern sind nur zum
 * Auswählen einzelner JPanel innerhalb eines JTabbedPane.
 * en:
 * The following codes of the operating-system are for the assignment of 'mnemonics'.
 * Those keys can not be assigned to JButton; they are for the selection of JPanel
 * within a JTabbedPane. */
        KeyEvent.VK_1, KeyEvent.VK_2KeyEvent.VK_3, KeyEvent.VK_4, KeyEvent.VK_5,
        KeyEvent.VK_6, KeyEvent.VK_7KeyEvent.VK_8, KeyEvent.VK_9, KeyEvent.VK_0,
        KeyEvent.VK_A, KeyEvent.VK_BKeyEvent.VK_C, KeyEvent.VK_D, KeyEvent.VK_E,
        KeyEvent.VK_F, KeyEvent.VK_GKeyEvent.VK_H, KeyEvent.VK_I, KeyEvent.VK_J,
        KeyEvent.VK_K, KeyEvent.VK_LKeyEvent.VK_M, KeyEvent.VK_N, KeyEvent.VK_O,
        KeyEvent.VK_P, KeyEvent.VK_QKeyEvent.VK_R, KeyEvent.VK_S, KeyEvent.VK_T,
        KeyEvent.VK_U, KeyEvent.VK_VKeyEvent.VK_W, KeyEvent.VK_X, KeyEvent.VK_Y,
        KeyEvent.VK_Z};
/* de:
 * Definition der Programm-internen Werte für die Funktionstasten
 * mit den Kombinationen für Alt, Steuerung und Umschalten.
 * en:
 * Definition of the internal values of the Function-Keys
 * including combinations with Alt, Control and Shift. */
    private static String arrayInternalKeyCodes[] = {
       
"F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12",
       
"Sh-F1", "Sh-F2", "Sh-F3", "Sh-F4", "Sh-F5", "Sh-F6",
        "Sh-F7"
, "Sh-F8", "Sh-F9", "Sh-F10", "Sh-F11", "Sh-F12",
       
"Ctl-F1", "Ctl-F2", "Ctl-F3", "Ctl-F4", "Ctl-F5", "Ctl-F6",
        "Ctl-F7"
, "Ctl-F8", "Ctl-F9", "Ctl-F10", "Ctl-F11", "Ctl-F12",
        "Alt-F1", "Alt-F2", "Alt-F3", "Alt-F4", "Alt-F5", "Alt-F6",
        "Alt-F7"
, "Alt-F8", "Alt-F9", "Alt-F10", "Alt-F11", "Alt-F12",
/* de:
 * Die folgenden internen Codes sind für die Zuordnung von 'Mnemonics'.
 * Diese Tasten können nicht zu JButton zugeordnet werden sondern sind nur zum
 * Auswählen einzelner JPanel innerhalb eines JTabbedPane.
 * en:
 * The following internal codes are for the assignment of 'mnemonics'.
 * Those keys can not be assigned to JButton; they are for the selection of JPanel
 * within a JTabbedPane. */
        "Mnemon+1""Mnemon+2""Mnemon+3""Mnemon+4""Mnemon+5",
        "Mnemon+6""Mnemon+7""Mnemon+8""Mnemon+9""Mnemon+0",
        "Mnemon+A""Mnemon+B""Mnemon+C""Mnemon+D""Mnemon+E",
        "Mnemon+F""Mnemon+G""Mnemon+H""Mnemon+I""Mnemon+J",
        "Mnemon+K""Mnemon+L""Mnemon+M""Mnemon+N""Mnemon+O",
        "Mnemon+P""Mnemon+Q""Mnemon+R""Mnemon+S""Mnemon+T",
        "Mnemon+U""Mnemon+V""Mnemon+W""Mnemon+X""Mnemon+Y",
        "Mnemon+Z"};
/* de:
 * Festlegung des angezeigten Textes für die Funktionstasten in verschiedenen
 * Sprachen.
 * en:
 * Definition of the shown text for the function-keys in different Languages. */
    private static String arrayDisplayedKeyCodes_en[] = {
        "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12",
       
"Sh-F1", "Sh-F2", "Sh-F3", "Sh-F4", "Sh-F5", "Sh-F6",
        "Sh-F7"
, "Sh-F8", "Sh-F9", "Sh-F10", "Sh-F11", "Sh-F12",
       
"Ctl-F1", "Ctl-F2", "Ctl-F3", "Ctl-F4", "Ctl-F5", "Ctl-F6",
        "Ctl-F7"
, "Ctl-F8", "Ctl-F9", "Ctl-F10", "Ctl-F11", "Ctl-F12",
        "Alt-F1", "Alt-F2", "Alt-F3", "Alt-F4", "Alt-F5", "Alt-F6",
        "Alt-F7"
, "Alt-F8", "Alt-F9", "Alt-F10", "Alt-F11", "Alt-F12",
/* de: Bereich für die 'Mnemonics'.
 * en: Area for the 'mnemonics'. */
        "Alt+1"
, "Alt+2", "Alt+3", "Alt+4", "Alt+5",
        "Alt+6"
, "Alt+7", "Alt+8", "Alt+9", "Alt+0",
        "Alt+a"
, "Alt+b", "Alt+c", "Alt+d", "Alt+e",
        "Alt+f"
, "Alt+g", "Alt+h", "Alt+i", "Alt+j",
        "Alt+k"
, "Alt+l", "Alt+m", "Alt+n", "Alt+o",
        "Alt+p"
, "Alt+q", "Alt+r", "Alt+s", "Alt+t",
        "Alt+u"
, "Alt+v", "Alt+w", "Alt+x", "Alt+y",
        "Alt+z"
};
    private static String arrayDisplayedKeyCodes_de[] = {
        "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12",
       
"Ums-F1", "Ums-F2", "Ums-F3", "Ums-F4", "Ums-F5", "Ums-F6",
        "Ums-F7"
, "Ums-F8", "Ums-F9", "Ums-F10", "Ums-F11", "Ums-F12",
       
"Strg-F1", "Strg-F2", "Strg-F3", "Strg-F4", "Strg-F5", "Strg-F6",
        "Strg-F7"
, "Strg-F8", "Strg-F9", "Strg-F10", "Strg-F11", "Strg-F12",
        "Alt-F1", "Alt-F2", "Alt-F3", "Alt-F4", "Alt-F5", "Alt-F6",
        "Alt-F7"
, "Alt-F8", "Alt-F9", "Alt-F10", "Alt-F11", "Alt-F12",
/* de: Bereich für die 'Mnemonics'.
 * en: Area for the 'mnemonics'. */
        "Alt+1"
, "Alt+2", "Alt+3", "Alt+4", "Alt+5",
        "Alt+6"
, "Alt+7", "Alt+8", "Alt+9", "Alt+0",
        "Alt+a"
, "Alt+b", "Alt+c", "Alt+d", "Alt+e",
        "Alt+f"
, "Alt+g", "Alt+h", "Alt+i", "Alt+j",
        "Alt+k"
, "Alt+l", "Alt+m", "Alt+n", "Alt+o",
        "Alt+p"
, "Alt+q", "Alt+r", "Alt+s", "Alt+t",
        "Alt+u"
, "Alt+v", "Alt+w", "Alt+x", "Alt+y",
        "Alt+z"
};
/*
 * de:

 * Methode zum Ermitteln des Betriebssystem-internen Tastencode wenn der

 * innerhalb der JSBS-Basisklassen verwendete Code als Parameter übergeben wird.

 * en:

 * Method to get the key-code of the operating-system for the key-code used within the
 * JSBS-bas-classes which is passed as parameter. */
    public static int getSystemKeyCodeForInternalKeyCode(String parmInternalKeyCode) {
/* de:
 * 
Prüfen ob der übergebene Parameter nicht null ist;
 * bei einem Fehler '0' zurückliefern.

 * en:

 * 
Verify if the passed parameters is not null; return '0' in case of errors. */
      if (parmInternalKeyCode == null) return 0;
/* de: Durch das Array mit den programm-internen Funktionstasten-Codes des JSBS 'loopen'.
 * en:
Loop through the array with the JSBS-internal key-codes. */
      int intArraySize = arrayInternalKeyCodes.length;
      for (int intArrayIndex = 0; intArrayIndex < intArraySize; intArrayIndex++) {
        if (arrayInternalKeyCodes[intArrayIndex].trim().compareTo(parmInternalKeyCode) == 0)
/* de:
 * 
Interner Tasten-Code gefunden; den dazu passenden Code des Betriebssystems
 * für die Taste zurückliefern.
 
 * en:

 * 
Internal key-code found; return the adjacent key-code of the operating-system. */
          return arraySystemKeyCodes[intArrayIndex];
      }
/* de: JSBS-internen Tasten-Code nicht gefunden; Wert '0' zurückliefern.
 * 
en: JSBS-internal key-code not found; return value '0'. */
     
return 0;
    }
/*
 * de:

 * Methode zum Ermitteln des Betriebssystem-internen Tastencode wenn der

 * der angezeigte Text für die Taste und der Sprachcode als Parameter übergeben werden.

 * en:

 * Method to get the key-code of the operating-system for the displayed text for this key
 * and the language-code; both are
passed as parameter. */
    public static int getSystemKeyCodeForDisplayedKeyCode(String parmDisplayedString, String parmLanguageCode) {
/* de:
 * 
Prüfen ob die übergebenen Parameter nicht null sind;
 * bei einem Fehler '0' zurückliefern.

 * en:

 * 
Verify if the passed parameters are not null; return '0' in case of errors. */
      if (parmDisplayedString == null) return 0;
      if (parmLanguageCode == null) return 0;
/* de:
 * Ein Array mit den sprach-abhängigen angezeigten Funktionstasten-Texten definieren

 * und mit dem Array für die Sprache, die als Parameter übergeben wurde, füllen

 * en:

 * 
Define an array with the language-specific key-codes and load it
 * depending on the language passed as parameter. */
      String[] arrayDisplayedKeyCodes = getDisplayedKeyCodeTextArray(parmLanguageCode);
/* de: Durch das Array mit den angezeigten Funktionstasten-Codes des JSBS 'loopen'.
 * en:
Loop through the array with the displayed key-codes. */
      int intArraySize = arrayDisplayedKeyCodes.length;
      for (int intArrayIndex = 0; intArrayIndex < intArraySize; intArrayIndex++) {
        if (arrayDisplayedKeyCodes[intArrayIndex].trim().compareTo(parmDisplayedString) == 0)
/* de:
 * Angezeigter
Tasten-Code gefunden; den dazu passenden Code des Betriebssystems
 * für die Taste zurückliefern.
 
 * en:

 * Displayed
key-code found; return the adjacent key-code of the operating-system. */
          return arraySystemKeyCodes[intArrayIndex];
      }
/* de: Text des Tasten-Code nicht gefunden; Wert '0' zurückliefern.
 * 
en: Text for the key-code not found; return value '0'. */
     
return 0;
    }
/*
 * de:

 * Methode zum Holen des Arrays mit dem angezeigten Text in der angeforderten

 * Sprache.

 * Das Holen ist in dieser Methode codiert um beim späteren Erweitern um eine

 * Sprache den Code nur an einem Platz erweitern zu müssen

 * en:

 * Method to get the array with the displayed text in the requested language.
 * The getting is maintained in this method to have only one place that has to be
 * maintained when a language is added. */
    private static String[] getDisplayedKeyCodeTextArray(String parmLanguage) {
/* de:
 * 
Prüfen ob der übergebene Parameter nicht null ist;
 * bei einem Fehler ein leeres Array zurückliefern.

 * en:

 * 
Verify if the passed parameters are not null; return empty array in case of errors. */
      if (parmLanguage == null) return new String[0];
/* de: Array, das zurückgeliefert wird, definieren.
 * en:
Define the array that is returned. */
      String[] arrayWithDisplayedText = null;
/* de:
 * Abfragen welche Sprache als Parameter übergeben wurde und übertragen des

 * passenden Arrays in das gerade definierte Array, das gleich durchsucht wird.

 * 
en:
 * 
Find out which language is passed as parameter and transfer the
 * fitting description into the array to be searched. */
      if (parmLanguage.equals("de")) arrayWithDisplayedText = arrayDisplayedKeyCodes_de;
/* de:
 * Array für weitere Verarbeitung ist bis jetzt nicht gefüllt:

 * Für die als Parameter übergebene Sprache wurde bis jetzt kein anzuzeigender Text

 * festgelegt oder die Sprache ist Englisch.

 * Anzuzeigenden Text in Englisch verwenden.

 * en:

 * 
Array to be searched is not filled till now:
 * For the passed language is no text to be displayed defined or the language is english).
 * Use the displayed text in English. */

      if (arrayWithDisplayedText == null) arrayWithDisplayedText = arrayDisplayedKeyCodes_en;
/* de: Text, der angezeigt werden soll zurückliefern.
 * en:
Return the array with the text to be displayed. */
     
return arrayWithDisplayedText;
    }
/*
 * de:

 * Methode zum Ermitteln des sprach-abhängigen Funktiontasten-Textes für einen

 * übergebenen JSBS-internen Funktionstasten-Code und die gewünschte Sprache.

 * en:
 * 
Method to get the language-specific Key-Code-text for a given JSBS-internal Key-Code
 * and the target-language. */
    public static String getDisplayedKeyCode(String parmInternalKeyCode,
                                             String parmLanguage) {

/* de:
 * 
Prüfen ob die übergebenen Parameter nicht null sind;
 * bei einem Fehler eine leere Zeichenkette zurückliefern.

 * en:

 * 
Verify if the passed parameters are not null; return empty String in case of errors. */
      if (parmInternalKeyCode == null) return "";
      if (parmLanguage == null) return "";
/* de:
 * Ein Array mit den sprach-abhängigen angezeigten Funktionstasten-Texten definieren

 * und mit dem Array für die Sprache, die als Parameter übergeben wurde, füllen

 * en:

 * 
Define an array with the language-specific key-codes and load it
 * depending on the language passed as parameter. */
      String[] arrayDisplayedKeyCodes = getDisplayedKeyCodeTextArray(parmLanguage);
/* de: Durch das Array mit den programm-internen Funktionstasten-Codes 'loopen'.
 * en:
Loop through the array with the internal key-codes. */
      int intArraySize = arrayInternalKeyCodes.length;
      for (int intArrayIndex = 0; intArrayIndex < intArraySize; intArrayIndex++) {
        if (arrayInternalKeyCodes[intArrayIndex].trim().compareTo(parmInternalKeyCode) == 0)
/* de:
 *
JSBS-interner Funktionstasten-Code gefunden; den dazu passenden sprach-abhängigen Text
 * für die Funktionstase zurückliefern.
 
 * en:

 *
JSBS-internal key-code found; return the adjacent language-specific key-code. */
          return arrayDisplayedKeyCodes[intArrayIndex];
      }
/* de: Sprach-abhängigen Tasten-Code nicht gefunden; leere Zeichenkette zurückliefern.
 * 
en: Language-specific key-code not found; return empty string. */
     
return "";
    }
/*
 * 
de:
 * Methode zum Füllen einer JComboBox mit den verfügbaren JSBS-internen
 Funktionstasten-Codes.
 * en:

 * 
Method to fill a JComboBox with the available JSBS-internal KeyCodes. */
    public static void fillInternalKeyCodesIntoJComboBox(JComboBox parmJComboBox) {
/* de: Prüfen auf 'leeres' GUI-Element um einen Dump zu vermeiden.
 * en:
Check for empty GUI-element to avoid a dump. */
      if (parmJComboBox == null) return;
/* de: Array mit den JSBS-internen Tastencodes holen und zum Füllen der JComboBox verwenden.
 * en:
Get the array with the JSBS-internal key-codes and use it to fill the JComboBox. */
      JSBS_GUIServices.setListToJComboBox(parmJComboBox, arrayInternalKeyCodes);
    }

/*
 * de:

 * Methode zum füllen einer JComboBox mit den verfügbaren sprach-spezifischen

 * Texten für Tasten-Codes.

 * Die Sprache ist innerhalb des Task-Frames, das als parameter übergeben wird,

 * enthalten.

 * en:

 * 
Method to fill a JComboBox with the available language specific Key-Codes.
 * The language is derived from the Task-Frame passed as parameter. */
    public static void fillDisplayedKeyCodesIntoJComboBox(JComboBox parmJComboBox,
                                                 JSBS_TaskFrame parmJSBS_TaskFrame) {

/* de: Prüfen auf 'leeres' GUI-Element oder Task-Frame um einen Dump zu vermeiden.
 * en:
Check for empty GUI-element or Task-Frame to avoid a dump. */
      if (parmJComboBox == null) return;
      
if (parmJSBS_TaskFrame == null) return;
/* de:
 * 
Zeichenkette mit der Sprache ermitteln und die nachfolgende Methode aufrufen -
 * und die eigentliche Arbeit machen lassen ;-).

 * en:

 * 
Extract the string with the language and let the following method do the real work. */
      fillDisplayedKeyCodesIntoJComboBox(parmJComboBox,
                      parmJSBS_TaskFrame.
frmCC.structJSBS_UniversalParameters.strLanguageCode);
    }
/*
 * 
de:
 * Methode zum Füllen einer JComboBox mit den verfügbaren sprach-spezifischen

 * 
Funktionstasten-Codes. Die gewünschte Sprache wird als Parameter übergeben.
 * en:

 * 
Method to fill a JComboBox with the available language-specific KeyCodes.
 * The Language is passed as parameter. */
    public static void fillDisplayedKeyCodesIntoJComboBox(JComboBox parmJComboBox, String parmLanguage) {
/* de: Prüfen auf 'leeres' GUI-Element oder Zeichenkette um einen Dump zu vermeiden.
 * en:
Check for empty GUI-element or String to avoid a dump. */
      if (parmJComboBox == null) return;
      
if (parmLanguage == null) return;
/* de: Array mit der sprach-spezifischen Beschreibung holen und zum Füllen der JComboBox verwenden.
 * en:
Get the array with the language-dependant description and use it to fill the JComboBox. */
      JSBS_GUIServices.setListToJComboBox(parmJComboBox, getDisplayedKeyCodeTextArray(parmLanguage));
    }
/*
 * --------------------

 * de:

 * Methode zum Ermitteln des internen Wertes für den ausgewählten Funktionstasten-Code.

 * Ein Return-Wert 'null' signalisiert, dass kein gültiger, sprach-spezifischer

 * Funktionstasten-Code ausgewählt wurde
.
 * Diese Ausnahme kann passieren wenn als Parameter eine JComboBox übergeben wurde,

 * die Funktionstasten-Codes in anderer Sprache oder gar keine Funktionstasten-Codes enthält.

 * en:

 * Method to get the internal value for the selected function-key-code.
 * A return value of 'null' signals that
 * there was not a valid selection for a function-key-code chosen.
 * This 'Exception' might happen if the method was applied to a JComboBox
 * which does not list function-key-codes or contains descriptions in another language. */
    public static String getInternalKeyCodeFromJComboBoxWithDisplayedCodes(JComboBox parmJComboBox,
                                                 String parmLanguage) {
/* de: Prüfen auf leeres GUI-Element oder Sprache-Zeichenkette um einen Dump zu vermeiden.
 * en:
Check for empty GUI-element and language-String to avoid a dump. */
      if (parmJComboBox == null) return null;
      if (parmLanguage == null) parmLanguage = "en";
/* de:
 * 
Ein neues Array definieren in das die sprach-spezifische Beschreibungs-Texte
 * geladen werden - abhängig von der als Parameter übergebenen Sprache.

 * Dieses Array kann später durchsucht werden.

 * en:

 * 
Define a new array were the array with the language-specific texts is loaded
 * depending on the language passed as parameter.
 * This array can be searched later on. */
      String[] arrayWithDescription = getDisplayedKeyCodeTextArray(parmLanguage);
/* de: Holen des ausgewählten Funktionstasten-codes aus der JComboBox.
 * 
en: Get the selected Key-Code from the JComboBox. */
      String strSelectedDescription = JSBS_GUIServices.getSelectedTextFromJComboBox(parmJComboBox);
/* de: Prüfen, dass die Combo-Boy mindestens 1 Element enthält; wenn nicht, dann 'null' zurückliefern.
 * en:
Verify if the JComboBox contains at least 1 item; return 'null' if not. */
      if (strSelectedDescription == null) return null;
/* de:
 * 
Versuchen, den ausgewählten sprach-spezifischen Tasten-Code im zu durchsuchenden Array zu finden.
 * en:

 * 
Try to find the selected KeyCode within the array to be searched. */
      
int intArraySize = arrayWithDescription.length;
      for (int intArrayIndex = 0; intArrayIndex < intArraySize; intArrayIndex++) {
/* de:
 * Ausgewähltes Element der JComboBox mit dem sprach-spezifischen Funktionstasten-Text vergleichen.

 * en:

 * 
Compare the selected entry from the JComboBox with the language-dependant function-key-code. */
        if (strSelectedDescription.equals(arrayWithDescription[intArrayIndex])) {
/* de:
 * Passenden sprach-spezifischen Text gefunden; noch einmal prüfen, dass das Arrray mit dem 

 * zugeordneten Wert fürn den internen Code zusammenpasst.

 * Die doppelte Prüfung wird gemacht um einen Dump zu vermeiden wenn bei der Definition der

 * Arrays Fehler gemacht wurden.

 * en:

 * 
Matching language-dependant text found; double-check that the array with the associated value
 * coincides. This is done do avoid a dump if an error in the definition occured. */
          if (intArrayIndex < arrayInternalKeyCodes.length ) {
/* de: Wert für den internen Funktionstasten-Code aus dem Array 'holen' und zurückliefern.
 * en:
Get the value for the internal function-key-code out of the array and return it. */
            return arrayInternalKeyCodes[intArrayIndex];
          }
        }
      }
/* de:
 * Ausgewähltes Element der JComboBox ist nicht innerhalb des arrays mit den

 * sprach-spezifischen Codes; 'null' zurückliefern um zu signalisieren, dass etwas kräftig

 * schief gegangen ist.

 * en:

 * 
Selected entry of the JComboBox is not within the array of language-specific codes;
 * return 'null' to signal that something is heavily wrong. */
     
return null;
    }
/*
 * de:

 * 
Methode um den internen Wert für einen ausgewählten sprach-spezifischen
 * 
Funktionstasten-Code.
 * Gleich wie die obere Methode nur wird die Sprache aus dem übergebenen Parameter

 * mit dem JSBS_TaskFrame geholt.

 * en:

 * Method to get the internal String-value for the selected language-specific Key-Code.
 * Same as the method above but the language is derived from the
 * JSBS_TaskFrame passed as parameter. */
    public static String getInternalKeyCodeFromJComboBoxWithDisplayedCodes(JComboBox parmJComboBox,
                                                JSBS_TaskFrame parmJSBS_TaskFrame) {

/* de: Prüfen auf 'leeres' GUI-Element oder Task-Frame um einen Dump zu vermeiden.
 * en:
Check for empty GUI-element or Task-Frame to avoid a dump. */
      if (parmJComboBox == null) return null;
      
if (parmJSBS_TaskFrame == null) return null;
/* de:
 * 
Zeichenkette mit der Sprache ermitteln und die vorhergehende Methode aufrufen -
 * und die eigentliche Arbeit machen lassen ;-).

 * en:

 * 
Extract the string with the language and let the above method do the real work. */
      return getInternalKeyCodeFromJComboBoxWithDisplayedCodes (parmJComboBox,
                      parmJSBS_TaskFrame.
frmCC.structJSBS_UniversalParameters.strLanguageCode);
    }
/*
 * --------------------
 * de:

 * Methode um ein Element in einer JComboBox zu 'markieren'

 * Dabei wird der interne Wert des Funktionstasten-Codes als Parameter übergeben und der

 * passende sprach-spezifische Code für die Funktionstaste markiert - soforn in der Liste der

 * JComboBox enthalten.

 * Die als Parameter übergebene Struktur JSBS_UniversalParameters enthält den Sprach-Code

 * und die Farben für den Hintergrund (der JComboBox), die ohne / mit einem Fehler verwendet

 * werden.

 * Der Parameter 'PopUp' signalisiert, dass die Liste der JComboBox 'aufgeklappt' werden soll

 * wenn ein ungültiger Wert für den internen Funktionstasten-Code übergeben wurde.

 * en:

 *
Method to mark the language-specific text depending on the internal value for the Key-Code.
 * The structure with the Universal-Parameters contain the language-code
 * and the color for the 'error'-background if an invalid value for the Key-Code was passed.
 * The parameter 'PopUp' signals, that the list of the JComboBox should pop-up
 * if an invalid value for internal the Key-Code was passed. */
    public static void setDisplayedKeyCodeFromInternalCodeAtJComboBox(JComboBox parmJComboBox,
                                             String parmInternalKeyCodeValue,
                                             JSBS_UniversalParameters parmJSBS_UniversalParameters,
                                             boolean parmPopUp) {
/* de: Prüfen auf leeres GUI-Element und JSBS_UniversalParameters um einen Dump zu vermeiden.
 * en:
Check for empty GUI-element and JSBS_UniversalParameters to avoid a dump. */
      if (parmJComboBox == null) return;
      if (parmJSBS_UniversalParameters == null) return;
/* de:
 * Eine Variable defininieren die später der sprach-spezifischen text passend zum

 * übergebenen Wert 'parmInternalKeyValue' enthalten wird.

 * en:

 *
Define a variable that will contain the language-specific text according to
 *
the 'parmInternalKeyValue'. */
      String strSelectedDescription = " ";
/* de:
 * Ein neues Array festlegen in dem die sprach-spezifischen angezeigten Codes geladen

 * werden - abhängig von der Sprache, die als Parameter übergeben wurde.

 * Dieses Array wird später durchsucht.

 * en:

 *
Define a new array were the array with the language-specific displayed codes is loaded
 * depending on the language passed as parameter.
 * This array can be searched later on. */
      String[] arrayWithDescription =
                   getDisplayedKeyCodeTextArray(parmJSBS_UniversalParameters.
strLanguageCode);
/* de:
 *
Durchsuchen des Arrays mit den internen Funktionstasten-Code um den Wert, der als
 * Parameter übergeben wurde, zu finden.

 * en:

 *
Search the array with the internal Key-Codes for the value passed as parameter. */
      
int intArraySize = arrayInternalKeyCodes.length;
      for (int intArrayIndex = 0; intArrayIndex < intArraySize; intArrayIndex++) {
/* de:
 *
Wert, der als Parameter übergeben wurde, mit dem indizierten Wert aus dem Array
 * vergleichen.

 * en:

 *
Compare the value passed as parameter with the indexed value of the array. */
        if (parmInternalKeyCodeValue.compareTo(arrayInternalKeyCodes[intArrayIndex]) == 0) {
/* de:
 * Vergleich erfolgreich; noch einmal prüfen, dass das Array mit dem sprach-spezifischen

 * Text dazupaßt. Die doppelte Prüfung wird durchgeführt um einen Dump zu vermeiden wenn

 * bei der Definition der Arrays Fehler gemacht wurden.

 * en:

 *
Match successful; double-check that the array with the language-specific text
 * coincides. This is done do avoid a dump if an error in the definition occured. */
          if (intArrayIndex < arrayWithDescription.length ) {
/* de:
 * Zeichenkette mit dem sprach-spezifischem Code aus dem Array holen um ihn später zum markieren

 * des JComboBox-Elementes verwenden zu können.

 * en:

 *
Get the String with the language-specific code out of the array for later use to set
 *
the JComboBox-item. */
            strSelectedDescription = arrayWithDescription[intArrayIndex];
            
break;
          }
        }
      }
/* de:
 * Bestehende Methode verwenden um das Element der JComboBox zu markieren.

 * Diese Methode enthält auch die Fehler-Behandlung wenn die Zeichenkette mit

 * dem sprach-spezifischen Code nicht als Element in der JComboBox enthalten ist.

 * en:

 *
Use the existing method to set the item of the JComboBox.
 * This method also includes 'error-handling' if the String does not match an item. */
      
JSBS_GUIServices.setJComboBoxItem(parmJComboBox,
                                        strSelectedDescription,

                                             parmJSBS_UniversalParameters,
                                             parmPopUp);
    }
/*
 * de:

 * Methode um ein Element in einer JComboBox zu 'markieren'

 * Dabei wird der interne Wert des Funktionstasten-Codes als Parameter übergeben und der

 * passende sprach-spezifische Code für die Funktionstaste markiert - soforn in der Liste der

 * JComboBox enthalten.

 * Gleich wie die vorige Methode; nur wird die Struktur JSBS_UniversalParameters aus dem 

 * übergebenen Parameter für das JSBS_TaskFrame geholt.

 * en:

 * Method to set the descriptive text depending on the internal String-value for the Key-Code.
 * Same as the method above but the Universal-Parameters are derived from the
 * JSBS_TaskFrame passed as parameter. */
    public static void setDisplayedKeyCodeFromInternalCodeAtJComboBox(JComboBox parmJComboBox,
                                            String parmInternalKeyCode,
                                            JSBS_TaskFrame parmJSBS_TaskFrame,
                                            boolean parmPopUp) {
/* de: Prüfen auf 'leeres' GUI-Element, String oder Task-Frame um einen Dump zu vermeiden.
 * en:
Check for empty GUI-element, String or Task-Frame to avoid a dump. */
      if (parmJComboBox == null) return;
      if (parmInternalKeyCode == null) return;
      if (parmJSBS_TaskFrame == null) return;
/* de:
 * 
Zeichenkette mit der Sprache ermitteln und die vorhergehende Methode aufrufen -
 * und die eigentliche Arbeit machen lassen ;-).

 * en:

 * 
Extract the string with the language and let the above method do the real work. */
      setDisplayedKeyCodeFromInternalCodeAtJComboBox(parmJComboBox,
                            parmInternalKeyCode,
                            parmJSBS_TaskFrame.
frmCC.structJSBS_UniversalParameters,
                            parmPopUp);
    }
}

zum Inhaltsverzeichnis

Erklärungen und Anwendungsbeispiele

xxx

zum Inhaltsverzeichnis

Verwandte Dokumentation

Dokument

Inhalt



zum Inhaltsverzeichnis