コード例 #1
1
  public void bootOptionsReceived(BootEvent bootEvent) {
    log.info(" boot options received " + bootEvent.getNewSessionOptions());

    // reload setting, to ensure correct bootstraps
    ConfigureFactory.getInstance().reloadSettings();

    // If the options are not equal to the string 'null' then we have boot options
    if (!bootEvent.getNewSessionOptions().equals("null")) {
      // check if a session parameter is specified on the command line
      String[] args = new String[TN5250jConstants.NUM_PARMS];
      parseArgs(bootEvent.getNewSessionOptions(), args);

      if (isSpecified("-s", args)) {

        String sd = getParm("-s", args);
        if (sessions.containsKey(sd)) {
          parseArgs(sessions.getProperty(sd), args);
          final String[] args2 = args;
          final String sd2 = sd;
          SwingUtilities.invokeLater(() -> newSession(sd2, args2));
        }
      } else {

        if (args[0].startsWith("-")) {
          SwingUtilities.invokeLater(() -> startNewSession());
        } else {
          final String[] args2 = args;
          final String sd2 = args[0];
          SwingUtilities.invokeLater(() -> newSession(sd2, args2));
        }
      }
    } else {
      SwingUtilities.invokeLater(() -> startNewSession());
    }
  }
コード例 #2
0
ファイル: Outline.java プロジェクト: ShifuCifuentes/ridixcr
  /**
   * Creates a new Outline object.
   *
   * @param djvuBean the DjVuBean to navigate.
   * @throws ArrayIndexOutOfBoundsException if the document has less than 2 pages.
   */
  public Outline(final DjVuBean djvuBean) {
    this.djvuBean = djvuBean;

    if (djvuBean.getDocument().size() < 2) {
      throw new ArrayIndexOutOfBoundsException("Can not navigate documents with only one page.");
    }

    final MouseListener mouseListener =
        new MouseAdapter() {
          public void mouseClicked(final MouseEvent e) {
            try {
              clickLocation(e.getX(), e.getY());
            } catch (final Throwable exp) {
              exp.printStackTrace(DjVuOptions.err);
              System.gc();
            }
          }
        };

    addMouseListener(mouseListener);

    final Document document = djvuBean.getDocument();
    final Bookmark bookmark = (Bookmark) document.getBookmark();
    bookmark.setDjVmDir(document.getDjVmDir());
    setFirstBookmark(bookmark);

    final Properties properties = djvuBean.properties;
    properties.put("addOn.NavPane", "Outline," + properties.getProperty("addOn.NavPane", "None"));
    djvuBean.addPropertyChangeListener(this);
  }
コード例 #3
0
 private XmlUIElement getXmlUIElementFor(String typeArg) {
   if (typeToClassMappingProp == null) {
     setUpMappingsHM();
   }
   String clsName = (String) typeToClassMappingProp.get(typeArg);
   if ((clsName != null) && !(clsName.equals("*NOTFOUND*")) && !(clsName.equals("*EXCEPTION*"))) {
     try {
       Class cls = Class.forName(clsName);
       return (XmlUIElement) cls.newInstance();
     } catch (Throwable th) {
       typeToClassMappingProp.put(typeArg, "*EXCEPTION*");
       showErrorMessage(
           MessageFormat.format(
               ProvClientUtils.getString(
                   "{0} occurred when trying to get the XmlUIElement for type : {1}"),
               new Object[] {th.getClass().getName(), typeArg}));
       th.printStackTrace();
       return null;
     }
   } else if (clsName == null) {
     typeToClassMappingProp.put(typeArg, "*NOTFOUND*");
     showErrorMessage(
         MessageFormat.format(
             ProvClientUtils.getString(
                 "The type {0} does not have the corresponding XMLUIElement specified in the TypeToUIElementMapping.txt file"),
             new Object[] {typeArg}));
   }
   return null;
 }
コード例 #4
0
ファイル: MiscUtilities.java プロジェクト: zukov/Jpicedt
  /** store the given RenderingHints to a Properties object */
  public static void formatRenderingHints(RenderingHints rh, Properties preferences) {

    if (rh.get(RenderingHints.KEY_ANTIALIASING).equals(RenderingHints.VALUE_ANTIALIAS_ON))
      preferences.put("rendering.antialiasing", "on");
    else if (rh.get(RenderingHints.KEY_ANTIALIASING).equals(RenderingHints.VALUE_ANTIALIAS_OFF))
      preferences.put("rendering.antialiasing", "off");

    if (rh.get(RenderingHints.KEY_TEXT_ANTIALIASING).equals(RenderingHints.VALUE_TEXT_ANTIALIAS_ON))
      preferences.put("rendering.text-antialiasing", "on");
    else if (rh.get(RenderingHints.KEY_TEXT_ANTIALIASING)
        .equals(RenderingHints.VALUE_TEXT_ANTIALIAS_OFF))
      preferences.put("rendering.text-antialiasing", "off");

    if (rh.get(RenderingHints.KEY_RENDERING).equals(RenderingHints.VALUE_RENDER_SPEED))
      preferences.put("rendering.render", "speed");
    else if (rh.get(RenderingHints.KEY_RENDERING).equals(RenderingHints.VALUE_RENDER_QUALITY))
      preferences.put("rendering.render", "quality");

    if (rh.get(RenderingHints.KEY_DITHERING).equals(RenderingHints.VALUE_DITHER_ENABLE))
      preferences.put("rendering.dither", "on");
    else if (rh.get(RenderingHints.KEY_DITHERING).equals(RenderingHints.VALUE_DITHER_DISABLE))
      preferences.put("rendering.dither", "off");

    if (rh.get(RenderingHints.KEY_FRACTIONALMETRICS)
        .equals(RenderingHints.VALUE_FRACTIONALMETRICS_ON))
      preferences.put("rendering.fractional-metrics", "on");
    else if (rh.get(RenderingHints.KEY_FRACTIONALMETRICS)
        .equals(RenderingHints.VALUE_FRACTIONALMETRICS_OFF))
      preferences.put("rendering.fractional-metrics", "off");
  }
コード例 #5
0
 public void actionPerformed(java.awt.event.ActionEvent arg0) {
   JPanel4.showCard("router"); // No Internationalisation
   Properties prop = (Properties) routerobject.elementAt(0);
   ((com.adventnet.nms.examples.routermap.RouterDetails) JPanel4.getCard("router"))
       .setValues((Properties) routerobject.elementAt(0)); // No Internationalisation
   JLabel1.setText(
       NmsClientUtil.GetString("Router details  :  ")
           + prop.getProperty("name")); // No Internationalisation
 }
コード例 #6
0
 public Properties getUserInputValues() {
   Properties prop = new Properties();
   for (int i = 0; i < uiList.size(); i++) {
     UserInput ui = (UserInput) uiList.get(i);
     XmlUIElement el = (XmlUIElement) uiElementsList.get(i);
     ui.setValue(el.getValue());
     prop.put("$UserInput$" + ui.getID(), el.getValue());
   }
   return prop;
 }
コード例 #7
0
ファイル: FlowQuad.java プロジェクト: schambersnh/school
  // -------------------------------- main -------------------------------
  public static void main(String[] args) {
    String fileName;
    if (args.length > 0) fileName = args[0];
    else fileName = Utils.getFileName("Choose a flow field metadata file");
    Properties metaData = new Properties();
    try {
      metaData.load(new FileInputStream(fileName));
    } catch (IOException fnf) {
      System.err.println("Can't find file: " + fileName);
      System.exit(-1);
    }
    // ----- get all the properties from the prpoerty file and
    //
    VectorField.xData = new File(metaData.getProperty("xfile"));
    VectorField.yData = new File(metaData.getProperty("yfile"));
    VectorField.width = Utils.toInt(metaData.getProperty("xsize"), 128);
    VectorField.height = Utils.toInt(metaData.getProperty("ysize"), 128);
    VectorField.displayScale = Utils.toInt(metaData.getProperty("displayScale"), 6);
    VectorField.vectorScale = Utils.toDouble(metaData.getProperty("vectorScale"), 10.75);

    VectorField.numParticles = Utils.toInt(metaData.getProperty("numParticles"), 200);
    VectorField.timerDelay = Utils.toInt(metaData.getProperty("delay"), 30);

    FlowQuad vectorField = new FlowQuad("Static Vector Field");
  }
コード例 #8
0
ファイル: proses_Login.java プロジェクト: muhlik/overtimeapps
 public void koneksiDatabase() {
   try {
     String url = "jdbc:mysql://localhost:3306/payroll_db";
     Properties prop = new Properties();
     prop.put("user", "root");
     prop.put("password", "admin");
     konek = DriverManager.getConnection(url, prop);
     status_Proses(true, "Sukses!!!Berhasil Terhubung dengan Database...", 20);
   } catch (SQLException se) {
     status_Proses(false, "Gagal!!!Tidak terhubung \nKarena : " + se, 20);
   }
 }
