Thread View: borland.public.jbuilder.java.swing
1 messages
1 total messages
Started by srinath.c
Sat, 16 Jul 2005 11:28
setAction method removes button text and tooltip text !!!
Author: srinath.c
Date: Sat, 16 Jul 2005 11:28
Date: Sat, 16 Jul 2005 11:28
38 lines
1949 bytes
1949 bytes
Hi,
Consider this code:
public class Button extends JFrame
{
JButton btn = new JButton("Click Me!!!");
public Button()
{
setTitle("Nothing");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
getContentPane().add(btn);
btn.setToolTipText("Please Click Here.");
btn.setBounds(5, 5, 50, 25);
btn.setAction(new AbstractAction()
{
public void actionPerformed(ActionEvent e)
{
System.out.println("Clicked!!!");
}
});
this.setSize(new Dimension(100,35));
}
public static void main(String []args)
{
Button btn = new Button();
btn.show();
}
}
On running this program, the button neither has text nor tootip. On
debugging I found that after doing a 'setAction()' for the button, the
text and tooltip text were set to null. Any Idea why this should happen?
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads