~tudor/flywire/0.2.1

« back to all changes in this revision

Viewing changes to src/org/bentokit/flywire/gui/components/TimeComponent.java

  • Committer: tudor
  • Date: 2011-03-12 00:47:02 UTC
  • Revision ID: svn-v4:48700339-fa25-0410-b67c-989cebe9404f:branches/0.2:78
Compiles and runs, but is much broken.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package org.bentokit.flywire.gui.components;
 
2
 
 
3
import javax.media.Time;
 
4
import javax.swing.JLabel;
 
5
 
 
6
import org.bentokit.flywire.util.TimeNumberFormat;
 
7
 
 
8
public class TimeComponent extends ValueComponent<Time> {
 
9
        /**
 
10
         * 
 
11
         */
 
12
        private static final long serialVersionUID = -1541249157945873867L;
 
13
        Time time;
 
14
        JLabel label;
 
15
        
 
16
        public TimeComponent() {
 
17
                this.time = null;
 
18
                this.label = new JLabel("");
 
19
                this.add(this.label);
 
20
        this.label.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
 
21
        }
 
22
        
 
23
        
 
24
        public Time getValue() {
 
25
                return this.time;
 
26
        }
 
27
        
 
28
        @Override
 
29
        public void setValue(Time value) {
 
30
                String timeString = value == null ||
 
31
                value == javax.media.Player.DURATION_UNKNOWN ?
 
32
                                "UNKNOWN" : TimeNumberFormat.formatTimeString(value);
 
33
                this.label.setText(timeString);
 
34
        }
 
35
}