Some country native characters in AWT components

Hi All,
I have problem with visualization some native characters on AWT components. For instance, when I put on the Frame some Labels components, then I can't see correct some special polish native characters, I can only see some boxes. It seems the same with some other AWT components with a text entry.
This problem is only in GUI, because some other issues like Strings and Stream processing works good.
(I tested it both on WinXP and Linux SuSE 9.1 with the same result)
Thanks in advance for some help
Krzysztof

Have you tried doing this in Swing? Works for me:
import java.awt.*;
import javax.swing.*;
public class FontExample {
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable(){
            public void run() {
                buildGUI();
    static void buildGUI() {
        Font font=new Font("Dialog",Font.PLAIN,12);
        String text="re\u0123istr\u0113tiem";
        JTextArea textarea=new JTextArea();
        textarea.setFont(font);
        textarea.setText(text);
        JComboBox combo=new JComboBox(new String[]{text});
        combo.setFont(font);
        JFrame f = new JFrame("FontExample");
        Container cp = f.getContentPane();
        cp.add(combo, BorderLayout.NORTH);
        cp.add(textarea, BorderLayout.CENTER);
        f.pack();
        f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        f.setLocationRelativeTo(null);
        f.setVisible(true);
}

Similar Messages

  • Characters show up as boxes when using AWT components.

    Having installed on a Windows XP english OS the asian languages packs (with fonts included, from Microsoft) and knowing that with MS Gothic, Gulim and Simsun you can display japanese, korean and chinese characters it seems that on JRE 1.5 and up this is not possible (boxes appear instead) on any applet.
    How to reproduce:
    Label l2 = new Label("Japanese chars: \u8457\u4f5c\u6a29");
    Workaround:
    Step 1. Rename ..\jre\lib\fontconfig.properties.src to ……\fontconfig.properties
    Step 2. Modify the following line:
    sequence.allfonts=alphabetic/default,dingbats,symbol
    to
    sequence.allfonts=alphabetic/default,dingbats,symbol,japanese,chinese-ms936,chinese-ms950,korean
    How is this possible? On JRE 1.4 this was working. Also another fix is to use Swing components instead but this is not realistic for a big project.
    Any help will be greatly apprecied.

    The problem is related to the JRE v. 1.5.0_11 or greater. In JRE 1.4.2_13 for each language there was a configuration file that Java was using to determine which fonts to use for different categories of objects.
    The problem is encountered only for AWT components.
    Starting with JRE 1.5 (http://java.sun.com/j2se/1.5.0/docs/guide/intl/fontconfig.html) there is only one configuration file (fontconfig.properties.src) for all the languages. Since the character subsets supported by given fonts often overlap, in the file separate search sequence properties are used to define in which order to try the fonts when rendering a character. In the default version of the file this properties do not specify also the asian languages.
    We have to do the following things:
    *1.* You must first install into Windows the support for asian languages: Control Panel - > Regional and Language Options
    � On the Advanced tab add the conversion tables for all Asian languages (this action may not be required).
    � On the Languages tab check �Install files for East Asian Languages (this action is required)
    Restart the computer.
    *2.* Assure you have the needed asian fonts : batang(fopr korean), simsun, gulim, mingliu, msgothic(for japanese) installed.
    *3.* Rename ...\jre\lib\fontconfig.properties.src to ��\jre\lib\fontconfig.properties. By doing this the fontconfig.properties file will be used by the JRE as the default configuration file.
    *4.* Modify the following line:
    sequence.allfonts=alphabetic/default,dingbats,symbol
    to
    sequence.allfonts=alphabetic/default,dingbats,symbol,japanese,chinese-ms936,chinese-ms950,korean
    *5.* Assure that in the file the logical to physic font binding, binds to existing fonts.
    Obs: If step 1 is skipped the titles of the windows will still have boxes.
    Hope it helps.
    Donoiu Cristian

  • Why the AWT components are called heavy-weight and SWING as light-weight?

    Why the AWT components are called heavy-weight and SWING as light-weight?.
    Building our own components means overhead on JVM. hence in what sence the SWING components are called light weight.?
    I know that the Swing componets are the components which are not going to depend upon peer classes and render, OS independent LOOK n FEEL.
    Thanks,
    Sanath Kumar

    All extensions of Component are considered lightweight since, as you point out, they don't have their own dedicated native peer.
    Essentially a lightweight component only has a canvas on which to draw itself and some means of receiving events from the system. In fact, there is no need to have one of these "canvas" and "event" objects for each component - the parent component can manage these abilities on behalf of its children. Eventually you end up with only top-level components needing to be heavyweight in order to communicate with the windowing system.
    A lightweight component therefore has the minimal dependency on the underlying windowing system giving you maximum cross-platform flexibility.
    It is usually true that lightweight => slower and heavyweight => faster since it is reasonable to assume that native peers will be optimal for the windowing system. However, that's not the point of the lightweight/heavyweight distinction.
    Hope this helps.

  • The final solution to greek characters in AWT applets(????)

    OK. I have searched the whole web and asked whoever I knew. The question was simple: How do I show greek characters in a TextField in an AWT Applet? Some people said that I should change the font properties inside MY jre/lib installation but then I want EVERYONE and not just ME seeing the greek characters! Adding a greek font into the applet's jar was another "solution" but who wants to have an applet of about 2MBs? So I think I have come up to the answer ... ONLY with jre > 1.4.0 somebody could handle greek characters in AWT Applets without trooble! If somebody has managed to show and handle greek characters in a TextField inside an AWT Applet (which I doubt), I would like to know EXACTLY HOW as I am tired of non-working "solutions"! I hope this post saves you from a lot of time searching for the HolyGrail

    I haven't worked with a TextField but I worked with a JTextField. My solution wasn't very straightforward but it did the job.
    I used this solution in order to work with linux, but you must add an if
    statement to check the OS.
    If your problem was how to view Greek characters in a non internation version of
    Java, then as far as I know, you cannot! Also JDK 1.3.1_01 and j2re 1.4.0_01
    use a different way of loading system fonts, so with the latter you cannot use system fonts unless you put them in you java directory.
    (I use linux so don't be surprissed if these work different in windows)
    import java.io.*;
    public class JTextFieldGr extends javax.swing.JTextField {
    public JTextFieldGr() {
    super();
    myInit();
    public JTextFieldGr(String text) {
    super(text);
    myInit();
    public void myInit() {
    addKeyListener(new java.awt.event.KeyListener() {
    public void keyTyped(java.awt.event.KeyEvent evt){
    try{
    String tmp=""+evt.getKeyChar();
    String uk=new String(tmp.getBytes(),"ISO-8859-7");
    evt.setKeyChar(uk.charAt(0));
    }catch(UnsupportedEncodingException e){
    e.printStackTrace();
    public void keyPressed(java.awt.event.KeyEvent evt){
    public void keyReleased(java.awt.event.KeyEvent evt){
    }

  • Multilanguage support for awt components..

    hi all,
    when i tried to use .setFont() method for awt componets like labels and buttons it is displayed as rectangles insted of showing the appropriate characters. actually i tried to set the font to "simsun" (unicode font for chinese). but it works fine for swing components.
    how can we achieve that for awt without changing the font.properties file? or how can we insist to use the font.properties file supplied by us insted of default font.property file for that language?
    can we run the application by putting our font.properties file which is meant to be used for only our application, in the current working folder insted of putting in javahome\jre\lib path?
    thanks in advance..
    regards
    sojan

    Hi Sojan,
    first up, forget the notion of even tinkering with the font.properties file if you can. It's an old, outdated method of setting up the fonts that Sun doesn't even support any more. Use setFont() where you can, and die trying in the process! ;-)
    One thing I would check is which font each AWT component currently thinks it has. It's easy enough to set the font system wide with Swing components, but I'm not sure if that capability extends to AWT components (I've certainly had trouble with it in various places in the past). While you've set up the Chinese font correctly, your AWT components might still be stuck with the Java default (Helvetica, or whatever it is, which is incapable of displaying Chinese), and hence displaying the rectangles because they don't know how to handle the foreign characters. You might need to set SimSun as the font for each of your AWT components individually at a worst-case scenario.
    Hope that helps,
    Martin Hughes

  • Changing AWT components to Swing components

    I'm having a little trouble changing some AWT components to Swing components. I received an error message when I tried to run my program. I looked up the component in the java docs. But, I did not see the option the error was talking about. The error and the area of code is listed below. Thank you for any help you can provide.
    Error message:
    Exception in thread "main" java.lang.Error: Do not use P5AWT.setLayout() use P5A
    WT.getContentPane().setLayout() instead
    at javax.swing.JFrame.createRootPaneException(JFrame.java:446)
    at javax.swing.JFrame.setLayout(JFrame.java:512)
    at P5AWT.<init>(P5AWT.java:56)
    at P5AWT.main(P5AWT.java:133)
    Press any key to continue . . .
    Code:
    JPanel p3 = new JPanel();
    p3.setLayout(new FlowLayout(FlowLayout.CENTER));
    ta = new JTextArea(20, 60);
    p3.add(ta);
    setLayout(new FlowLayout(FlowLayout.CENTER));
    add(p3);

    you need to change the line...
    setLayout(new FlowLayout(FlowLayout.CENTER)); to
    getContentPane().setLayout(new FlowLayout(FlowLayout.CENTER));

  • Lots of AWT components

    Im just wondering are there any good free tools to quickly layout lots of AWT components?
    Also how easy is it to produce tabs in AWT? is it as simple as assigning different panels to each tab?
    One more question, if there are lots of components on a screen, how fast is the AWT? for example, will it have a problem displaying 40 something components?
    Thanks for any help

    For the tab thing: Use JTabPane (which internally probably uses CardLayout), it�s very very easy: Check out the JtabePane example in SwingSet in Java Web Start, the source code is included.
    Layouting like 40 components isn�t really a performance question, because it�s nothing compared to drawing a 100*100 image.
    It takes advanced programming stuff before you will have perfomance problems, without using infinity loops or blocking the thread (by sleep or so)
    To layout many components, use several of the basic layout managers wich each other or use GridBagLayout or use my open source, free ProportionLayout (written to solve some probs I had with GridBag):
    http://users.pandora.be/lunatic/ProportionLayout/

  • CardLayout & AWT Components

    Switching between panels when using AWT components with a CardLayout is not as smooth as when using Swing components.
    At best the 2 panels seem to merge into one another until only one is displayed, while at worst a part of the previous panel can remain on the screen for a half second or so before the switch is complete.
    Kind of hard to explain but there is no instantaneous switch like you get when using Swing components.
    As I hope to eventually run this GUI as an Applet - when the problem may, I imagine, become even more pronounced - I would be grateful for any assistance anyone could offer on this matter.
    When switching the panels ALL I do is:
    cardLayout.show(deck, "PanelName");

    Well it's too big to post the whole thing. Some snippets:
    // add the panels to the cardLayout
    deck = new Panel();
    deck.setLayout(cardDisplay);
    deck.add(menuPanel, "MenuPanel");
    deck.add(notePanel, "NotePanel");
    deck.add(logonPanel, "LogonPanel");
    deck.add(tabbedPane, "TabbedPane");
    this.add(deck);
    cardDisplay.show(deck, "LogonPanel");
    // switch on some button press
    if (e.getSource() == appendNote)
    cardDisplay.show(deck, "NotePanel");
    noteArea.requestFocus();

  • Problems displaying Thai characters in FTE components on Mac

    I had originally posted a question here: http://forums.adobe.com/message/4027591, but was told that this is more of a flash runtime issue.
    I am running into issues displaying Thai characters in Flex components that make use of the Flash Text Engine (FTE), specifically on Mac OSX 10.6.8 Snow Leopard.
    Here's a blurb of my compiler font managers in flex-config.xml:
    <flex-config>
            <target-player>10.2.0</target-player>
            <!-- Specifies the version of the compiled SWF -->
            <swf-version>11</swf-version>
            <compiler>
              <!-- Specifies the locales for internationalization. -->
              <locale>
                  <locale-element>en_US</locale-element>
              </locale>
              <fonts>
                  <!-- ... -->
                  <!-- Compiler font manager classes, in policy resolution order-->
                  <managers>
                      <manager-class>flash.fonts.JREFontManager</manager-class>
                      <manager-class>flash.fonts.BatikFontManager</manager-class>
                      <manager-class>flash.fonts.AFEFontManager</manager-class>
                      <manager-class>flash.fonts.CFFFontManager</manager-class>
                  </managers>
                    <!-- ... -->
                </fonts>
            </compiler>
        </flex-config>
    ...and another from flash-unicode-table.xml:
    <language-range>
        <lang>Thai</lang>
        <range>U+0E01-0E5B</range>
    </language-range>
    My flex application originally had the following defined in its stylesheet:
        Application {
            fontSize: 12px;
            fontFamily: Arial;
            font-sharpness:0;
            font-anti-alias-type:advanced;
    Thai characters render correctly in mx components such as TextField so far.  However, FTE components such as TextLine show those crappy-looking boxes as a substitution.  My initial guess was that somehow one of the compiler font managers declared in flex-config.xml was not finding the right system font to fallback to for Thai characters.  So, I ensured the system font was installed by going to System Preferences > Language and Text > Edit List.  Then I changed fontFamily to Arial, Ayuthaya.  Still was seeing the boxes of evil.
    Next I figured that perhaps the Arial font might be assigning a box for each unicode value corresponding to a Thai character.  So it was effectively overriding the Ayuthaya system font.  So I changed fontFamily once more to just Ayuthaya and this worked with one issue - Ayuthaya looks inherently different from Arial for non-thai characters.
    Here's my question - is there a less invasive way to support Thai in FTE components such that the appearance of the text is closer to the Arial font?  I would rather not embed a font because I'm constrained on SWF size.
    Oh and I'm using flash player 10.3 right now.

    OK, I asked the FTE team and got this reply: "Lucida Grande is CTS's fallback font for Thai.  This font on OS 10.7 and 10.6 are not supporting Thai anymore.  The version on 10.5 was supporting it." This means that it's our bug that we keep using Lucida Grande as fallback font even Apple dropped support Thai script with that font after 10.6. Unfortunately this bug was deferred from current development release (11.2) because of time constraint. If this support is critical for your business, can you open a bug in our public bugbase and ask as many vote as possible? In this way I may be able to convince internal team to fix this bug in next release.
    Thank you for your feedback!
    Hitomi

  • URLEneQuery encoding is failing for some non english characters

    While creating a URLEneQuery we are getting error com.endeca.navigation.InternalException: No support for 8-bit urls.
    This error happens when the query string has some non english characters. (eg: Á).

    UrlENEQuery is designed around processing URL data, and URLs are not permitted non-ASCII characters in their production. To represent non-ASCII characters they must be %-encoded in URLs according to their byte(s) representation in a particular character-encoding, and you should prefer UTF-8 for URLs. So your LATIN CAPITAL LETTER A WITH ACUTE (U+00C1) should appear as %C3%81 in your URL, then UrlENEQuery should be able to process that character.

  • Suddenly some of the characters in mail have turned into 'A's with boxes around them?

    I don't think I changed any settings, but suddenly some of the characters in my emails received have utrned into 'A's with boxes around them. A think the characters that have changed are in italics (see pic below).
    Any suggestions what has gone wrong here and how I can fix it?
    Thanks!

    Back up all data.
    Launch the Font Book application and validate all fonts. You must select the fonts in order to validate them. See the built-in help and the support article linked below for instructions. If Font Book finds any issues, resolve them, then boot in safe mode* (by holding down the shift key at the startup chime) to rebuild the font caches. Boot again as usual and test.
    Mac 101: Font Book
    *Note: If FileVault is enabled under OS X 10.7 or later, or if a firmware password is set, or if the boot volume is a software RAID, you can’t boot in safe mode. In that case only, after running Font Book, launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Drag or copy — do not type — the following line into the Terminal window, then press return:
    sudo atsutil databases -remove
    You'll be prompted for your login password, which won't be displayed when you type it. You may get a one-time warning not to screw up. After running the command, reboot as usual.

  • [svn:fx-trunk] 11118: Did some code cleanup on the Spark components to enforce the conventions about how to order stuff within an AS file .

    Revision: 11118
    Author:   [email protected]
    Date:     2009-10-23 16:35:38 -0700 (Fri, 23 Oct 2009)
    Log Message:
    Did some code cleanup on the Spark components to enforce the conventions about how to order stuff within an AS file.
    QE notes: None
    Doc notes: None
    Bugs: None
    Reviewer: None; no functional changes
    Tests run: ant checkintests
    Is noteworthy for integration: No
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/ButtonBar.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/CheckBox.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/DropDownList.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/List.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/NumericStepper.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Panel.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/RadioButton.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Spinner.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/TextArea.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/TextInput.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBase.a s
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/ListBase.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/SkinnableTex tBase.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/Slider.as

    Hi Rod,
    different sources (i.e. different branches) are mapped to different local folders in your workspace - in fact you cant map two different server folder to the same local folder.
    In you example the mapping would be (for example) like this:
    Server path                                                          
    local path
    $/../WpfHelloWorld                                                
    C:\Src\WpfHelloWorld
    $/../WpfHelloWorldDev                                           
    C:\Src\WpfHelloWorldDev             
    You can see your Workspace mappings when you select "Workspaces..." in the Workspace selection drop down:
    Within the "Manage Workspaces" dialog select your workspace and klick "Edit" to see and edit all you mappings.

  • How to exclude accent characters in Text components

    How can I exclude accent characters in Text components. I
    just want the keystroke do nothing for accent characters.

    I assume you mean TextInput.
    Easiest way? You may want to do something like this, it
    restricts input to only the provided characters, so you'd have to
    add any others that you DO want:
    restrict="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
    Harder way? Extend TextInput (but it only stops `):

  • Overlapping AWT components

    Hi, is there anyway to control how awt components are added when they overlap over each other? (such as sending it to the front or back of all components) I have a container that has several canvases, where the last component added should be on top. Unfortunately, the canvas is always covered by the other canvas. Any advice?

    Look at his program : the last canvas is on top of the second that is no top of the first,
    mport java.awt.*;
    import java.awt.event.*;
    public class Overlap extends Frame
    public Overlap() 
         addWindowListener(new WindowAdapter()
        {     public void windowClosing(WindowEvent ev)
              {     dispose();
                   System.exit(0);}});
         setBounds(10,10,500,400);
         setLayout(null);     
         Canvas c1 = new Canvas();
         c1.setBounds(30,30,100,100);
         c1.setBackground(Color.pink);
         add(c1,0);
         Canvas c2 = new Canvas();
         c2.setBounds(100,100,130,130);
         c2.setBackground(Color.red);
         add(c2,0);
         Canvas c3 = new Canvas();
         c3.setBounds(200,200,100,100);
         c3.setBackground(Color.orange);
         add(c3,0);
         setVisible(true);
    public static void main (String[] args) 
         new Overlap();
    Noah

  • Some iOS Native extensions that can be useful

    Hi,
    I have made some iOS Native extensions that can be useful.
    You can find it at https://github.com/xperiments?tab=repositories
    ANE7z
    => Adobe AIR iOS Native Extension to decompres 7z files.
    ANEZipFile
    => Adobe AIR iOS Native Extension to zip/unzip files.
    ANEFileSyncInterface
    => A micro http server with FileManagement capabilities Native Extension
    IOSSystemUtils
    => Adobe Air IOS Native Extension to control Brightness / Torch / Badge
    ANEUnRar
    => Adobe Air Native Extension to Obj-C UnRar Lib
    Please give me your comments

    First of all, thank you for creating this extension. However, it doesn't seem to work. Below is my code for decompressing ByteArray (error handling is stripped for simplicity):
                        public function decompress(aData:ByteArray):ByteArray {
                                  // Save data to file
                                  var fileInput:File = File.applicationStorageDirectory.resolvePath("input.7z");
                                  var stream:FileStream = new FileStream();
                                  stream.open(fileInput, FileMode.WRITE);
                                  stream.writeBytes(aData);
                                  stream.close();
                                  var folderOutput:File = File.applicationStorageDirectory.resolvePath("output");
                                  ANE7z.decompress(fileInput, folderOutput);
                                  var files:Array = folderOutput.getDirectoryListing();
                                  for each (var fileOutput:File in files) {
                                            trace("Extracted file: " + fileOutput.nativePath);
                                            if (!fileOutput.isDirectory) {
                                                      var bytes:ByteArray = new ByteArray();
                                                      stream = new FileStream();
                                                      stream.open(fileOutput, FileMode.READ);
                                                      stream.readBytes(bytes);
                                                      stream.close();
                                                      bytes.position = 0;
                                                      return bytes;
                                  return null;
    The problem is folderOutput.getDirectoryListing() always returns an empty array.

Maybe you are looking for

  • Problem with "win_api_dialog.Save_File"

    Hi friends, I have a problem with this simple code in forms 6i (WinXP): DECLARE      w_file varchar2(4000); BEGIN       w_file:= win_api_dialog.Save_File ('Hello); END; It compiles ok, but it doesn't work at runtime. I've read lot of posts in the for

  • Source Needed

    As we're using Erasure for Generics, then we'll need the source for whatever code we wish to use. Therefore, Generics is useless in API's that you do not have the source for correct ?

  • Can i transfer music i already have stored on my laptop to my ipad?

    can i transfer music i already have stored on my laptop to my ipad?

  • Maps Application on Ipod Touch 2g

    My partner recently bought an ipod touch 2g but cannot get the location to work on maps at home via our wireless router even though i can detect it on my iPhone. Safari works on it just not maps - any ideas how to rectify?? Thanks Ange

  • Regarding  Billing  workflow

    Hi all, When ever Billing is created i need to trigger a mail to user and also need to create a same entry in ztable for client requirement. Regards, Mohd.