Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

JOptionpane GUI button display wrong language or characters

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a couple GUI applications that display the button fonts with incorrect language or characters at runtime.
this happens whether I launch the program from command line or eclipse.
I checked java path and reinstalled to be sure I had latest version.
Has anyone run into this problem and found a solution?

import javax.swing.JOptionPane; // the import statement i used

code for a simple version of this application also generates the erroneous font on the buttons.

Tried to attach a screen shot for a visual reference.

Regards - Lee
message-box-screen-shot.jpg
[Thumbnail for message-box-screen-shot.jpg]
 
Marshal
Posts: 26912
82
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It would be useful (i.e. mandatory) to know exactly what string was used to produce that dialog.
 
Paul Clapham
Marshal
Posts: 26912
82
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh, by the way, welcome to the Ranch!
 
Lee Middler
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
this was a simple version of the problem:

import javax.swing.JOptionPane;

public class WelcomeInMessageDialogBox {
public static void main(String[] args) {
// Display Welcome to Java! in a message dialog box
JOptionPane.showMessageDialog(null,"Welcome to Java!");

System.exit(0);

}
}
This happens anytime the JOptionPane is executed....

Thanks Paul!
 
Paul Clapham
Marshal
Posts: 26912
82
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay... and that piece of code was typed into what, and by what? An ordinary text file entered via some text editor? Eclipse? Netbeans? Some other IDE?

I'm asking those questions because it looks like there's an unusual encoding being applied to your text file, so we need to find out who told what to use that encoding.
 
Lee Middler
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did mention that I ran the code both in command line and eclipse.
the source code file was entered directly into eclipse, then copied to note pad where it was compiled separately.
So the the code compiles in both Eclipse and at the command prompt, which seems to indicate its not just an eclipse problem.
I also uninstalled and reinstalled java on my machine, to see if that might be the problem.
I have multiple code files that juse JOptionpane and all have the font issues.
Has anyone seen this happen before?

 
Paul Clapham
Marshal
Posts: 26912
82
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It might be a font issue, too, that's true. What you say about Eclipse versus Notepad does suggest that it probably isn't an encoding issue, especially since the button text which is supposed to say "OK" doesn't say "OK". So you might have to look into what font your dialog is using -- it doesn't look like you're using an unusual L&F either, so that's probably not the source of the problem.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What output do you get for this code?
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic