xitiomet / placebohttp (http://openstatic.org/)
Embeded Http server for gcj/java applications. PlaceboHttp uses an automatic session management system, Treating each session as a HttpRequest queue.
| commit 20: | fc9e1983c2a0 |
| parent 19: | 81f8f47a533a |
| branch: | default |
More gui tweaking
Changed (Δ1.2 KB):
raw changeset »
src/org/openstatic/placebo/ControlPanel.java (6 lines added, 2 lines removed)
src/org/openstatic/util/JTextAreaOutputStream.java (49 lines added, 0 lines removed)
Up to file-list src/org/openstatic/placebo/ControlPanel.java:
| … | … | @@ -17,6 +17,8 @@ import java.awt.Dimension; |
17 |
17 |
import java.awt.event.ActionEvent; |
18 |
18 |
import java.awt.event.ActionListener; |
19 |
19 |
import javax.swing.JTabbedPane; |
20 |
import java.awt.Font; |
|
21 |
import java.awt.Color; |
|
20 |
22 |
|
21 |
23 |
public class ControlPanel extends JFrame implements ActionListener |
22 |
24 |
{ |
| … | … | @@ -67,11 +69,9 @@ public class ControlPanel extends JFrame |
67 |
69 |
pane.setSize(50,100); |
68 |
70 |
JLabel port_label = new JLabel("Port:", JLabel.TRAILING); |
69 |
71 |
port_field = new JTextField(15); |
70 |
port_field.setText("8434"); |
|
71 |
72 |
|
72 |
73 |
JLabel root_label = new JLabel("Web Root:", JLabel.TRAILING); |
73 |
74 |
root_field = new JTextField(15); |
74 |
root_field.setText("placebohttp.jar/www"); |
|
75 |
75 |
|
76 |
76 |
JLabel debug_label = new JLabel("Debug:", JLabel.TRAILING); |
77 |
77 |
debug_field = new JCheckBox(); |
| … | … | @@ -103,6 +103,10 @@ public class ControlPanel extends JFrame |
103 |
103 |
// Right Side |
104 |
104 |
|
105 |
105 |
log_box = new JTextArea(); |
106 |
Font font = new Font("Monospaced", Font.BOLD, 12); |
|
107 |
log_box.setFont(font); |
|
108 |
log_box.setForeground(Color.WHITE); |
|
109 |
log_box.setBackground(Color.BLACK); |
|
106 |
110 |
log_output = new JTextAreaOutputStream(log_box); |
107 |
111 |
JScrollPane scroller = new JScrollPane(log_box); |
108 |
112 |
scroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); |
Up to file-list src/org/openstatic/util/JTextAreaOutputStream.java:
1 |
package org.openstatic.util; |
|
2 |
||
3 |
import javax.swing.JTextArea; |
|
4 |
import java.io.OutputStream; |
|
5 |
import java.io.IOException; |
|
6 |
||
7 |
public class JTextAreaOutputStream extends OutputStream |
|
8 |
{ |
|
9 |
private JTextArea area; |
|
10 |
||
11 |
public JTextAreaOutputStream() |
|
12 |
{ |
|
13 |
this.area = new JTextArea(); |
|
14 |
} |
|
15 |
||
16 |
public JTextAreaOutputStream(JTextArea area) |
|
17 |
{ |
|
18 |
this.area = area; |
|
19 |
} |
|
20 |
||
21 |
public JTextArea getJTextArea() |
|
22 |
{ |
|
23 |
return this.area; |
|
24 |
} |
|
25 |
||
26 |
public void flush() throws IOException |
|
27 |
{ |
|
28 |
// do nuttin |
|
29 |
} |
|
30 |
||
31 |
public void write(byte b[]) throws IOException |
|
32 |
{ |
|
33 |
this.area.append(new String(b)); |
|
34 |
this.area.setCaretPosition(this.area.getDocument().getLength()); |
|
35 |
} |
|
36 |
||
37 |
public void write(byte b[], int off, int len) throws IOException |
|
38 |
{ |
|
39 |
String s = new String(b , off , len); |
|
40 |
this.area.append(s); |
|
41 |
this.area.setCaretPosition(this.area.getDocument().getLength()); |
|
42 |
} |
|
43 |
||
44 |
public void write(int b) throws IOException |
|
45 |
{ |
|
46 |
this.area.append(String.valueOf(b)); |
|
47 |
this.area.setCaretPosition(this.area.getDocument().getLength()); |
|
48 |
} |
|
49 |
} |
