informatique:java:tips
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
informatique:java:tips [26/04/2011 14:59] – [Convert a Java OutputStream to an InputStream] cyrille | informatique:java:tips [16/06/2023 10:02] (Version actuelle) – [Swing] cyrille | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
====== Java Tips ====== | ====== Java Tips ====== | ||
- | ===== Swing UI ===== | + | Plein de choses interressantes dans le livre " |
- | * [[http://download.oracle.com/javase/ | + | http://filthyrichclients.org/ Le bouquin de Romain Guy & Chet Haase. In Filthy Rich Clients, we explain how to create filthy rich effects in your applications, from the fundamental graphics, GUI, and animation technology up through sample code and algorithms for the effects themselves. Des exemples de code. |
+ | [[http:// | ||
+ | ===== Swing ===== | ||
+ | |||
+ | * [[http:// | ||
+ | * About [[/ | ||
+ | * Plein d' | ||
===== CVS Format ===== | ===== CVS Format ===== | ||
* [[http:// | * [[http:// | ||
+ | |||
+ | ===== Read input from console ===== | ||
+ | |||
+ | Read console input using **java.io.Console** instance - // | ||
+ | <code java> | ||
+ | private static void usingConsoleReader() | ||
+ | { | ||
+ | Console | ||
+ | if (console != null) | ||
+ | { | ||
+ | | ||
+ | | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Read console input using **BufferedReader** instance | ||
+ | <code java> | ||
+ | private static void usingBufferedReader() | ||
+ | { | ||
+ | BufferedReader bufferRead = new BufferedReader( new InputStreamReader( System.in ) ); | ||
+ | String inputString = bufferRead.readLine(); | ||
+ | System.out.println( inputString ); | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Read console input using **Scanner** instance | ||
+ | <code java> | ||
+ | private static void usingScanner() | ||
+ | { | ||
+ | Scanner scanIn = new Scanner( System.in ); | ||
+ | String inputString = scanIn.nextLine(); | ||
+ | scanIn.close(); | ||
+ | System.out.println(inputString); | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ===== Process Input Stream Reader ===== | ||
+ | |||
+ | <code java> | ||
+ | import java.io.BufferedReader; | ||
+ | import java.io.IOException; | ||
+ | import java.io.InputStream; | ||
+ | import java.io.InputStreamReader; | ||
+ | import java.net.InetAddress; | ||
+ | import java.net.UnknownHostException; | ||
+ | import java.io.*; | ||
+ | |||
+ | public class Traceroute { | ||
+ | | ||
+ | Runtime t = Runtime.getRuntime(); | ||
+ | try { | ||
+ | | ||
+ | // | ||
+ | | ||
+ | | ||
+ | | ||
+ | int m =0; | ||
+ | | ||
+ | String content = re.readLine(); | ||
+ | System.out.println(content); | ||
+ | if(content == null){ | ||
+ | | ||
+ | } | ||
+ | } | ||
+ | | ||
+ | | ||
+ | } catch (IOException e) { | ||
+ | e.printStackTrace(); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | </ | ||
===== Convert a Java OutputStream to an InputStream ===== | ===== Convert a Java OutputStream to an InputStream ===== | ||
Ligne 56: | Ligne 136: | ||
class2.processDataFromInputStream(cbb.getInputStream()); | class2.processDataFromInputStream(cbb.getInputStream()); | ||
</ | </ | ||
+ | |||
+ | ===== Serial communication ===== | ||
+ | |||
+ | Communication série avec Java | ||
+ | |||
+ | * http:// | ||
+ | * http:// | ||
+ | |||
+ | |||
informatique/java/tips.1303822783.txt.gz · Dernière modification : 19/05/2012 00:15 (modification externe)