Hindi characters' display in swing components on macintosh

I have created a swing application that handles devanagari script.(script for Hindi language).The application works perfectly in windows but in apple macintosh
there is a problem with the reordering of characters in text componets. Reordering means some characters needs to be displayed not in the exact order in which they are stored.I was wondering how this can happen as the application works fine on windows.Also other applications like text editor displays devanagari script correctly on macintosh.
I tried with several fonts like Arial Unicode MS,Devanagari MT etc/.java

Try the method setFont(java.awt.Font f) of the class java.awt.Container (which java.applet.Applet extends) with suitable fonts. This doesn't work for 1.1. Only logical fonts name are allowed here.
You need either to edit font.properties file for corresponding logical font or for MS JVM use com.ms.awt.FontX (get it using Java reflections if you don't have MS SDK) as described at http://www.onjava.com/pub/a/onjava/2001/04/12/internationalization.html?page=1
or http://www.jadcentral.com/newscentral/feature.jsp?feature_ID=18

Similar Messages

  • Hindi characters' display in swing components on mac

    I have created a swing application that handles devanagari script.(script for Hindi language).The application works perfectly in windows but in apple macintosh
    there is a problem with the reordering of characters in text componets. Reordering means some characters needs to be displayed not in the exact order in which they are stored.I was wondering how this can happen as the application works fine on windows.Also other applications like text editor displays devanagari script correctly on macintosh.
    I tried with several fonts like Arial Unicode MS,Devanagari MT etc/.java

    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

  • Devanagari characters' display  in swing components on macintosh.

    I have created a swing application that handles devanagari script.(script for Hindi language).The application works perfectly in windows but in apple macintosh
    there is a problem with the reordering of characters in text componets. Reordering means some characters needs to be displayed not in the exact order in which they are stored.I was wondering how this can happen as the application works fine on windows.Also other applications like text editor displays devanagari script correctly on macintosh.
    I tried with several fonts like Arial Unicode MS,Devanagari MT etc/.java

    Hi Ken,
    You'd be reading the HTML into your Java program using an InputStream of some description.
    You can set the encoding of this stream by using an InputStreamReader to pull everything in through the stream. e.g.
    InputStreamReader isr = new InputStreamReader(myInputStream, "UTF-8");
    The first parameter is your input stream, the second is the encoding that input stream uses.
    The HTML may be in an encoding called "ISO-8859-1", a Windows favourite, or it may be in a Chinese encoding like those I've mentioned (I can't recall the exact encoding strings you'd use in the call for the Chinese ones, but I believe GBK's is "GB-2312" or something similar).
    From there, it's easy to use your HTML encoding specific InputStreamReader to get a bunch of chars or bytes. These will be in the same encoding again. Then, it's just a matter of creating a new String with a better encoding (one that Java prefers, and one that Chinese can display in).
    The easiest way is to do the following:
    String myConvertedString = new String(myHTMLBytes, "UTF-8");
    ... where myHTMLBytes is an array of bytes (byte[]) that have been pulled in through the InputStreamReader. The String should be nice and easy to use from there. A good test would be to create a JLabel with the string as its text. Remember to set the JLabel's font to ArialUnicodeMS, and it should work OK. If it doesn't first up, try "UTF-16" in place of "UTF-8" in the new string declaration.
    In addition, Sun was actually shipping its own Java web browser classes with the JDK for a while. They were unofficial JDK code (i.e. they existed in a com.sun.* package), but they did get shipped. I haven't seen them in a JDK of late, but I know it was an early Unix version, so it might be worth looking for. AFAIK, the classes worked pretty well.
    Hope that helps!
    Martin Hughes

  • Character reordering problem in swing text components  on macintosh

    I have created a swing application that handles devanagari script.(script for Hindi language).The application works perfectly in windows but in apple macintosh
    there is a problem with the reordering of characters in text componets. Reordering means some characters needs to be displayed not in the exact order in which they are stored.I was wondering how this can happen as the application works fine on windows.Also other applications like text editor displays devanagari script correctly on macintosh.
    I tried with several fonts like Arial Unicode MS,Devanagari MT etc/.java

    Very odd. Post your Reordering code.

  • Hindi Numerals and Hejri calender in swing components

    Hi
    Are Hindi numerals and Hejri calender supported in JDK 1.4 swing components or not?
    Please I need this as soon as possible.
    Thanks in advance
    Marwa Aboulfadl

    hello!
    I am developing an arabic editor but i am unable to display the arbic numeric in swing text .Plz help me on this topic and send some code example on this topic.
    I have another problem about events i.e how can i handle the beckspace event, enter event, and spaceevent?
    plz send me mail .
    Thanx for advance.

  • Swing Components not displaying in a JFrame

    Hi,
    I have a JFrame with a couple of JLabels, JButtons etc. and a Choice Combo Box
    my problem is that when i run the program the only component that gets displayed at first is Choice and in order for me to see the swing components i have to roll over them with my mouse and the JLabels dont even display when i do that..
    Does anyone know how i can fix this please?
    here is my code
    import java.awt.*;
    import java.awt.event.*;
    import java.lang.*;
    import java.awt.Image.*;
    import java.io.*;
    import java.net.*;
    public class ImageViewerAnim extends JFrame {
         private JLabel perc, scale;
         private JTextField inPercent;
         private JButton draw, muteOn;
         private JPanel sPanel;
         private String[] pics = {"Earth", "Moon", "Jupiter", "Pluton", "Neptun"};
         private String[] picsFile = {"images/earth.gif", "images/moon.gif", "images/jupiter.jpg", "images/pluton.jpg", "images/neptun.jpg"};
         private String[] soundsFile = {"sounds/tada.wav", "sounds/notify.wav", "sounds/ding.wav", "sounds/chimes.wav", "sounds/chimes.wav"};
         private Choice ch;
         private Image pic;
         private AudioClip sound = null;
         private int scaleAm = 0;
         private int origScale = 500;
         private int finalScale = 0;
         private boolean proceed = true;
         public ImageViewerAnim() {
              Container c = getContentPane();
              c.setLayout(new BorderLayout());
              sPanel = new JPanel();
              ch = new Choice();
              for(int i = 0; i < pics.length; ++i) {
                   ch.add(pics);
              scale = new JLabel("Scale");
              perc = new JLabel("%");
              inPercent = new JTextField(5); // scale value input field
              draw = new JButton("Draw");
              draw.setBorder(BorderFactory.createEtchedBorder());
              draw.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        int index = 0;
                        index = ch.getSelectedIndex();
                        pic = null;
                        repaint();
                        pic = (Toolkit.getDefaultToolkit().getImage(picsFile[index]));
                        try{
                        File f = new File(soundsFile[index]);
                        sound = Applet.newAudioClip(f.toURL());
                        }catch(MalformedURLException mfe) {
                             mfe.printStackTrace();
                        if(!inPercent.getText().equals("")) {
                             scaleAm = Integer.parseInt(inPercent.getText()); // get the scale amount from the user
                             finalScale = ((origScale * scaleAm)/100); // calculate the final scale amount based on what the user entered
                        }else {
                             finalScale = origScale; // default to original size of the image if no value for scale was entered
                        // creates a scaled instance of an image and takes the amount of scale as an argument
                        repaint();
                        sound.loop();
              muteOn = new JButton("Mute On");
              muteOn.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        sound.stop();
                        muteOn.setText("MuteOff");
              sPanel.add(ch);
              sPanel.add(scale);
              sPanel.add(inPercent);
              sPanel.add(perc);
              sPanel.add(draw);
              sPanel.add(muteOn);
              c.add(sPanel, BorderLayout.SOUTH);
              repaint();
    public void paint(Graphics g) {
         if(pic!=null) {
              g.drawImage(pic,0,0,this);
    public static void main(String args[]) {
         ImageViewerAnim app = new ImageViewerAnim();
         app.setSize(500,500);
         app.setVisible(true);
         app.setDefaultCloseOperation(EXIT_ON_CLOSE);
         app.show();
    thank you in advance
    Ivo

    for future reference
    i was able to fix this by adding
    super.paint(g);in the first line of my paint method
    Ivo

  • Capturing the raster of Swing components without actually displaying them?

    My goal is to be able to create an Image/BufferedImage that represents the image of Swing components. Now one solution would be to display the component, take a printscrn of it, and cut the resulting image down so that it only contains the area that the component takes up. However, this requires the component to be displayed to the screen.
    Looking for a solution, I found createImage() in java.awt.Component. I tried that, and got a null image. Going back to the javadocs, I found that the component had to be displayable, which was defined as being visible or packed. I tried inserting the component into a JFrame, packed the frame, and then called createImage, only to get a blank Image. I've also tried displaying the JFrame, calling createImage, and displaying the image, but I've had no luck.
    To display the Images, I've been encapsulating them in ImageIcons and displaying those.
    Any ideas pertaining to a good solution?

    How would I go about doing that? I'm looking through
    the API, but I can't find anything relevant.If you direcytly want to create Image object .. then check.. this... and see my last posting of Brio.java
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=711032
    Note: use setVisible(true);
    before creating buffer = createImage(...) else U will get null Image..
    U can also make a BufferedImage like..
    BufferedImage buffer = new BufferedImage(200, 200, BufferedImage.TYPE_3BYTE_BGR);
    Graphics g = buffer.getGraphics();
    g.setColor(new Color(255, 0, 255));
    g.drawImage(img, x, y, null);
    g.fillRect(200,200);
    g.dispose();

  • Cs3: Display Hindi Characters On Panel

    Hi all,
    I want to show Hindi characters on Panel
    How do i?
    I tried with statictextWidget and unicode characters.
    but it is not working.
    Please help.
    Thanks,
    Vikram

    Hi
    If you change a font for displaying on windows, message boxes etc, to for example Minion Pro, then you should be able to see Hindi characters. Think as a standard windows using Tahoma for displaying text in windows - I'm not sure about other than English version. You can check if yours Tahoma contains hindi glyphs.
    Regards
    Bartek

  • Swing components not displaying correctly in JApplet

    Hello everyone,
    I have experienced some strange problems using Swing components on JApplets. Maybe I missed some documentation somewhere and someone can help me out.
    The problem is that when I add components like JButtons,
    JCheckboxes, JRadioButtons, JTextFields, JPasswordFields,
    and JComboBoxes to JApplets, when I view the applet, the
    component does not become visible until I move the mouse
    pointer over it in the case of buttons. For the JComboBox I have
    to hit the mouse key many times on the component to see the list. Has anyone experienced problems like these? Thanks.
    Keith

    check what is in ur paint(Graphic g) method. if it does nothing, remove the paint(Graphic g) method. if it has some codes, double check ur codes.

  • Multifont output in Swing components

    Hi there,
    though I'm not new to Java but I'm new to displaying different fonts in Swing components.
    I have an Swing-based application which is running on a Terminal Server. It works fine for Central, Western und Northern Europe. The next
    country to roll out is Greece. So what does a greek user see on his monitor when he uses his greek keyboard?
    I am writing a test app where I type german text into a JTextField and want to get e.g. the greek representation in another JTextField. How can I achieve this? Converting the bytearray with Cp1253 did not work
    Can anybody give me a hint?
    Thanks
    Dierk.

    as I wrote, it is a test app to learn how I get greek
    fonts on the screen. Of course the real app is used by
    greek users who put greek text into the system. In the
    system we do not use resource bundles as the GUI texts
    are stored in the database. It is a CMS for product
    information in different languages.Ah, I see... mind you, I don't think your German text would have a great deal of Cyrillic characters in them, right? Still, it's only a test! ;-)
    Now what I'm doing to get my german text in greek
    letters is this:
    utf8Bytes =
    = getorigTextField().getText().getBytes("UTF16");
    isr = new InputStreamReader(new
    w ByteArrayInputStream
    (utf8Bytes), "Cp1253");
    As far as I understand, the InputStreamReader gives
    the translation
    of my german letters in the encoding of CP1253
    (Windows Greek). That
    means the unicode characters change into the ones of
    the greek language
    so I should be able to show them in a Swing component.This is where your problem is. Java's Strings will always be in UTF-16 when they are held internally. So anything within a textfield is going to be UTF-16 no matter what you do with it.
    The line you think is converting to Cp1253 is actually trying to convert from Cp1253 to UTF-16.
    Hopefully this is the reason your characters aren't appearing - the unneeded conversion above could be mashing them. Instead, you need expect everything to always be in UTF-16, and to expect to display in it (don't worry, it handles any character you can throw at it, let alone Greek). So then it all comes down to the font you're using.
    I'm not too sure of the name of the Windows default Cyrillic font, but that would be a logical starting point.
    Hope that helps!
    Martin Hughes

  • Unicode font for swing components

    Hi all,
    I'd like to set a Swing component (a JLabel) to a particular font so it will properly display Unicode Greek text. I've been reading all about physical vs. logical fonts, and I've read through the various Sun docs/faqs on Internationalization, Fonts, and Unicode, but I just can't get this to work. I think I'm missing something more basic here about selecting my font. My test word is the Greek "khairete," with an accent over the iota. Here is the Unicode:
    \u03c7\u03b1\u1f77\u03c1\u03b5\u03c4\u03b5
    The trick is that accented iota.
    I can launch an xterm that shows the characters I want like this:
    $ xterm -fn -misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1 &
    That tells me that if I can get Java to use that font, then I'm all set. I'm trying the following test program:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.io.*;
    public class GUI extends JFrame {
    public static final String MESSAGE = "\u03c7\u03b1\u1f77\u03c1\u03b5\u03c4\u03b5";
    public GUI() throws Exception {
    super();
    Font[] fonts;
    Container container;
    JLabel label;
    fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
    for (int j=0;j<fonts.length;j++) {
    System.out.println(fonts[j]);
    container = getContentPane();
    container.setLayout(new GridLayout(0, 1));
    // try with the default font
    label = new JLabel(MESSAGE);
    container.add(label);
    printFont(label.getFont());
    // see what the default font looks like when PLAIN (to compare with fonts below)
    label = new JLabel(MESSAGE);
    label.setFont(label.getFont().deriveFont(Font.PLAIN, 12));
    container.add(label);
    printFont(label.getFont());
    // this looks the same as the default font, meaning we didn't find what we asked for.
    label = new JLabel(MESSAGE);
    label.setFont(new Font("-misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1", Font.PLAIN, 12));
    container.add(label);
    printFont(label.getFont());
    // this also falls back to the default.
    label = new JLabel(MESSAGE);
    label.setFont(Font.getFont("-misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1"));
    container.add(label);
    printFont(label.getFont());
    // this (of course) falls back to the default.
    label = new JLabel(MESSAGE);
    label.setFont(Font.getFont("not a font name"));
    container.add(label);
    printFont(label.getFont());
    // try every font we've got!
    for (int j = 0; j < fonts.length; j++) {
    label = new JLabel(fonts[j] + ": " + MESSAGE);
    label.setFont(fonts[j].deriveFont(Font.PLAIN, 12));
    container.add(label);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    pack();
    show();
    public static void printFont(Font f) {
    System.out.println(f);
    if (f != null) {
    public static void main(String[] args) throws Exception {
    GUI me = new GUI();
    But nothing in this code succeedings in printing \u1f77. As I've said, the plain old xterm can do it. I think my problem is that I haven't successfully referenced the desired font in the Java code. But how do I do this? These are the fonts available to me, according to the code above:
    java.awt.Font[family=Bitstream Charter,name=Bitstream Charter,style=plain,size=1]
    java.awt.Font[family=Bitstream Charter,name=Bitstream Charter Bold,style=plain,size=1]
    java.awt.Font[family=Bitstream Charter,name=Bitstream Charter Bold Italic,style=plain,size=1]
    java.awt.Font[family=Bitstream Charter,name=Bitstream Charter Italic,style=plain,size=1]
    java.awt.Font[family=Courier,name=Courier,style=plain,size=1]
    java.awt.Font[family=Courier 10 Pitch,name=Courier 10 Pitch,style=plain,size=1]
    java.awt.Font[family=Courier 10 Pitch,name=Courier 10 Pitch Bold,style=plain,size=1]
    java.awt.Font[family=Courier 10 Pitch,name=Courier 10 Pitch Bold Italic,style=plain,size=1]
    java.awt.Font[family=Courier 10 Pitch,name=Courier 10 Pitch Italic,style=plain,size=1]
    java.awt.Font[family=Courier,name=Courier Bold,style=plain,size=1]
    java.awt.Font[family=Courier,name=Courier Bold Italic,style=plain,size=1]
    java.awt.Font[family=Courier,name=Courier Italic,style=plain,size=1]
    java.awt.Font[family=Cursor,name=Cursor,style=plain,size=1]
    java.awt.Font[family=Lucida Bright,name=Lucida Bright Demibold,style=plain,size=1]
    java.awt.Font[family=Lucida Bright,name=Lucida Bright Demibold Italic,style=plain,size=1]
    java.awt.Font[family=Lucida Bright,name=Lucida Bright Italic,style=plain,size=1]
    java.awt.Font[family=Lucida Bright,name=Lucida Bright Regular,style=plain,size=1]
    java.awt.Font[family=Lucida Sans,name=Lucida Sans Demibold,style=plain,size=1]
    java.awt.Font[family=Lucida Sans,name=Lucida Sans Demibold Oblique,style=plain,size=1]
    java.awt.Font[family=Lucida Sans,name=Lucida Sans Oblique,style=plain,size=1]
    java.awt.Font[family=Lucida Sans,name=Lucida Sans Regular,style=plain,size=1]
    java.awt.Font[family=Lucida Sans Typewriter,name=Lucida Sans Typewriter Bold,style=plain,size=1]
    java.awt.Font[family=Lucida Sans Typewriter,name=Lucida Sans Typewriter Bold Oblique,style=plain,size=1]
    java.awt.Font[family=Lucida Sans Typewriter,name=Lucida Sans Typewriter Oblique,style=plain,size=1]
    java.awt.Font[family=Lucida Sans Typewriter,name=Lucida Sans Typewriter Regular,style=plain,size=1]
    java.awt.Font[family=Luxi Mono,name=Luxi Mono Bold,style=plain,size=1]
    java.awt.Font[family=Luxi Mono,name=Luxi Mono Bold Oblique,style=plain,size=1]
    java.awt.Font[family=Luxi Mono,name=Luxi Mono Oblique,style=plain,size=1]
    java.awt.Font[family=Luxi Mono,name=Luxi Mono Regular,style=plain,size=1]
    java.awt.Font[family=Luxi Sans,name=Luxi Sans Bold,style=plain,size=1]
    java.awt.Font[family=Luxi Sans,name=Luxi Sans Bold Oblique,style=plain,size=1]
    java.awt.Font[family=Luxi Sans,name=Luxi Sans Oblique,style=plain,size=1]
    java.awt.Font[family=Luxi Sans,name=Luxi Sans Regular,style=plain,size=1]
    java.awt.Font[family=Luxi Serif,name=Luxi Serif Bold,style=plain,size=1]
    java.awt.Font[family=Luxi Serif,name=Luxi Serif Bold Oblique,style=plain,size=1]
    java.awt.Font[family=Luxi Serif,name=Luxi Serif Oblique,style=plain,size=1]
    java.awt.Font[family=Luxi Serif,name=Luxi Serif Regular,style=plain,size=1]
    java.awt.Font[family=Utopia,name=Utopia Bold,style=plain,size=1]
    java.awt.Font[family=Utopia,name=Utopia Bold Italic,style=plain,size=1]
    java.awt.Font[family=Utopia,name=Utopia Italic,style=plain,size=1]
    java.awt.Font[family=Utopia,name=Utopia Regular,style=plain,size=1]
    java.awt.Font[family=dialog,name=dialog,style=plain,size=1]
    java.awt.Font[family=dialog,name=dialog.bold,style=plain,size=1]
    java.awt.Font[family=dialog,name=dialog.bolditalic,style=plain,size=1]
    java.awt.Font[family=dialog,name=dialog.italic,style=plain,size=1]
    java.awt.Font[family=dialoginput,name=dialoginput,style=plain,size=1]
    java.awt.Font[family=dialoginput,name=dialoginput.bold,style=plain,size=1]
    java.awt.Font[family=dialoginput,name=dialoginput.bolditalic,style=plain,size=1]
    java.awt.Font[family=dialoginput,name=dialoginput.italic,style=plain,size=1]
    java.awt.Font[family=monospaced,name=monospaced,style=plain,size=1]
    java.awt.Font[family=monospaced,name=monospaced.bold,style=plain,size=1]
    java.awt.Font[family=monospaced,name=monospaced.bolditalic,style=plain,size=1]
    java.awt.Font[family=monospaced,name=monospaced.italic,style=plain,size=1]
    java.awt.Font[family=sansserif,name=sansserif,style=plain,size=1]
    java.awt.Font[family=sansserif,name=sansserif.bold,style=plain,size=1]
    java.awt.Font[family=sansserif,name=sansserif.bolditalic,style=plain,size=1]
    java.awt.Font[family=sansserif,name=sansserif.italic,style=plain,size=1]
    java.awt.Font[family=serif,name=serif,style=plain,size=1]
    java.awt.Font[family=serif,name=serif.bold,style=plain,size=1]
    java.awt.Font[family=serif,name=serif.bolditalic,style=plain,size=1]
    java.awt.Font[family=serif,name=serif.italic,style=plain,size=1]
    javax.swing.plaf.FontUIResource[family=Dialog,name=Dialog,style=bold,size=12]
    java.awt.Font[family=Dialog,name=Dialog,style=plain,size=12]
    java.awt.Font[family=dialog,name=-misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1,style=plain,size=12]
    javax.swing.plaf.FontUIResource[family=Dialog,name=Dialog,style=plain,size=12]
    javax.swing.plaf.FontUIResource[family=Dialog,name=Dialog,style=plain,size=12]
    Apparently, I need to use the correct "name" to specify the font. So my next try was this:
    $ xlsfonts -ll -fn -misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1
    name: -misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1
    direction: left to right
    indexing: matrix
    rows: 0x00 thru 0x30 (0 thru 48)
    columns: 0x00 thru 0xff (0 thru 255)
    all chars exist: no
    default char: 0x0000 (0)
    ascent: 14
    descent: 4
    font type: Character Cell
    bounds: width left right asc desc attr keysym
    min 9 0 0 -3 -13 0x0000
    max 9 8 9 14 4 0x0000
    properties: 23
    FONTNAME_REGISTRY
    FOUNDRY Misc
    FAMILY_NAME Fixed
    WEIGHT_NAME Medium
    SLANT R
    SETWIDTH_NAME Normal
    ADD_STYLE_NAME
    PIXEL_SIZE 18
    POINT_SIZE 120
    RESOLUTION_X 100
    RESOLUTION_Y 100
    SPACING C
    AVERAGE_WIDTH 90
    CHARSET_REGISTRY ISO10646
    CHARSET_ENCODING 1
    COPYRIGHT Public domain font. Share and enjoy.
    XMBDFEDINFO 654
    CAP_HEIGHT 10
    X_HEIGHT 7
    FONT -Misc-Fixed-Medium-R-Normal--18-120-100-100-C-90-ISO10646-1
    WEIGHT 10
    RESOLUTION 138
    QUAD_WIDTH 9
    name: -misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1
    direction: left to right
    indexing: matrix
    rows: 0x00 thru 0x30 (0 thru 48)
    columns: 0x00 thru 0xff (0 thru 255)
    all chars exist: no
    default char: 0x0000 (0)
    ascent: 14
    descent: 4
    font type: Character Cell
    bounds: width left right asc desc attr keysym
    min 9 0 0 -3 -13 0x0000
    max 9 8 9 14 4 0x0000
    properties: 23
    FONTNAME_REGISTRY
    FOUNDRY Misc
    FAMILY_NAME Fixed
    WEIGHT_NAME Medium
    SLANT R
    SETWIDTH_NAME Normal
    ADD_STYLE_NAME
    PIXEL_SIZE 18
    POINT_SIZE 120
    RESOLUTION_X 100
    RESOLUTION_Y 100
    SPACING C
    AVERAGE_WIDTH 90
    CHARSET_REGISTRY ISO10646
    CHARSET_ENCODING 1
    COPYRIGHT Public domain font. Share and enjoy.
    XMBDFEDINFO 654
    CAP_HEIGHT 10
    X_HEIGHT 7
    FONT -Misc-Fixed-Medium-R-Normal--18-120-100-100-C-90-ISO10646-1
    WEIGHT 10
    RESOLUTION 138
    QUAD_WIDTH 9
    (Yes, xlsfonts prints two entries.)
    Here is a bit more data:
    [pjungwir@mccurdy unicode_gui]$ uname -a
    Linux mccurdy.nfic.com 2.4.18-14 #1 Wed Sep 4 13:35:50 EDT 2002 i686 i686 i386 GNU/Linux
    [pjungwir@mccurdy unicode_gui]$ cat /etc/redhat-release
    Red Hat Linux release 8.0 (Psyche)
    [pjungwir@mccurdy unicode_gui]$ java -version
    java version "1.4.2_01"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_01-b06)
    Java HotSpot(TM) Client VM (build 1.4.2_01-b06, mixed mode)
    If anyone has any suggestions, I would really appreciate it. I'd like to find an answer that doesn't involve editing the font.properties file.
    Thanks,
    --Paul

    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

  • Swing components in applet not working in web browser

    Hi Guys,
    I've created an applet which makes use of some swing components, but unfortunately, not all of them function properly in my web browser (internet explorer or Mozilla Firefox). Its mainly the buttons; the last buttons works and displays the correct file within the broswer, but the first 5 buttons do not work...
    any help please on how I can sort this problem out?
    Heres the code for my applet:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.applet.*;
    public class MainAppWindow extends JApplet
    int gapBetweenButtons = 5;
    final JPanel displayPanel = new JPanel(new BorderLayout());
    public void init()
       //Panel for overall display in applet window.
       JPanel mainPanel = new JPanel(new BorderLayout());
       mainPanel.add(new JLabel(new ImageIcon(getClass().getResource("images/smalllogo2.gif"))),BorderLayout.NORTH);
       //sub mainPanel which holds all mainPanels together.
       JPanel holdingPanel = new JPanel(new BorderLayout());
       //Panel for displaying all slide show and applications in.
       displayPanel.setBackground(Color.white);
       displayPanel.add(new JLabel(new ImageIcon(getClass().getResource("images/IntroPage.jpg"))),BorderLayout.CENTER);
       displayPanel.setPreferredSize(new Dimension(590,400));
       JPanel buttonPanel = new JPanel(new GridLayout(6,1,0,gapBetweenButtons));
       buttonPanel.setBackground(Color.white);
       JButton button1 = new JButton("User guide");
       button1.addActionListener(
         new ActionListener() {
              public void actionPerformed(ActionEvent e)
                   if(displayPanel.getComponents().length > 0)displayPanel.removeAll(); // If there are any components in the mainPanel, remove them and then add label
                   displayPanel.setBackground(Color.white);
                   displayPanel.add(new JLabel(new ImageIcon("images/UserGuide.jpg")));
                   displayPanel.revalidate(); // Validates displayPanel to allow changes to occur onto it, allowing to add different number images/applicaions to it.
       JButton button2 = new JButton("What is a Stack?");
       button2.addActionListener(
       new ActionListener() {
               public void actionPerformed(ActionEvent e)
                   if(displayPanel.getComponents().length > 0)displayPanel.removeAll();
                   displayPanel.setBackground(Color.white);
                   displayPanel.add(new JLabel(new ImageIcon("images/WhatIsAStack.jpg")));
                   displayPanel.revalidate();
       JButton button3 = new JButton("STACK(ADT)");
       button3.addActionListener(
       new ActionListener() {
             public void actionPerformed(ActionEvent e)
                   if(displayPanel.getComponents().length > 0)displayPanel.removeAll();
                   displayPanel.setBackground(Color.white);
                   displayPanel.add(new JLabel(new ImageIcon("images/StackADT.jpg")));
                   displayPanel.revalidate();
       JButton button4 = new JButton("Stacks in the Real World");
       button4.addActionListener(
       new ActionListener() {
             public void actionPerformed(ActionEvent e)
                   if(displayPanel.getComponents().length > 0)displayPanel.removeAll();
                   displayPanel.setBackground(Color.white);
                   displayPanel.add(new JLabel(new ImageIcon("images/StacksInTheRealWorld.jpg")));
                   displayPanel.revalidate();
       JButton button5 = new JButton("DEMONSTRATION");
       button5.addActionListener(
       new ActionListener() {
             public void actionPerformed(ActionEvent e)
                 if(displayPanel.getComponents().length > 0)displayPanel.removeAll();
                 Demonstration app = new Demonstration();
                 JPanel appPanel = app.createComponents();//gets the created components from Demonstration application.
                 appPanel.setBackground(Color.pink);
               displayPanel.add(appPanel);
               displayPanel.revalidate();
       JButton button6 = new JButton("Towers Of Hanoi");
       button6.addActionListener(
       new ActionListener() {
             public void actionPerformed(ActionEvent e)
                     if(displayPanel.getComponents().length > 0)displayPanel.removeAll();
                     TowerOfHanoi app = new TowerOfHanoi();
                     JPanel appPanel = app.createComponents();//gets the created components from Towers of Hanoi
                     JPanel mainPanel = new JPanel();//panel used to centralise the application in center
                     mainPanel.add(appPanel);
                     mainPanel.setBackground(Color.pink); //sets mainPanel's background color for 'Towers Of Hanoi'
                     displayPanel.add(mainPanel);
                     displayPanel.revalidate();
       //adding buttons to the buttonPanel.
       buttonPanel.add(button1);
       buttonPanel.add(button2);
       buttonPanel.add(button3);
       buttonPanel.add(button4);
       buttonPanel.add(button5);
       buttonPanel.add(button6);
       JPanel p = new JPanel(); // Used so that the buttons maintain their default shape
       p.setBackground(Color.white);
       p.add(buttonPanel);
       holdingPanel.add(p,BorderLayout.WEST);
       holdingPanel.add(displayPanel,BorderLayout.CENTER);
       //Positioning of holdingPanel in mainPanel.
       mainPanel.add(holdingPanel,BorderLayout.CENTER);
       //indent mainPanel so that its not touching the applet window frame.
       mainPanel.setBorder(BorderFactory.createEmptyBorder(10,20,10,20));
       mainPanel.setBackground(Color.white);
       mainPanel.setPreferredSize(new Dimension(850,600)); //size of applet window
       mainPanel.setOpaque(false); // Needed for Applet
       this.setContentPane(mainPanel);
    }

    Thanks for the response. I don't quite understand what you're talking about though. I have, in my humble knowledge, done nothing with packages. I have put the applet class (WiaRekenToolActiz.class is the applet class) in the jar file wia_actiz_archive.jar. From what I read on the tutorial, java looks for the applet class in all the jar files specified. Since I put my CODEBASE as the main url, I thought it baiscally didn't matter where you out the html file.
    I shall include the complete html page complete with applet tag to perhaps illuminate a bit more what I mean...
    <html>
    <head>
    <title>Wia Rekenmodule hello!</title>
    </head>
    <body bgcolor="#C0C0C0">
    <applet
    CODEBASE= "http://www.creativemathsolutions.nl/test"
    ARCHIVE= "Actiz/wia_actiz_archive.jar, Generic/wia_archive.jar"
    CODE="WiaRekenToolActiz.class" 
    WIDTH=915 HEIGHT=555
    >
    <PARAM NAME = naam VALUE = "Piet Janssen">
    <PARAM NAME = gebdag VALUE = "01">
    <PARAM NAME = gebmaand VALUE = "06">
    <PARAM NAME = gebjaar VALUE = "1970">
    <PARAM NAME = geslacht VALUE = "man">
    <PARAM NAME = dienstjaren VALUE = "10">
    <PARAM NAME = salaris VALUE = "56500">
    <PARAM NAME = deeltijdpercentage VALUE = "100">
    <PARAM NAME = accountnaam VALUE = "Zorginstelling 'De Zonnebloem'">
    </applet>
    </body>
    </html>

  • Need help with using graphics in swing components

    Hi. I'm new to Java and trying to learn it while also developing an application for class this semester. I've been following online tutorials for about 2 months now, though, and so I'm not sure my question counts as a "new to Java" question any more as the code is quite long.
    Here is the basic problem. I started coding the application as a basic awt Applet (starting at "Hello World") and about a month in realized that Swing components offer better buttons, panels, layouts, etc. So I converted the application, called BsfAp, to a new JApplet and started adding JPanels and JComponents with layout managers. My problem is, none of the buffered graphics run in any kind of JPanel, only the buttons do. I assume the buffered graphics are written straight to the JApplet top level container instead but I'm not entirely sure.
    So as to not inundate the forum with code, the JApplet runs online at:
    http://mason.gmu.edu/~dho2/files/sensor.html
    The source code is also online at:
    http://mason.gmu.edu/~dho2/files/BsfAp.java
    What I would like to do is this - take everything in the GUI left of the tabbed button pane and put it into a JScrollPane so that I can use a larger grid size with map display I can scroll around. The grid size I would like to use is more like 700x1000 pixels, but I only want to display about 400x400 pixels of it at a time in the JScrollPane. Then I could also move this JScrollPane around with layout manager. I think this is possible, but I don't know how to do it.
    I'm sure the code is not organized or optimized appropriately to those of you who use Java every day, but again I'm trying to learn it. ;-)
    Thanks for any help or insight you could provide in this.
    Matt

    Couple of recs:
    * Don't override paint and paint directly on the JApplet. Paint on a JPanel and override paintComponent.
    * The simplest way to display a graphic is to put an image into an ImageIcon and show this in a JLabel. This can then easily go inside of the JScrollPane.
    * You can also create a graphics JPanel that overrides the paintComponent, draw the image in that and show that inside of the JScrollPane.
    * don't call paint() directly. Call repaint if you want the graphic to repaint.
    Here's a trivial example quickly put together:
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import java.awt.GradientPaint;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Paint;
    import java.awt.RenderingHints;
    import java.awt.geom.Ellipse2D;
    import java.lang.reflect.InvocationTargetException;
    import javax.swing.JApplet;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.SwingUtilities;
    public class BsfCrap extends JApplet
        private JPanel mainPanel = new JPanel();
        private JScrollPane scrollPane;
        private JPanel graphicsPanel = new JPanel()
            @Override
            protected void paintComponent(Graphics g)
                super.paintComponent(g);
                Graphics2D g2d = (Graphics2D)g;
                RenderingHints rh = new RenderingHints(
                    RenderingHints.KEY_ANTIALIASING,
                    RenderingHints.VALUE_ANTIALIAS_ON);
                g2d.setRenderingHints(rh);
                Paint gPaint = new GradientPaint(0, 0, Color.blue,
                    40, 40, Color.magenta, true);
                g2d.setPaint(gPaint);
                g2d.fill(new Ellipse2D.Double(0, 0, 800, 800));
        public BsfCrap()
            mainPanel.setPreferredSize(new Dimension(400, 400));
            mainPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
            graphicsPanel.setPreferredSize(new Dimension(800, 800));
            graphicsPanel.setBackground(Color.white);
            scrollPane = new JScrollPane(graphicsPanel);
            scrollPane.setPreferredSize(new Dimension(300, 300));
            mainPanel.add(scrollPane);
        public JPanel getMainPanel()
            return mainPanel;
        @Override
        public void init()
            try
                SwingUtilities.invokeAndWait(new Runnable()
                    public void run()
                        setSize(new Dimension(400, 400));
                        getContentPane().add(new BsfCrap().getMainPanel());
            catch (InterruptedException e)
                e.printStackTrace();
            catch (InvocationTargetException e)
                e.printStackTrace();
    }

  • I'd like to make a list of interactive Swing components....

    EDIT: I've been doing more research about Layout Managers and it appears that BoxLayout may provide me with the solution I need. I'll mess around with it for awhile and report back if I still need help. Thanks pals!+
    I would like to make a list of JPanels laid out in basically a column. One on top of the other. That's not so difficult, but I need to make it able able to add and remove panels in response to user-driven events (in other words, I can't just hard-code them all, and the panels are generated on the fly, so I don't even know how many I'll need to be displaying until I need to display them.
    Here's a simple mockup of the window I'm talking about.
    |      - o x |
    |____________|
    |            |
    |            |
    |   Panel1   |
    |   Panel2   |
    |   Panel3   |
    |   Panel4   |
    |____________|At first, I thought a JList would serve my purpose, but you can't add interactive Swing components to JLists (or JTables)... they'll render, but that's all. My panels will contain a button and a checkbox, so this is a no-go.
    I was also thinking I could just manage the placement with GridBagLayout and just keep indexes for the current y position, but if there's an easier way, I'd rather not go this route. It has me writing a lot of extra code and manipulating a lot of fields of GridBagConstraints, which opens me to less-understandable code and more error-prone code, on account of I'm great at making little mistakes when I'm setting craploads of constraints.
    Does anyone have any ideas? It'd be ideal if there was just some sort of container I could plop them in with add and remove methods (a la JTabbedPane or something).
    I'm pretty new to Swing, so maybe I'm missing something obvious.
    Edited by: Caryy on Sep 30, 2010 4:15 PM

    I would recommend using BoxLayout or Box.createVerticalBox(). As mKorbel already mentioned, you need to call revalidate() after adding any component to an already realized/visible container, and additionally call repaint() after removing a component. To resize the top level window to accommodate its new content, you would call pack(). Or, again as suggested by mKorbel, wrap your panel/Box in a JScrollPane.
    db

  • Using Swing Components in JSP

    Hi,
    I regret that I do not have a very specific problem here. However, I am wondering if there is a way to display Swing components, such as a panel, on a web page using JSP. If so, are there any tutorials on such a practice? Or would something like this be included in a general tutorial?
    Thanks,
    Dan

    You'll have to use a JApplet.

Maybe you are looking for

  • Enabled FileVault, OS X won't boot anymore. Automatically goes to Safe-Mode.

    So, I decided to Enable FireVault on my Late-2013 MBPr yesterday. Everything worked, it restarted and went through the whole process. During the encryption, I choose to use iCloud to decrypt by drive over creating a new key. This morning, when I trie

  • In an IPad 2, can the two different mail accounts be made private

    In an IPad 2, can the two different mail accounts be made private?

  • Netwrok link

    Hai i have a doubt regarding the import behaviour.please clear it.i have pasted it below. =========See behaviour of IMPDP while using NETWORK_LINK parameter. Say you have DB1 on Host1 and DB2 on Host2. Now, you want to import Table1 from DB1 to DB2.

  • Bw within testing tool

    Hi, Can some one tell me or send me documents on how can quality center testing tool will be helpfull in testing in BW ? thanks, KS

  • BW Data Load error due to special char's

    Hi Experts, Our BW System is a Uni Code, Master data load din BW failed due to special chars, I corrected the field manually in PSA and loaded the data. But I would like to know the reason for failure. Issue for failure is term SOCIÉTÉGÉN-..My unders