Mercurial > hg > jslab
comparison src/samer/core_/util/swing/TextualNumberViewer.java @ 0:bf79fb79ee13
Initial Mercurial check in.
author | samer |
---|---|
date | Tue, 17 Jan 2012 17:50:20 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:bf79fb79ee13 |
---|---|
1 package samer.core.util.swing; | |
2 import samer.core.*; | |
3 import javax.swing.*; | |
4 | |
5 public class TextualNumberViewer extends VPanel implements NumberViewer | |
6 { | |
7 JTextField rt; | |
8 | |
9 public TextualNumberViewer(String label) | |
10 { | |
11 setLayout(new java.awt.BorderLayout(0,0)); | |
12 setBorder(BorderFactory.createEmptyBorder(2,4,2,4)); | |
13 add(new JLabel(label)); | |
14 | |
15 rt = new JTextField(Shell.getInt("field.width",4)); | |
16 rt.setBackground(Shell.getColor("field.background",rt.getBackground())); | |
17 rt.setForeground(Shell.getColor("field.foreground",rt.getForeground())); | |
18 add(rt,java.awt.BorderLayout.EAST); | |
19 } | |
20 | |
21 public void set(int num) { rt.setText(String.valueOf(num)); } | |
22 public void set(double num) { rt.setText(X.string(num)); } | |
23 } | |
24 |