7 package org.libcsdbg.jtracer;
9 import java.util.Hashtable;
10 import java.util.Calendar;
13 import java.awt.Color;
14 import java.awt.Insets;
15 import java.awt.GridBagLayout;
16 import java.awt.GridBagConstraints;
18 import javax.swing.JPanel;
19 import javax.swing.JLabel;
20 import javax.swing.BorderFactory;
21 import javax.swing.border.EtchedBorder;
34 private Hashtable<String, JLabel>
fields = null;
43 fields =
new Hashtable<String, JLabel>();
44 GridBagLayout lm =
new GridBagLayout();
45 GridBagConstraints c =
new GridBagConstraints();
49 c.gridx = c.gridy = 0;
51 c.insets =
new Insets(0, 0, 0, 0);
52 c.fill = GridBagConstraints.HORIZONTAL;
53 lm.setConstraints(field, c);
59 c.fill = GridBagConstraints.NONE;
60 lm.setConstraints(field, c);
65 lm.setConstraints(field, c);
79 fields.get(nm).setText(text);
90 fields.get(
"message").setText(msg);
103 JLabel field = fields.get(
"timestamp");
105 Calendar c = Calendar.getInstance();
106 c.setTimeInMillis(microtm / 1000);
108 int d1 = c.get(Calendar.DATE);
109 int d2 = c.get(Calendar.MONTH) + 1;
110 int d3 = c.get(Calendar.YEAR);
113 text += ((d1 < 10) ?
"0" :
"") + d1 +
"/";
114 text += ((d2 < 10) ?
"0" :
"") + d2 +
"/" + d3 +
" ";
116 int h1 = c.get(Calendar.HOUR);
117 int h2 = c.get(Calendar.MINUTE);
118 int h3 = c.get(Calendar.SECOND);
120 text += ((h1 < 10) ?
"0" :
"") + h1 +
":";
121 text += ((h2 < 10) ?
"0" :
"") + h2 +
":";
122 text += ((h3 < 10) ?
"0" :
"") + h3;
137 fields.get(
"address").setText(addr +
":" + port);
146 fields.get(
"message").setText(
"n/a");
147 fields.get(
"timestamp").setText(
"n/a");
148 fields.get(
"address").setText(
"n/a");
161 GridBagLayout lm =
new GridBagLayout();
162 GridBagConstraints c =
new GridBagConstraints();
163 JPanel retval =
new JPanel(lm);
165 Registry conf = Registry.getCurrent();
166 retval.setBackground((Color) conf.
get(
"statusbar",
"bgcolor"));
167 retval.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
169 JLabel field =
new JLabel(
"n/a");
170 field.setFont((Font) conf.
get(
"statusbar",
"font"));
171 field.setForeground((Color) conf.
get(
"statusbar",
"fgcolor"));
173 if (nm.equals(
"message")) {
175 c.anchor = GridBagConstraints.EAST;
178 c.insets =
new Insets(1, 8, 1, 8);
179 lm.setConstraints(field, c);
182 fields.put(nm, field);
static final long serialVersionUID
Class version.
Object get(String section, String key)
Get an entry.
void setField(String nm, String text)
Set the text of any field.
JPanel createField(String nm)
Create one of the fields.
void setAddress(String addr, int port)
Set the address field.
void setTimestamp(Long microtm)
Set the trace timestamp field.
void setMessage(String msg)
Set the message field.
void clear()
Clear all fields (set them to their default value)
A bar for various trace details (exception message, timestamp e.t.c) with multiple indicators and con...
Hashtable< String, JLabel > fields
Indicator list.