svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.utils / src / main / java / org / gvsig / utils / swing / sample / Sample.java @ 40561
History | View | Annotate | Download (2.96 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.utils.swing.sample; |
25 |
|
26 |
import java.io.ByteArrayOutputStream; |
27 |
import java.io.PrintStream; |
28 |
import java.io.UnsupportedEncodingException; |
29 |
import java.text.DateFormat; |
30 |
import java.text.ParseException; |
31 |
import java.util.Date; |
32 |
import java.util.Locale; |
33 |
|
34 |
|
35 |
public class Sample { |
36 |
|
37 |
/**
|
38 |
* DOCUMENT ME!
|
39 |
*
|
40 |
* @param args DOCUMENT ME!
|
41 |
*/
|
42 |
public static void main(String[] args) { |
43 |
/* JFrame f = new JFrame("AutoCompleteComboBox");
|
44 |
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
45 |
|
46 |
JComboBox box = new JComboBox(new Object[] {"", "bos d?as","ata logo","deica logo"});
|
47 |
box.setEditable(true);
|
48 |
f.getContentPane().add(box);
|
49 |
f.pack();
|
50 |
f.setLocationRelativeTo(null);
|
51 |
f.setVisible(true); */
|
52 |
/* JPasswordDlg dlg = new JPasswordDlg();
|
53 |
dlg.setMessage("Hola");
|
54 |
dlg.show(); */
|
55 |
Locale ukLocale = new Locale("en", "UK"); // English, UK version |
56 |
DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, ukLocale); |
57 |
/* Calendar c = Calendar.getInstance();
|
58 |
c.clear();
|
59 |
c.set(Integer.parseInt(year), Integer.parseInt(month),
|
60 |
Integer.parseInt(day));
|
61 |
c.set(Calendar.MILLISECOND, 0); */
|
62 |
String strAux = "12/06/1996"; |
63 |
Date dat = null; |
64 |
try {
|
65 |
dat = df.parse(strAux); |
66 |
} catch (ParseException e) { |
67 |
e.printStackTrace(); |
68 |
} |
69 |
System.out.println(dat.getYear() + " " + dat.getMonth() + " " + dat.getDate()); |
70 |
|
71 |
String aux = "Ja?n"; |
72 |
StringBuffer strBuf = new StringBuffer(aux); |
73 |
ByteArrayOutputStream out = new ByteArrayOutputStream(strBuf.length()); |
74 |
PrintStream printStream = new PrintStream(out); |
75 |
printStream.print(aux); |
76 |
try {
|
77 |
String aux2 = out.toString("UTF-8"); |
78 |
System.out.println(aux + " " + aux2); |
79 |
} catch (UnsupportedEncodingException e) { |
80 |
// TODO Auto-generated catch block
|
81 |
e.printStackTrace(); |
82 |
} |
83 |
}} |