Article View: borland.public.jbuilder.java.swing
Article #478setAction method removes button text and tooltip text !!!
From: 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?
Technical Details
Message-ID:
<1121513322.698048.20270@o13g2000cwo.googlegroups.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!o13g2000cwo.googlegroups.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 111d45,691e935802b76efd,start X-Google-Attributes: gid111d45,public X-Google-Language: ENGLISH,ASCII-7-bit Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!o13g2000cwo.googlegroups.com!not-for-mail From: srinath.c@gmail.com Newsgroups: borland.public.jbuilder.java.swing Subject: setAction method removes button text and tooltip text !!! Date: 16 Jul 2005 04:28:42 -0700 Organization: http://groups.google.com Lines: 39 Message-ID: <1121513322.698048.20270@o13g2000cwo.googlegroups.com> NNTP-Posting-Host: 192.11.222.116 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1121513327 30183 127.0.0.1 (16 Jul 2005 11:28:47 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 16 Jul 2005 11:28:47 +0000 (UTC) User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: o13g2000cwo.googlegroups.com; posting-host=192.11.222.116; posting-account=Wv3rAQ0AAAATy4JEe_XiLAYM4_tIYVd1