Untitled
unknown
plain_text
3 years ago
689 B
2
Indexable
Never
package p2; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class m4t1 { public static void main(String[] args) { // TODO Auto-generated method stub JFrame frame = new JFrame(); frame.setSize(300, 200); JLabel lab = new JLabel("0"); JButton b = new JButton("1"); frame.add(lab, BorderLayout.CENTER); frame.add(b, BorderLayout.SOUTH); b.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int tmp = Integer.parseInt(b.getLabel()); int tmp1 = Integer.parseInt(lab.getText()); b.setLabel(""+tmp1); lab.setText(""+tmp); } }); frame.setVisible(true); } }