Java Reference
In-Depth Information
class TempVerter
{
static JPanel createGUI()
{
JPanel pnlLayout = new JPanel();
pnlLayout.setLayout(new GridLayout(3, 1));
JPanel pnlTemp = new JPanel();
((FlowLayout)
pn-
lTemp.getLayout()).setAlignment(FlowLayout.LEFT);
pnlTemp.add(new JLabel("degrees"));
final JTextField txtDegrees = new JTextField(10);
txtDegrees.setToolTipText("enter a numeric value in
this field.");
pnlTemp.add(txtDegrees);
pnlLayout.add(pnlTemp);
pnlTemp = new JPanel();
((FlowLayout)
pn-
lTemp.getLayout()).setAlignment(FlowLayout.LEFT);
pnlTemp.add(new JLabel("result"));
final JTextField txtResult = new JTextField(30);
txtResult.setToolTipText("don't enter anything in
this field.");
pnlTemp.add(txtResult);
pnlLayout.add(pnlTemp);
pnlTemp = new JPanel();
ImageIcon ii = new ImageIcon("thermometer.gif");
ActionListener al;
al = new ActionListener()
{
@Override
public void actionPerformed(ActionEvent ae)
{
try
{
double
value
=
Search WWH ::




Custom Search