コード例 #9
0
  public Properties getProperties() {
    Properties prop = new Properties();
    String name = saName.getText();
    String interval = saInt.getText();
    boolean opt = saYes.isSelected();

    prop.put("name", name);
    prop.put("suppressInt", interval);
    prop.put("suppressAll", opt + "");

    return prop;
  }
コード例 #10
0
ファイル: MainWindow.java プロジェクト: hkaiser/TRiAS
 // reads the configuration (breakpoints, window sizes and positions...) for the current index
 private void restoreConfig() {
   Breakpoints.reset();
   Properties.reset();
   try {
     ObjectInputStream in = new ObjectInputStream(new FileInputStream(idxName + ".config"));
     Breakpoints.restore(in);
     Properties.restore(in);
     in.close();
   } catch (IOException exc) {
     // something went wrong - there probably was no .config file
     // ignore it
   }
 }
コード例 #11
0
ファイル: QueryDB.java プロジェクト: chenyuguxing/utils
  /** 利用属性文件中的信息连接数据库 * */
  public static Connection getConnection() throws SQLException, IOException {
    Properties props = new Properties();
    String fileName = "QueryDB.properties";
    FileInputStream in = new FileInputStream(fileName);
    props.load(in);

    String drivers = props.getProperty("jdbc.drivers");
    if (drivers != null) System.setProperty("jdbc.drivers", drivers);
    String url = props.getProperty("jdbc.url");
    String username = props.getProperty("jdbc.username");
    String password = props.getProperty("jdbc.password");

    return DriverManager.getConnection(url, username, password);
  }
コード例 #12
0
 public Properties getPropertiesValue() {
   Properties props = new Properties();
   for (int i = 0; i < propKeyList.size(); i++) {
     String propName = (String) propKeyList.get(i);
     // Since $Template$Params is being appended (before replacement)in the server side latest code
     // it is removed here using substring(15).
     // If not removed, this results in $Template$Params$Template$ParamsSource as the key to be
     // replaced by the user specified value.
     // Check to be introduced in server side.
     // propName = propName.trim().substring(15);
     XmlUIElement el = (XmlUIElement) propValueList.get(i);
     props.put(propName, el.getValue());
   }
   return props;
 }
コード例 #13
0
ファイル: Installer.java プロジェクト: suever/CTP
  private void updateLinuxServiceInstaller() {
    try {
      File dir = new File(directory, "CTP");
      if (suppressFirstPathElement) dir = dir.getParentFile();
      Properties props = new Properties();
      String ctpHome = dir.getAbsolutePath();
      cp.appendln(Color.black, "...CTP_HOME: " + ctpHome);
      ctpHome = ctpHome.replaceAll("\\\\", "\\\\\\\\");
      props.put("CTP_HOME", ctpHome);
      File javaHome = new File(System.getProperty("java.home"));
      String javaBin = (new File(javaHome, "bin")).getAbsolutePath();
      cp.appendln(Color.black, "...JAVA_BIN: " + javaBin);
      javaBin = javaBin.replaceAll("\\\\", "\\\\\\\\");
      props.put("JAVA_BIN", javaBin);

      File linux = new File(dir, "linux");
      File install = new File(linux, "ctpService-ubuntu.sh");
      cp.appendln(Color.black, "Linux service installer:");
      cp.appendln(Color.black, "...file: " + install.getAbsolutePath());
      String bat = getFileText(install);
      bat = replace(bat, props); // do the substitutions
      bat = bat.replace("\r", "");
      setFileText(install, bat);

      // If this is an ISN installation, put the script in the correct place.
      String osName = System.getProperty("os.name").toLowerCase();
      if (programName.equals("ISN") && !osName.contains("windows")) {
        install = new File(linux, "ctpService-red.sh");
        cp.appendln(Color.black, "ISN service installer:");
        cp.appendln(Color.black, "...file: " + install.getAbsolutePath());
        bat = getFileText(install);
        bat = replace(bat, props); // do the substitutions
        bat = bat.replace("\r", "");
        File initDir = new File("/etc/init.d");
        File initFile = new File(initDir, "ctpService");
        if (initDir.exists()) {
          setOwnership(initDir, "edge", "edge");
          setFileText(initFile, bat);
          initFile.setReadable(true, false); // everybody can read //Java 1.6
          initFile.setWritable(true); // only the owner can write //Java 1.6
          initFile.setExecutable(true, false); // everybody can execute //Java 1.6
        }
      }
    } catch (Exception ex) {
      ex.printStackTrace();
      System.err.println("Unable to update the Linux service ctpService.sh file");
    }
  }
