import java.awt.Graphics;
 import java.util.*;
 import java.text.*;
 import java.util.Locale;
 import java.awt.image.*;
 import javax.swing.*;
import java.awt.Graphics;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.awt.font.*;
import javax.swing.event.*;

// ============
public class textP extends JPanel implements ActionListener,ChangeListener
{ private static final long serialVersionUID =47897468764L;
     JTextField jb;
     JTextField jtf;
     JSlider jsd;
     int signal;
     public textP()
     {     signal=0;
	  setLayout(new BorderLayout());
     jb=new JTextField(""+signal);
     jtf=new JTextField(jb.getText());
     jsd=new JSlider(SwingConstants.HORIZONTAL,0,180,10);
     jsd.setMajorTickSpacing(20);
     jsd.setPaintTicks(true);
     jsd.setPaintLabels(true);
     jsd.addChangeListener(this);
     jsd.setValue(signal);
     jb.addActionListener(this);
     add(jb,BorderLayout.NORTH);
     add(jsd,BorderLayout.CENTER);
     add(jtf,BorderLayout.SOUTH);
     }
     public void actionPerformed( ActionEvent e)
    {   if(e.getSource()==jb)
        {   signal=Integer.parseInt(jb.getText());
             if(signal>180)
             { signal=180;}
             else if(signal<0)
             {signal=0;} 
             jb.setText(""+signal);
             jsd.setValue(signal);
        }
     }
     public void stateChanged(ChangeEvent e)
    {
	    if(e.getSource()==jsd)
	    {signal=jsd.getValue();jb.setText(""+signal);}
         repaint();
    }     
}
