List of usage examples for java.util Locale UK
Locale UK
To view the source code for java.util Locale UK.
Click Source Link
From source file:MainClass.java
public static void main(String args[]) throws Exception { JFrame frame = new JFrame("Number Input"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Font font = new Font("SansSerif", Font.BOLD, 16); JLabel label;/*from w ww. j ava2 s. co m*/ JFormattedTextField input; JPanel panel; BoxLayout layout = new BoxLayout(frame.getContentPane(), BoxLayout.Y_AXIS); frame.setLayout(layout); Format currency = NumberFormat.getCurrencyInstance(Locale.UK); label = new JLabel("UK Currency:"); input = new JFormattedTextField(currency); input.setValue(2424.50); input.setColumns(20); input.setFont(font); panel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); panel.add(label); panel.add(input); frame.add(panel); frame.pack(); frame.setVisible(true); }
From source file:NumberInputSampleLocaleUK.java
public static void main(String args[]) { JFrame frame = new JFrame("Number Input"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Font font = new Font("SansSerif", Font.BOLD, 16); JLabel label;/*from w ww . j a v a2s. c om*/ JFormattedTextField input; JPanel panel; BoxLayout layout = new BoxLayout(frame.getContentPane(), BoxLayout.Y_AXIS); frame.setLayout(layout); Format currency = NumberFormat.getCurrencyInstance(Locale.UK); label = new JLabel("UK Currency:"); input = new JFormattedTextField(currency); input.setValue(2424.50); input.setColumns(20); input.setFont(font); panel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); panel.add(label); panel.add(input); frame.add(panel); frame.add(new JTextField()); frame.pack(); frame.setVisible(true); }
From source file:com.apress.prospringintegration.corespring.i18n.MainI18n.java
public static void main(String[] args) { ApplicationContext ctx = new ClassPathXmlApplicationContext("ioc_resource_bundles.xml"); String qMessage = ctx.getMessage("queued", null, Locale.US); System.out.println(qMessage); qMessage = ctx.getMessage("queued", null, Locale.UK); System.out.println(qMessage); String filename = "ProSpringIntegration.xml"; MessageSourceResolvable processed = new DefaultMessageSourceResolvable(new String[] { "complete" }, new String[] { filename }, " Your data has been processed!"); String msrQmessage = ctx.getMessage(processed, Locale.FRANCE); System.out.println(msrQmessage); }
From source file:com.google.play.developerapi.samples.UpdateListing.java
public static void main(String[] args) { try {// ww w .j av a2 s.co m Preconditions.checkArgument(!Strings.isNullOrEmpty(ApplicationConfig.PACKAGE_NAME), "ApplicationConfig.PACKAGE_NAME cannot be null or empty!"); // Create the API service. AndroidPublisher service = AndroidPublisherHelper.init(ApplicationConfig.APPLICATION_NAME, ApplicationConfig.SERVICE_ACCOUNT_EMAIL); final Edits edits = service.edits(); // Create an edit to update listing for application. Insert editRequest = edits.insert(ApplicationConfig.PACKAGE_NAME, null /** no content */ ); AppEdit edit = editRequest.execute(); final String editId = edit.getId(); log.info(String.format("Created edit with id: %s", editId)); // Update listing for US version of the application. final Listing newUsListing = new Listing(); newUsListing.setTitle(US_LISTING_TITLE).setFullDescription(US_LISTING_FULL_DESCRIPTION) .setShortDescription(US_LISTING_SHORT_DESCRITPION).setVideo(LISTINGS_PROMO_VIDEO); Update updateUSListingsRequest = edits.listings().update(ApplicationConfig.PACKAGE_NAME, editId, Locale.US.toString(), newUsListing); Listing updatedUsListing = updateUSListingsRequest.execute(); log.info(String.format("Created new US app listing with title: %s", updatedUsListing.getTitle())); // Create and update listing for UK version of the application. final Listing newUkListing = new Listing(); newUkListing.setTitle(UK_LISTING_TITLE).setFullDescription(UK_LISTING_FULL_DESCRIPTION) .setShortDescription(UK_LISTING_SHORT_DESCRITPION).setVideo(LISTINGS_PROMO_VIDEO); Update updateUkListingsRequest = edits.listings().update(ApplicationConfig.PACKAGE_NAME, editId, Locale.UK.toString(), newUkListing); Listing updatedUkListing = updateUkListingsRequest.execute(); log.info(String.format("Created new UK app listing with title: %s", updatedUkListing.getTitle())); // Commit changes for edit. Commit commitRequest = edits.commit(ApplicationConfig.PACKAGE_NAME, editId); AppEdit appEdit = commitRequest.execute(); log.info(String.format("App edit with id %s has been comitted", appEdit.getId())); } catch (IOException | GeneralSecurityException ex) { log.error("Exception was thrown while updating listing", ex); } }
From source file:jeplus.Main.java
/** * @param args the command line arguments *//*from w w w. j a v a2 s. co m*/ public static void main(String[] args) { // if (REDIRECT_ERR) { // try { // // Redirect err // System.setErr(new PrintStream(new FileOutputStream("jeplus.err"))); // } catch (FileNotFoundException ex) { // //Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); // ex.printStackTrace(); // } // } try { // Set cross-platform Java L&F (also called "Metal") // UIManager.setLookAndFeel( // UIManager.getCrossPlatformLookAndFeelClassName()); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); // for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { // if ("Nimbus".equals(info.getName())) { // UIManager.setLookAndFeel(info.getClassName()); // break; // } // } } catch (UnsupportedLookAndFeelException e) { System.err.println("Unsupported Look-And-Feel Option. Reverting to the default UI."); } catch (ClassNotFoundException e) { System.err.println("Specified Look-And-Feel class cannot be found. Reverting to the default UI."); } catch (InstantiationException e) { System.err.println("Fialed to instantiate the specified Look-And-Feel. Reverting to the default UI."); } catch (IllegalAccessException e) { System.err.println("Cannot access the specified Look-And-Feel. Reverting to the default UI."); } // Set locale to UK Locale.setDefault(Locale.UK); // Set line end to DOS style System.setProperty("line.separator", "\r\n"); // System.setProperty("file.separator", "/"); // seemed to have no effect // create the parser CommandLineParser parser = new GnuParser(); Options options = new Main().getCommandLineOptions(null); CommandLine commandline = null; HelpFormatter formatter = new HelpFormatter(); formatter.setWidth(80); try { // parse the command line arguments commandline = parser.parse(options, args); if (commandline.hasOption("help")) { // automatically generate the help statement formatter.printHelp("java -Xmx1000m -jar jEPlus.jar [OPTIONS]", options); System.exit(-1); } // Set log4j configuration if (commandline.hasOption("log")) { PropertyConfigurator.configure(commandline.getOptionValue("log")); } else { PropertyConfigurator.configure("log4j.cfg"); } } catch (ParseException exp) { // oops, something went wrong System.err.println("Parsing failed. Reason: " + exp.getMessage()); // automatically generate the help statement formatter.printHelp("java -Xmx1000m -jar jEPlus.jar [OPTIONS]", options); System.exit(-1); } // Call main fuction with commandline new Main().mainFunction(commandline); }
From source file:DateOutils.java
public static Date stringToDate(String d) throws ParseException { DateFormat formatter = new SimpleDateFormat("EEE MMM d HH:mm:ss z yyyy", Locale.UK); Date date = (Date) formatter.parse(d); return date;/*ww w. j a va 2 s.com*/ }
From source file:Main.java
public static String getTOSLink() { String link = "http://m.google.com/toscountry"; // default String locale = Locale.getDefault().toString(); if (locale.equals(Locale.US.toString())) { link = "http://m.google.com/tospage"; } else if (locale.equals(Locale.UK.toString())) { link = "http://m.google.co.uk/tospage"; } else if (locale.equals(Locale.CANADA.toString())) { link = "http://m.google.ca/tospage"; } else if (locale.equals(Locale.CANADA_FRENCH.toString())) { link = "http://m.google.ca/tospage?hl=fr"; } else if (locale.equals(Locale.FRANCE.toString())) { link = "http://m.google.fr/tospage"; }// w w w . j a va 2 s .com return link; }
From source file:Main.java
public static void log(String TAG, String message, Object... args) { if (DEBUG_OUTPUTS_ENABLED) Log.d(ID, TAG + "::" + String.format(Locale.UK, message, args)); }
From source file:Main.java
public static String getWeekDay(Date date) { DateFormat df = new SimpleDateFormat(weekDayString, Locale.UK); df.setTimeZone(TimeZone.getTimeZone("UTC")); return df.format(date); }
From source file:Main.java
public static String getMonthDay(Date date) { DateFormat df = new SimpleDateFormat(monthDayString, Locale.UK); df.setTimeZone(TimeZone.getTimeZone("UTC")); return df.format(date); }