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("");
|
}
|
}
|
|
|
}
|