-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconsoleHstCR.java
More file actions
62 lines (52 loc) · 2.13 KB
/
consoleHstCR.java
File metadata and controls
62 lines (52 loc) · 2.13 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package Jvakt;
/*
* 2022-06-23 V.54 Michael Ekdal Added getVersion() to get at consistent version throughout all classes.
*/
import javax.swing.*;
import java.awt.*;
import javax.swing.table.*;
class consoleHstCR extends JLabel implements TableCellRenderer
{
// private String columnName;
static final long serialVersionUID = 50L;
public consoleHstCR()
{
setOpaque(true);
}
public Component getTableCellRendererComponent(JTable table, Object value,boolean isSelected, boolean hasFocus, int row, int column)
{
Object ValuePrio = table.getValueAt(row,table.getColumnModel().getColumnIndex("Prio"));
Object ValueType = table.getValueAt(row,table.getColumnModel().getColumnIndex("Type"));
Object ValueStatus = table.getValueAt(row,table.getColumnModel().getColumnIndex("Status"));
int vPrio;
if (ValuePrio == null) vPrio = 30;
else vPrio = (Integer)ValuePrio;
// else vPrio = (int)ValuePrio;
String vType = (String)ValueType;
String vStatus = (String)ValueStatus;
if (vType == null) vType = " ";
if (vStatus == null) vStatus = " ";
if (value != null) setText(value.toString());
else setText(" ");
setFont(new javax.swing.plaf.FontUIResource("Dialog", Font.BOLD, table.getRowHeight()-3));
if(isSelected)
{
setBackground(table.getSelectionBackground());
setForeground(table.getSelectionForeground());
}
else
{
setBackground(table.getBackground());
setForeground(table.getForeground());
setBackground(Color.lightGray);
if (vStatus.startsWith("INFO") ) setBackground(java.awt.Color.yellow);
if (vStatus.startsWith("T") ) setBackground(java.awt.Color.orange);
if (vPrio >= 30 && !vStatus.startsWith("INFO") && !vStatus.startsWith("T") && !vStatus.startsWith(" ") ) setBackground(java.awt.Color.pink);
// if (vPrio < 30 && !vStatus.startsWith("T") ) setBackground(java.awt.Color.magenta);
if (vPrio < 30 ) setBackground(java.awt.Color.magenta);
if (vStatus.startsWith(" ") ) setBackground(java.awt.Color.lightGray);
if (vStatus.startsWith("OK") ) setBackground(java.awt.Color.green);
}
return this;
}
}