Source Code : Localized JOptionPane

Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com. Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com. Click Here or search from google with Libraries Name you get jar file related it

Localized JOptionPane

        
import java.awt.Font;
import java.util.Locale;
import java.util.ResourceBundle;

import javax.swing.JDialog;
import javax.swing.JOptionPane;

public class JOptionPaneDemonstrationLocalized {

  public static void main(String[] argv) {

    Font unicodeFont = new Font("LucidaSans", Font.PLAIN, 12);

    ResourceBundle bundle = ResourceBundle.getBundle("JOptionPaneResources", Locale.getDefault());
    if (bundle == null)
      System.exit(1);

    String[] textMessages = new String[3];
    textMessages[0] = bundle.getString("Yes");
    textMessages[1] = bundle.getString("No");
    textMessages[2] = bundle.getString("Cancel");

    JOptionPane jop = new JOptionPane(bundle.getString("MessageText"), JOptionPane.ERROR_MESSAGE,
        JOptionPane.YES_NO_CANCEL_OPTION, null, textMessages);
    JDialog jopDialog = jop.createDialog(null, bundle.getString("TitleText"));
    jop.setFont(unicodeFont);
    jopDialog.setVisible(true);
    Object userSelection = jop.getValue();
    // NOTE: The return value returned by the above statement is an int
    System.exit(0);
  }
}

//JOptionPaneResources_iw.properties
/*
# JOptionPane text resources in Hebrew
#
Yes=u05dbu05df
No=u05dcu05d0
OK=u05d0u05d9u05e9u05d5u05e8
Cancel=u05d1u05d9u05d8u05d5u05dc
MessageText=u05d6u05d0u05ea u05d4u05d5u05d3u05e2u05d4
TitleText=u05d6u05d0u05ea u05dbu05d5u05eau05e8u05ea

*/


           
         
    
    
    
    
    
    
    
  

Thank with us