£, C:\UllNDOUlS\Pulpit\SuiingUl.jaua JEditor
:Layout;
* •
■ /
Otwórz... Ctrl+0
Zapisz Ctrl+S
Zapisz jako...
JFrarne
:s ActionListener {
JLabel text, clicked;
JButton button, clickButton;
JPanel panel;
private boolean _clickMeMode = true;
SwingUI(){ //Begin Constructor
text = new JLabel(rrITm a Siraple Program"); button = new JButton("Click Me"); button.addActionListener(this) ;
panel = new JPanel ();
panel.setLayout(new BorderLayout());
panel.setBackground(Color.white);
getContentPane().add(panel);
panel.add(BorderLayout.CENTER, text);
panel.add(BorderLayout.SOUTH, button);
} //End Constructor
public void actionPerformed(ActionEvent event){ Object source = event.getSource(); if (_clickMeMode) {
text.setText("Button Clicked"); button.setText("Click Again"); _clickMeMode = false;
} else {
text.setText("ITm a Sirnple Program"); button.setText("Click Me"); clickMeMode = true;