git://git.nikiroo.be
/
nikiroo-utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Maven Central in the README
[nikiroo-utils.git]
/
src
/
jexer
/
demos
/
Demo2.java
diff --git
a/src/jexer/demos/Demo2.java
b/src/jexer/demos/Demo2.java
index b6572af2e9b435cd3946cc909121101c1b132f30..e6112f65da363cac3d2c515506d3ace66e92b6e5 100644
(file)
--- a/
src/jexer/demos/Demo2.java
+++ b/
src/jexer/demos/Demo2.java
@@
-3,7
+3,7
@@
*
* The MIT License (MIT)
*
*
* The MIT License (MIT)
*
- * Copyright (C) 201
7
Kevin Lamonte
+ * Copyright (C) 201
9
Kevin Lamonte
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@
-28,8
+28,12
@@
*/
package jexer.demos;
*/
package jexer.demos;
-import java.net.*;
-import jexer.net.*;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+
+import jexer.net.TelnetServerSocket;
/**
* This class is the main driver for a simple demonstration of Jexer's
/**
* This class is the main driver for a simple demonstration of Jexer's
@@
-38,6
+42,11
@@
import jexer.net.*;
*/
public class Demo2 {
*/
public class Demo2 {
+ /**
+ * Translated strings.
+ */
+ private static final ResourceBundle i18n = ResourceBundle.getBundle(Demo2.class.getName());
+
/**
* Main entry point.
*
/**
* Main entry point.
*
@@
-47,7
+56,7
@@
public class Demo2 {
ServerSocket server = null;
try {
if (args.length == 0) {
ServerSocket server = null;
try {
if (args.length == 0) {
- System.err.print
f("USAGE: java -cp jexer.jar jexer.demos.Demo2 port\n"
);
+ System.err.print
ln(i18n.getString("usageString")
);
return;
}
return;
}
@@
-55,12
+64,14
@@
public class Demo2 {
server = new TelnetServerSocket(port);
while (true) {
Socket socket = server.accept();
server = new TelnetServerSocket(port);
while (true) {
Socket socket = server.accept();
- System.out.printf("New connection: %s\n", socket);
+ System.out.println(MessageFormat.
+ format(i18n.getString("newConnection"), socket));
DemoApplication app = new DemoApplication(socket.getInputStream(),
socket.getOutputStream());
DemoApplication app = new DemoApplication(socket.getInputStream(),
socket.getOutputStream());
- System.out.printf(" language: %s\n",
+ System.out.println(MessageFormat.
+ format(i18n.getString("language"),
((jexer.net.TelnetInputStream) socket.getInputStream()).
((jexer.net.TelnetInputStream) socket.getInputStream()).
- getLanguage());
+ getLanguage())
)
;
(new Thread(app)).start();
}
} catch (Exception e) {
(new Thread(app)).start();
}
} catch (Exception e) {