Alejandro Acuña
2024-07-30 65a64a81d30f00f1fffd5da6866850e1308e1135
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
63
64
65
66
67
68
69
70
71
72
package art.servers.gui.components;
 
import art.library.gui.flat.FlatLabel;
import art.library.utils.resources.Resources;
import art.servers.Shared;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.text.SimpleDateFormat;
import javax.swing.SwingConstants;
 
 
public class PanelClock extends PanelGeneric
{
    private FlatLabel message = null;
    private FlatLabel clock = null;
    
    public PanelClock()
    {
        this.setLayout(new BorderLayout());
        message = new FlatLabel();
        clock = new FlatLabel();
        clock.setPreferredSize(new Dimension(224, 25));
        clock.getLook().horizontalAlignment = SwingConstants.RIGHT;
        message.getLook().horizontalAlignment = SwingConstants.LEFT;
        message.setIcon(Resources.getResourceURL("data/art.library.server/icons/16x16/group2.png"));
        clock.setIcon(Resources.getResourceURL("data/art.library.server/icons/16x16/schedule2.png"));
        clock.revalidate();
        message.revalidate();
        this.add(message, BorderLayout.CENTER);
        this.add(clock, BorderLayout.EAST);
    }
    
    
 
    public void reload()
    {
        SimpleDateFormat formato1 = new SimpleDateFormat("EEEE, d MMMM yyyy HH:mm:ss", Shared.configuration.getLocale());
        String text = formato1.format(System.currentTimeMillis());
        clock.setText(text);
        clock.setPreferredSize(new Dimension(clock.getStringWidth() + 8, 21));
    }
    
    
    
    public void timer()
    {
        reload();
    }
    
    
    
    public void message(String text)
    {
        if (text != null)
        {
            if (text.length()> 0)
            {
                this.message.setText(text);
            }
            else
            {
                this.message.setText(text);
            }
        }
        else
        {
            this.message.setText("");
        }
    }
    
    
}