Archive for the ‘java’ Category
Friday, September 11th, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JApplet;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.WindowConstants;
public class Test3 extends JApplet {
public void init() {
Container contentPane = getContentPane();
Icon icon = new ImageIcon(ClassLoader.getSystemResource("swing.gif"));
JLabel label = new JLabel(icon);
// java.net.URL codebase = getClass().getResource("../swing.gif");
// JLabel label = new JLabel(new ImageIcon(codebase));
contentPane.setLayout(new FlowLayout());
contentPane.add(label);
}
public static void main(String args[]) {
final JFrame f = new JFrame();
JApplet applet = new Test3();
applet.init();
f.setContentPane(applet.getContentPane());
f.setBounds(100, 100, 308, 199);
f.setTitle("An Application");
f.setVisible(true);
f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
f.addWindowListener(new WindowAdapter() {
public void windowClosed(WindowEvent e) {
System.exit(0);
}
});
}
} |
Tags: java, swing
Posted in swing | No Comments »
Tuesday, September 1st, 2009
String s = request.getRequestURL().toString();
URL url = new URL(s);
BufferedReader bf = new BufferedReader(new InputStreamReader(url.openStream()));
Posted in java | No Comments »
Thursday, July 2nd, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| if (null == transactionCodeConfig) {
transactionCodeConfig = new Properties();
transactionCodeConfig.load(Obj2XMLBuilderXSD.class
.getResourceAsStream("/config/transactionCodeConfig.properties"));
xsdMap = new HashMap();
for (Iterator iterator = transactionCodeConfig.entrySet().iterator(); iterator.hasNext();) {
Entry entry = (Entry) iterator.next();
BufferedReader br = new BufferedReader(new InputStreamReader(
Obj2XMLBuilderXSD.class.getResourceAsStream("/config/xsd/" + entry.getValue())));
String aLine;
StringBuffer xsdContent = new StringBuffer("");
aLine = br.readLine();
while (null != aLine) {
xsdContent.append(aLine);
aLine = br.readLine();
}
br.close();
xsdMap.put(entry.getKey(), xsdContent.toString());
}
} |
Posted in java | No Comments »