import java.awt.*; import javax.swing.*; public class Degres { public static void main(String[] args) { JFrame f = new JFrame("Degrés !"); f.setSize(300, 150); f.setLocation(100, 100); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setLayout(null); JTextField CC = new JTextField(); JTextField CF = new JTextField(); JLabel LC = new JLabel("°C"); JLabel LF = new JLabel("°F"); LC.setSize(20, 20); LF.setSize(20, 20); LC.setLocation(230, 30); LF.setLocation(230, 60); CC.setSize(200, 20); CF.setSize(200, 20); CC.setLocation(20, 30); CF.setLocation(20, 60); Observer obs1 = new Observer(false); Observer obs2 = new Observer(true); obs1.setOutputField(CF); obs2.setOutputField(CC); CC.addActionListener(obs1); CF.addActionListener(obs2); f.add(LC); f.add(LF); f.add(CF); f.add(CC); f.setVisible(true); } }