コード例 #14
0
 private static String getDefaultSession() {
   String defaultSession = sessions.getProperty("emul.default");
   if (defaultSession != null && !defaultSession.trim().isEmpty()) {
     return defaultSession;
   }
   return null;
 }
コード例 #15
0
ファイル: WordListScreen.java プロジェクト: blueocci/codes
 public void load(ActionEvent e) {
   int returnVal = fc.showOpenDialog(this);
   if (returnVal != JFileChooser.APPROVE_OPTION) {
     return;
   }
   file = fc.getSelectedFile();
   try {
     InputStream in = new BufferedInputStream(new FileInputStream(file));
     Properties newWl = new Properties();
     newWl.load(in);
     in.close();
     setWordList(newWl);
   } catch (IOException ex) {
     handleException(ex);
   }
 }
コード例 #16
0
ファイル: ImageJ.java プロジェクト: chrisp87/ImageJA
 /** Called once when ImageJ quits. */
 public void savePreferences(Properties prefs) {
   Point loc = getLocation();
   prefs.put(IJ_X, Integer.toString(loc.x));
   prefs.put(IJ_Y, Integer.toString(loc.y));
   // prefs.put(IJ_WIDTH, Integer.toString(size.width));
   // prefs.put(IJ_HEIGHT, Integer.toString(size.height));
 }
コード例 #17
0
  public Color getColor(String key) {
    Color tempColor = null;
    Integer tempInt = null;

    String hexTriplet = (String) properties.get(key);
    // Convert to char arrays
    char[] hexChars = hexTriplet.toCharArray();
    char[] red = {hexChars[0], hexChars[1]};
    char[] green = {hexChars[2], hexChars[3]};
    char[] blue = {hexChars[4], hexChars[5]};
    // Convert to Strings
    String r = new String(red);
    String g = new String(green);
    String b = new String(blue);
    // Convert to ints
    tempInt = Integer.parseInt(r);
    int rValue = tempInt.intValue();
    tempInt = Integer.parseInt(g);
    int gValue = tempInt.intValue();
    tempInt = Integer.parseInt(b);
    int bValue = tempInt.intValue();

    tempColor = new Color(rValue, gValue, bValue);

    return tempColor;
  }
コード例 #18
0
 /** Property keys converted to all uppercase. */
 private boolean parseProperty(String line, Properties properties) {
   final int index = line.indexOf(':');
   if (index < 0) return false;
   final String key = line.substring(0, index).trim();
   final String value = line.substring(index + 1).trim();
   properties.setProperty(key.toUpperCase(), value);
   return true;
 }
コード例 #19
0
 /**
  * Produces a ChartingPropertyInspector which tracks property number index from the given
  * properties list, stored in the provided parent frame, and applied in the given simulation. This
  * constructor will give the user a chance to cancel the construction, in which case
  * validInspector will be set to false, and generator may be set to null. In that case, assume
  * that the inspector will be deleted immediately after.
  */
 public ChartingPropertyInspector(
     Properties properties, int index, Frame parent, final GUIState simulation) {
   super(properties, index, parent, simulation);
   generator = chartToUse(properties.getName(index), parent, simulation);
   globalAttributes =
       findGlobalAttributes(); // so we share timer information.  If null, we're in trouble.
   validInspector = (generator != null);
 }
コード例 #20
0
  public SessionPanel startNewSession() {
    String sel = "";
    if (containsNotOnlyNullValues(sessionArgs) && !sessionArgs[0].startsWith("-")) {
      sel = sessionArgs[0];
    } else {
      sel = getDefaultSession();
    }

    Sessions sess = manager.getSessions();

    if (sel != null && sess.getCount() == 0 && sessions.containsKey(sel)) {
      sessionArgs = new String[TN5250jConstants.NUM_PARMS];
      parseArgs(sessions.getProperty(sel), sessionArgs);
    }

    return newSession(sel, sessionArgs);
  }
