1 package com.nexuiz.demorecorder.ui.swinggui;
3 import java.awt.BorderLayout;
5 import java.awt.Component;
6 import java.awt.Graphics;
7 import java.awt.SystemColor;
9 import javax.swing.BorderFactory;
10 import javax.swing.Icon;
11 import javax.swing.JLabel;
12 import javax.swing.JPanel;
14 public class StatusBar extends JPanel {
16 private static final long serialVersionUID = -1471757496863555741L;
17 private JLabel currentActivity = null;
19 private static final String STATE_IDLE = "Idle";
20 private static final String STATE_WORKING = "Working";
23 BorderLayout borderLayout = new BorderLayout(0, 0);
24 setLayout(borderLayout);
25 JPanel rightPanel = new JPanel(new BorderLayout());
26 rightPanel.add(new JLabel(new AngledLinesWindowsCornerIcon()), BorderLayout.SOUTH);
27 rightPanel.setOpaque(false);
29 add(rightPanel, BorderLayout.EAST);
31 this.currentActivity = new JLabel("Idle");
32 add(this.currentActivity, BorderLayout.WEST);
33 setBackground(SystemColor.control);
34 setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, Color.black));
38 * Sets the state/display of the status bar to "idle" (false) or "working" (true).
41 public void showState(boolean state) {
43 currentActivity.setText(STATE_WORKING);
45 currentActivity.setText(STATE_IDLE);
49 private static class AngledLinesWindowsCornerIcon implements Icon {
50 private static final Color WHITE_LINE_COLOR = new Color(255, 255, 255);
52 private static final Color GRAY_LINE_COLOR = new Color(172, 168, 153);
53 private static final int WIDTH = 13;
55 private static final int HEIGHT = 13;
57 public int getIconHeight() {
61 public int getIconWidth() {
65 public void paintIcon(Component c, Graphics g, int x, int y) {
67 g.setColor(WHITE_LINE_COLOR);
68 g.drawLine(0, 12, 12, 0);
69 g.drawLine(5, 12, 12, 5);
70 g.drawLine(10, 12, 12, 10);
72 g.setColor(GRAY_LINE_COLOR);
73 g.drawLine(1, 12, 12, 1);
74 g.drawLine(2, 12, 12, 2);
75 g.drawLine(3, 12, 12, 3);
77 g.drawLine(6, 12, 12, 6);
78 g.drawLine(7, 12, 12, 7);
79 g.drawLine(8, 12, 12, 8);
81 g.drawLine(11, 12, 12, 11);
82 g.drawLine(12, 12, 12, 12);