Answers for "modifier label java"

0

editer un label java

public class inter extends JFrame implements ActionListener{
		JTextField j;
		JButton b;
		JLabel l;
		public inter(){
			l=new JLabel("the worst area");
			b=new JButton("changer");
			b.addActionListener(this);
			j=new JTextField(20);			
			j.setVisible(true);
			this.setLayout(new FlowLayout());
			this.add(l);
			this.add(j);
			this.add(b);
			l=new JLabel("the worst area");
			this.setTitle("diagnostic");
			this.setSize(300, 300);
			this.setVisible(true);
		}
		@Override
		public void actionPerformed(ActionEvent e) {
			// TODO Auto-generated method stub
			if (e.getSource()==b){
				this.l.setText(j.getText());
			}
 
		}
 
 
}
Posted by: Guest on May-11-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language