http://docs.oracle.com/javase/1.3/docs/guide/intl/addingfonts.html
Monday, January 16, 2012
Oracle forms Fonts explained
http://docs.oracle.com/javase/1.3/docs/guide/intl/addingfonts.html
Tuesday, March 04, 2008
Keyboard state - hebrew
1) Compile the java code to generate the class files.
++ Since the sample code uses forms classes also, it is necessary to include the frmall.jar(10.1.2)/f90all.jar(9.0.4) in CLASSPATH before compilation.
set CLASSPATH=%ORACLE_HOME%\forms\java\frmall.jar;%CLASSPATH% (in 10.1.2 windows)%ORACLE_HOME%\jdk\bin\javac ChangeInputMethodOnFocus.java
%ORACLE_HOME%\jdk\bin\javac VTextFieldHeb.java %ORACLE_HOME%\jdk\bin\javac VTextFieldEng.java 2) Generate the jar file with the 'jar' command to package the class files in step 1.
%ORACLE_HOME%\jdk\bin\jar -cvf InputMethod.jar VTextFieldEng.class VTextFieldHeb.class ChangeInputMethodOnFocus.class3) Place the jar file in the codebase directory of Forms which is ORACLE_HOME/forms90/java(9.0.4 version) or ORACLE_HOME/forms/java(10.1.2 version) directory by default.
4) Include the jar file in the archive parameter in formsweb.cfg to enable the jar file to be downloaded and cached on the client machine.
archive=frmall.jar,InputMethod.jar5) Set the 'Implementation Class' property in the form to 'VTextFieldHeb' for the Hebrew text items and 'VTextFieldEng' for english text items where this functionality is required.
Sample Code
-------------------ChangeInputMethodOnFocus.java--------------------
import java.awt.Component;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.im.InputContext;
import java.util.Locale;
public class ChangeInputMethodOnFocus extends FocusAdapter
{
Locale _locale;
class="km">Locale defLocale;public ChangeInputMethodOnFocus(Locale locale)
{
_locale = locale;
}
public void focusGained(FocusEvent fe)
{
Component c = fe.getComponent();
InputContext inputContext = c.getInputContext();
defLocale = inputContext.getLocale();
inputContext.selectInputMethod(_locale);
}
public void focusLost(FocusEvent fe) {
Component c = fe.getComponent();
InputContext inputContext = c.getInputContext();
inputContext.selectInputMethod(defLocale);
}
}
----------------VTextFieldHeb.java ------------------
import java.util.Locale;
import oracle.forms.handler.IHandler;
import oracle.forms.ui.VTextField;
public class VTextFieldHeb extends VTextField
{
public void init(IHandler ih)
{
super.init(ih);
ChangeInputMethodOnFocus focusAdapter = new ChangeInputMethodOnFocus (new Locale("iw","IL"));
this.addFocusListener(focusAdapter);
}
} ----------------VTextFieldEng.java ------------------
import java.util.Locale;
import oracle.forms.handler.IHandler;
import oracle.forms.ui.VTextField;
public class VTextFieldEng extends VTextField
{
public void init(IHandler ih)
{
super.init(ih);
ChangeInputMethodOnFocus focusAdapter = new ChangeInputMethodOnFocus (new Locale("en","US"));
this.addFocusListener(focusAdapter);
}
}
Sample Code Output
When you navigate to text items which implement the 'VTextFieldHeb' class, the input locale automatically changes to 'HE' (Hebrew)
and you can begin to enter Hebrew characters. Then when you navigate to text items which implement the 'VTextFieldEng' class, the input locale automatically changes to 'EN' (English) and you can enter English characters.
Additional information
This solution is also applicable for arabic language after performing the following:
1)-On the client machine ,set "Arabic
(Egypt)" as an input keyboard language.
2)-In the above code,change:
ChangeInputMethodOnFocus (new Locale("iw","IL"));
To be:
ChangeInputMethodOnFocus (new Locale("ar","EG"));
Tuesday, November 07, 2006
Fonts in Web Forms
There are 2 relevent config files:
1.
2. C:\Program Files\Oracle\JInitiator 1.3.1.22\lib\font.properties
client side file - instaled with the JInitiator and we will need to distribute the new file to the clients
The first file map font names from the forms application to java forn name:
default.fontMap.appFontnames
default.fontMap.javaFontnames
so that courier new will become monospace in the web application
and Courier =MonoSpaced
courier = Dialog
System = Serif
and so on.
If there is a font in the form that we want to change to another font then we need to add the font name and the java font name to the list.
Default Java fonts (case sensitive):
Monospaced (fixed length fonts)
Dialog
Serif
SansSerif
Now the second file: font.properties OR font.properties.
In this file the first part maps jave font names to local font names.
For each java font there is maping to a local font with all different situations he might face (bold, Italic..).
e.g.
dialog.plain.0=Arial,DEFAULT_CHARSET
Dialog Java font will become Arial at the local machine.
monospaced.plain.0=Courier New,DEFAULT_CHARSET
MonoSpaced Java font will become Courier New at the local machine.
Later in this file we need to define where to find those fonts on the client:
filename.Arial=ARIAL.TTF
filename.Courier_New=COUR.TTF
Now the only problem is how to distribute this files to all client (hint - we use the JInitiator installation for it).
This will be coverd in a different post.
Cheers