Search Results

Search found 2 results on 1 pages for 'jlover2010'.

Page 1/1 | 1 

  • Malformed Farsi characters on AWT

    - by jlover2010
    Hi As i started programming by jdk6, i had no problem in text components neither in awt nor in swing. But for labels or titles of awt components, yes : I couldn't have Farsi characters displayable on AWTs just as simple as Swing by typing them into the source code. lets check this SSCCE : import javax.swing.*; import java.awt.*; import java.io.*; import java.util.Properties; public class EmptyFarsiCharsOnAWT extends JFrame{ public EmptyFarsiCharsOnAWT() { super("????"); setDefaultCloseOperation(3); setVisible(rootPaneCheckingEnabled); } public static void main(String[] args) throws AWTException, IOException { JFrame jFrame = new EmptyFarsiCharsOnAWT(); MenuItem show ; // approach 1 = HardCoding : /* show = new MenuItem("\u0646\u0645\u0627\u06cc\u0634"); * */ // approach 2 = using simple utf-8 saved text file : /* BufferedReader in = new BufferedReader(new FileReader("farsiLabels.txt")); String showLabel = in.readLine(); in.close(); show = new MenuItem(showLabel); * */ // approach 3 = using properties file : FileReader in = new FileReader("farsiLabels.properties"); Properties farsiLabels = new Properties(); farsiLabels.load(in); show = new MenuItem(farsiLabels.getProperty("tray.show")); PopupMenu popUp = new PopupMenu(); popUp.add(show); // creating Tray object Image iconIamge = Toolkit.getDefaultToolkit().getImage("greenIcon.png"); TrayIcon trayIcon = new TrayIcon(iconIamge, null, popUp); SystemTray tray = SystemTray.getSystemTray(); tray.add(trayIcon); jFrame.setIconImage(iconIamge); } } Yes, i know each of three approaches in source code does right when you may test it from IDE , but if you make a JAR contains just this class, by means of NetBeans project clean&build ,you won't see the expected characters and will just get EMPTY/BLANK SQUARES ! Unfortunately, opposed to other situations i encountered before, here there is no way to avoid using awt and make use of Swing in this case. And this was just an SSCCE i made to show the problem and my recent (also first) application suffers from this subject. Note: it seems i can not attach anything, so the contents od the text file would be this: ????? and the contents of properties file: #Sun May 02 09:45:10 IRDT 2010 tray.show=????? but i don't think by giving you the unicode-scape sequence, these would be necessary any way... And i think should have to let you know I posted this question a while ago in SDN and "the Java Ranch" forums and other native forums and still I'm watching... By the way i am using latest version of Netbeans IDE... I will be so grateful if anybody has a solution to this damn AWT components never rendered any Farsi character for me... Thanks in advance

    Read the article

  • mulformed Farsi characters on AWT

    - by jlover2010
    Hi As i started programming by jdk6, i had no problem in text components neither in awt nor in swing. But for labels or titles of awt components, yes : I couldn't have Farsi characters displayable on AWTs just as simple as Swing by typing them into the source code. lets check this SSCCE : import javax.swing.*; import java.awt.*; import java.io.*; import java.util.Properties; public class EmptyFarsiCharsOnAWT extends JFrame{ public EmptyFarsiCharsOnAWT() { super("????"); setDefaultCloseOperation(3); setVisible(rootPaneCheckingEnabled); } public static void main(String[] args) throws AWTException, IOException { JFrame jFrame = new EmptyFarsiCharsOnAWT(); MenuItem show ; // approach 1 = HardCoding : /* show = new MenuItem("\u0646\u0645\u0627\u06cc\u0634"); * */ // approach 2 = using simple utf-8 saved text file : /* BufferedReader in = new BufferedReader(new FileReader("farsiLabels.txt")); String showLabel = in.readLine(); in.close(); show = new MenuItem(showLabel); * */ // approach 3 = using properties file : FileReader in = new FileReader("farsiLabels.properties"); Properties farsiLabels = new Properties(); farsiLabels.load(in); show = new MenuItem(farsiLabels.getProperty("tray.show")); PopupMenu popUp = new PopupMenu(); popUp.add(show); // creating Tray object Image iconIamge = Toolkit.getDefaultToolkit().getImage("greenIcon.png"); TrayIcon trayIcon = new TrayIcon(iconIamge, null, popUp); SystemTray tray = SystemTray.getSystemTray(); tray.add(trayIcon); jFrame.setIconImage(iconIamge); } } Yes, i know each of three approaches in source code does right when you may test it from IDE , but if you make a JAR contains just this class (and its resources) by means of NetBeans project clean&build ,you won't see the expected characters and will just get EMPTY/BLANK SQUARES ! Unfortunately, opposed to other situations i encountered before, here there is no way to avoid using awt and make use of Swing in this case. And this was just an SSCCE i made to show the problem and my recent (also first) application suffers from this subject. And i think should have to let you know I posted this question a while ago in SDN and "the Java Ranch" forums and other native forums and still I'm watching... By the way i am using latest version of Netbeans IDE... I will be so grateful if anybody has a solution to this damn AWT components never rendered any Farsi character for me... Thanks in advance

    Read the article

1