コード例 #21
0
 // 采用静态初始化块来初始化Connection、Statement对象
 static {
   try {
     Properties props = new Properties();
     props.load(new FileInputStream("mysql.ini"));
     String drivers = props.getProperty("driver");
     String url = props.getProperty("url");
     String username = props.getProperty("user");
     String password = props.getProperty("pass");
     // 加载数据库驱动
     Class.forName(drivers);
     // 取得数据库连接
     conn = DriverManager.getConnection(url, username, password);
     stmt = conn.createStatement();
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
コード例 #22
0
  public static void sfSendEmail(String subject, String message) throws Exception {

    String SMTP_HOST_NAME = "smtp.gmail.com";
    String SMTP_PORT = "465";
    // message = "Test Email Notification From Monitor";
    // subject = "Test Email Notification From Monitor";
    String from = "*****@*****.**";
    String[] recipients = {
      "*****@*****.**", "*****@*****.**", "*****@*****.**"
    };
    String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
    // String[] recipients = { "*****@*****.**"};
    // String[] recipients = { "*****@*****.**", "*****@*****.**",
    // "*****@*****.**", "*****@*****.**", "*****@*****.**",
    // "*****@*****.**", "*****@*****.**"};
    // String[] recipients = {"*****@*****.**"};

    Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());

    boolean debug = true;

    Properties props = new Properties();
    props.put("mail.smtp.host", SMTP_HOST_NAME);
    props.put("mail.smtp.auth", "true");
    // props.put("mail.debug", "true");
    props.put("mail.smtp.port", SMTP_PORT);
    props.put("mail.smtp.socketFactory.port", SMTP_PORT);
    props.put("mail.smtp.socketFactory.class", SSL_FACTORY);
    props.put("mail.smtp.socketFactory.fallback", "false");

    Session session =
        Session.getDefaultInstance(
            props,
            new Authenticator() {

              protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication(
                    "*****@*****.**", "els102sensorweb");
              }
            });

    // session.setDebug(debug);

    Message msg = new MimeMessage(session);
    InternetAddress addressFrom = new InternetAddress(from);
    msg.setFrom(addressFrom);

    InternetAddress[] addressTo = new InternetAddress[recipients.length];
    for (int i = 0; i < recipients.length; i++) {
      addressTo[i] = new InternetAddress(recipients[i]);
    }
    msg.setRecipients(Message.RecipientType.TO, addressTo);

    // Setting the Subject and Content Type
    msg.setSubject(subject);
    msg.setContent(message, "text/plain");
    Transport.send(msg);

    System.out.println("Sucessfully Sent mail to All Users");
  }
コード例 #23
0
ファイル: ImageJ.java プロジェクト: chrisp87/ImageJA
 void configureProxy() {
   if (Prefs.useSystemProxies) {
     try {
       System.setProperty("java.net.useSystemProxies", "true");
     } catch (Exception e) {
     }
   } else {
     String server = Prefs.get("proxy.server", null);
     if (server == null || server.equals("")) return;
     int port = (int) Prefs.get("proxy.port", 0);
     if (port == 0) return;
     Properties props = System.getProperties();
     props.put("proxySet", "true");
     props.put("http.proxyHost", server);
     props.put("http.proxyPort", "" + port);
   }
   // new ProxySettings().logProperties();
 }
コード例 #24
0
  public void setProperties(String actionName) {
    saName.setEnabled(true);
    if (actionName == null) {
      saInt.setText(0 + "");
      saYes.setSelected(true);
      saInt.setEnabled(false);
      saNo.setSelected(false);
      saName.setText("");
      saName.setEnabled(true);
    } else if (NotifierList.notifiers.get(actionName) == null) {

      saInt.setText(0 + "");
      saYes.setSelected(true);
      saInt.setEnabled(false);
      saNo.setSelected(false);
      saName.setText("");
      saName.setEnabled(true);
    } else {

      FilterAction action = (FilterAction) NotifierList.notifiers.get(actionName);
      Properties prop = action.getProperties();

      String saint = prop.getProperty("suppressInt");
      if (saint == null) saint = "0";
      saInt.setText(saint);

      String name = prop.getProperty("name");
      if (name == null) name = "";
      saName.setText(name);

      saName.setEnabled(false);

      String opt = prop.getProperty("suppressAll");
      if (opt != null && opt.equals("true")) {
        saYes.setSelected(true);
        saInt.setEnabled(false);
        saNo.setSelected(false);
      } else {
        saYes.setSelected(false);
        saInt.setEnabled(true);
        saNo.setSelected(true);
      }
    }
  }
