aspose file tools*
The moose likes Java in General and the fly likes To Michael Ernest -about changing button labels Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "To Michael Ernest -about changing button labels" Watch "To Michael Ernest -about changing button labels" New topic
Author

To Michael Ernest -about changing button labels

Avin Sinanan
Ranch Hand

Joined: Nov 07, 2001
Posts: 109
Ok i tried the code but it didn't compile.. and you told me to notify you if it didn't...
here is the code.. thanks for the help so far

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class ButtonThing implements ActionListener
{ private JPanel jp;
private JButton jb;
private JLabel jl;
private JFrame jf ;

private int presses = 0; public ButtonThing(String title) {
jf = new JFrame(title);
jp = new JPanel(new BorderLayout());
jb = new JButton("Click Me");
jl = new JLabel();
jp.add(jb, BorderLayout.NORTH);
jp.add(jl, BorderLayout.SOUTH);

jf.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
System.exit(0); }
});
jf.setContentPane(jp);
jf.setSize(250,250);
jf.setVisible(true);
}

public void actionPerformed(ActionEvent ae) {
++presses;
jb.setLabel("Thank you for clicking");
jl.setText("Press count: " + presses);
}
public static void main(String args[]) {
// Run program with:
// java ButtonThing
ButtonThing bt = new ButtonThing(args[0]);
}
}

if u can fix this please do.. you help would be greatly appreciated.. yours respectful Avin Sinanan

yours respectfully<br />Avin Sinanan
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

Well, sure, but help me out here just a little! What compiler errors did you get?
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: To Michael Ernest -about changing button labels