2017-09-06 6 views
1

JXLayerとpbjar-Frameworkを使用してズーム可能なUIを持つJavaスイングプロジェクトがあります。java webstart System.getProperties()またはSyste.setProperties()が無視されます

/** 
* {@link JTextComponent} and its descendants have some caret position 
* problems when used inside a transformed {@link JXLayer}. When you plan to 
* use {@link JTextComponent}(s) inside the hierarchy of a transformed 
* {@link JXLayer}, call this method in an early stage, before instantiating 
* any {@link JTextComponent} . 
* <p> 
* It executes the following method: 
* 
* <pre> 
* System.setProperty(&quot;i18n&quot;, Boolean.TRUE.toString()); 
* </pre> 
* 
* As a result, a {@link GlyphPainter} will be selected that uses floating 
* point instead of fixed point calculations. 
* </p> 
*/ 
public static void prepareForJTextComponent() { 
    System.setProperty("i18n", Boolean.TRUE.toString()); 
} 

すべてのJARファイルが有効な証明書で署名されている、とJNLPは

<?xml version="1.0" encoding="utf-8"?> 
<jnlp spec="7.0+" codebase="https://__HOST_IP____HOST_HTTPS_PORT__/test" 
    href="client/1024.jnlp"> 
    <information> 
    <offline-allowed /> 
    </information> 
    <security> 
    <all-permissions /> 
    </security> 
    <resources> 
    <j2se version="1.8+" java-vm-args="-Xmx512M" /> 
    <jar href="client.jar" /> 
    ... more JARs 
    </resources> 
    <application-desc main-class="de.test.Frame"> 
    <argument>__HOST_IP__</argument> 
    </application-desc> 
</jnlp> 

client.jarのようになります:TransformUI.javaで、次の方法で固定されているJTextComponentsとの問題がありましたjavawsは私が

メインクラスで呼び出すだけで、安全な性質を受け入れるのでMANIFEST.MFは

... 
Permissions: all-permissions 
Codebase: * 
Trusted-Only: false 
Trusted-Library: false 
... 

次のものが含ま

static 
{ 
    TransformUI.prepareForJTextComponent(); 
} 

ブラウザごとにJava Web Startを使用すると、JTextComponentの修正が機能しないという問題があります。 JavaのWebStartのために

私は4例テスト:

  1. javaの
  2. のjavaws [URL]
  3. のjavaws [ローカルファイル]
  4. ブラウザ
オラクルのJava 8u141を使用して

テストを、 32または64ビット、Windows 7 64ビット、Linux Debian 7 64ビット、firefox java

私は

のjavaws [URL]

修正プログラムが正常に動作するJavaアプリケーションとしてクライアントを呼び出した場合、このコールはLinuxとWindowsで正常に動作します。 しかし、このコールワーク私は

のjavaws [ローカルファイル]

がないキャッシュされたファイル

を削除するまで1時間、我々はサードパーティのJARを含めるように拡張機能を使用JNLPファイルのとWindowsで古いバージョンで

ブラウザ

任意の提案を動作しない動作しない理由SYステムのプロパティは機能しませんか?

javax.swing.text.AbstractDocument.AbstractDocument(コンテンツのAttributeContext)SystemProperty「国際化」の

答えて

0

がreadedされています。私の場合は

... 
if (defaultI18NProperty == null) { 
    // determine default setting for i18n support 
    String o = java.security.AccessController.doPrivileged(
    new java.security.PrivilegedAction<String>() { 
     public String run() { 
     return System.getProperty(I18NProperty); 
     } 
    } 
); 
    if (o != null) { 
    defaultI18NProperty = Boolean.valueOf(o); 
    } else { 
    defaultI18NProperty = Boolean.FALSE; 
    } 
} 
putProperty(I18NProperty, defaultI18NProperty); 
.... 

私は私自身を使用してプロパティは常に「true」に設定する必要がありますJTextFieldクラス:

class MyTextField extends JTextField { 
    MyTextField() { 
    super(); 
    Document doc = new PlainDocument(); 
    doc.putProperty("i18n", Boolean.TRUE); 
    this.setDocument(doc); 
    } 
} 
関連する問題