コード例 #25
0
  protected void closingDown(TerminalViewInterface view) {

    Sessions sess = manager.getSessions();

    if (log.isDebugEnabled()) {
      log.debug("number of active sessions is " + sess.getCount());
    }

    if (viewNamesForNextStartBuilder == null) {
      // preserve sessions for next boot
      viewNamesForNextStartBuilder = new StringBuilder();
    }
    while (view.getSessionViewCount() > 0) {
      SessionPanel sesspanel = view.getSessionAt(0);
      viewNamesForNextStartBuilder.append("-s ").append(sesspanel.getSessionName()).append(" ");
      closeSessionInternal(sesspanel);
    }

    sessions.setProperty(
        "emul.frame" + view.getFrameSequence(),
        view.getX() + "," + view.getY() + "," + view.getWidth() + "," + view.getHeight());

    frames.remove(view);
    view.dispose();

    log.debug("number of active sessions we have after shutting down " + sess.getCount());

    log.info("view settings " + viewNamesForNextStartBuilder);
    if (sess.getCount() == 0) {

      sessions.setProperty("emul.width", Integer.toString(view.getWidth()));
      sessions.setProperty("emul.height", Integer.toString(view.getHeight()));
      sessions.setProperty("emul.view", viewNamesForNextStartBuilder.toString());

      // save off the session settings before closing down
      ConfigureFactory.getInstance()
          .saveSettings(
              ConfigureFactory.SESSIONS, ConfigureFactory.SESSIONS, "------ Defaults --------");
      if (controller != null) {
        controller.interrupt();
      }
      System.exit(0);
    }
  }
コード例 #26
0
ファイル: MainWindow.java プロジェクト: hkaiser/TRiAS
 // saves the current configuration (breakpoints, window sizes and positions...)
 private void saveConfig() {
   try {
     ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(idxName + ".config"));
     Breakpoints.save(out);
     Properties.save(out);
     out.close();
   } catch (IOException exc) {
     consoleFrame.echoInfo("Could not save settings: " + exc);
   }
 }
コード例 #27
0
ファイル: FileOpener.java プロジェクト: earrouvi/PAPPL
 private Double getNumber(Properties props, String key) {
   String s = props.getProperty(key);
   if (s != null) {
     try {
       return Double.valueOf(s);
     } catch (NumberFormatException e) {
     }
   }
   return null;
 }
コード例 #28
0
ファイル: MiscUtilities.java プロジェクト: zukov/Jpicedt
 /**
  * Return a integer parsed from the value associated with the given key, or "def" in key wasn't
  * found.
  */
 public static int parseProperty(Properties preferences, String key, int def) {
   String val = preferences.getProperty(key);
   if (val == null) return def;
   try {
     return Integer.parseInt(val);
   } catch (NumberFormatException nfe) {
     nfe.printStackTrace();
     return def;
   }
 }
コード例 #29
0
ファイル: Notepad.java プロジェクト: ArcherSys/ArcherSysRuby
 static {
   try {
     properties = new Properties();
     properties.load(Notepad.class.getResourceAsStream("resources/NotepadSystem.properties"));
     resources = ResourceBundle.getBundle("resources.Notepad", Locale.getDefault());
   } catch (MissingResourceException | IOException e) {
     System.err.println(
         "resources/Notepad.properties " + "or resources/NotepadSystem.properties not found");
     System.exit(1);
   }
 }
コード例 #30
0
ファイル: MiscUtilities.java プロジェクト: zukov/Jpicedt
  /** Returns a RenderingHints parsed from the given Properties */
  public static RenderingHints parseRenderingHints(Properties preferences) {

    RenderingHints rh = new RenderingHints(null);
    String str;
    str = preferences.getProperty("rendering.antialiasing");
    if (str != null) {
      if (str.equals("on"))
        rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
      else if (str.equals("off"))
        rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
    }
    str = preferences.getProperty("rendering.text-antialiasing");
    if (str != null) {
      if (str.equals("on"))
        rh.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
      else if (str.equals("off"))
        rh.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
    }
    str = preferences.getProperty("rendering.render");
    if (str != null) {
      if (str.equals("speed"))
        rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);
      else if (str.equals("quality"))
        rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
    }
    str = preferences.getProperty("rendering.dither");
    if (str != null) {
      if (str.equals("on"))
        rh.put(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
      else if (str.equals("off"))
        rh.put(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
    }
    str = preferences.getProperty("rendering.fractional-metrics");
    if (str != null) {
      if (str.equals("on"))
        rh.put(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
      else if (str.equals("off"))
        rh.put(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_OFF);
    }
    return rh;
  }