What version of Swing are you using and on what platform? -----Original Message----- From: David Treves [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 26, 2002 3:33 AM To: JDJList Subject: [jdjlist] Re: 2 SWING questions
Hi there, Remember my question about the font being BOLD and when the mouse hovers for the first time on it the font becomes PLAIN? Well, I tested it on JBuilder 6.0, I switched to Metal L&F and as soon as I did it all the menus were with BOLD fonts and when I hovered on them they became PLAIN. It looks like it is a bug in the jre unless JBuilder's people also don't know how to instantiate swing components... :o) Sincerely, -- David Treves. ----- Original Message ----- From: "Paul Franz" <[EMAIL PROTECTED]> To: "JDJList" <[EMAIL PROTECTED]> Sent: Monday, June 10, 2002 12:51 PM Subject: [jdjlist] Re: 2 SWING questions > Actually that is not quite normal. Two things: > > 1) Have you tried removing the ActionListener stuff? > 2) Also. I think you should change the constructors to be: > > public MyAbstractButton() { > this(null); > } > > public MyAbstractButton(String text) { > super(text); > addActionListener(this); > } > > > Paul Franz > > ----- Original Message ----- > From: "David Treves" <[EMAIL PROTECTED]> > Date: Sun, 9 Jun 2002 12:05:16 +0200 > To: "JDJList" <[EMAIL PROTECTED]> > Subject: [jdjlist] Re: 2 SWING questions > > > > Hi Paul, > > > > One more interesting fact, if I repaint() the whole frame as a final step in > > the construction it sets the button's font to BOLD... > > > > I have no idea why it is running that way... > > > > Here is the button's creation code: > > > > //SNIPPET 1 - abstract button which handles it's own action event > > abstract public class MyAbstractButton extends JButton implements > > ActionListener{ > > public MyAbstractButton() { > > super(); > > addActionListener(this); > > } > > > > public MyAbstractButton(String text) { > > this(); > > setText(text); > > } > > > > abstract public void actionPerformed(ActionEvent e); > > } > > > > //------------------------ > > > > //SNIPPET 2 - adding an instance of MyAbstractButton to a container > > JPanel south = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 10)); > > south.add(new MyAbstractButton("Add Message") { > > public void actionPerformed(ActionEvent e) { > > addMessage(); > > } > > }); > > > > //----------------------- END > > > > What do you think? I believe that you will conclude that this is a normal > > implementation of buttons... > > > > :o) > > > > Waiting for your reply. > > David Treves. > > > > > > > > ----- Original Message ----- > > From: "Paul Franz" <[EMAIL PROTECTED]> > > To: "JDJList" <[EMAIL PROTECTED]> > > Sent: Thursday, June 06, 2002 7:43 PM > > Subject: [jdjlist] Re: 2 SWING questions > > > > > > > Can you post some sample code showing it? Because, I have yet to see this. > > > > > > Paul Franz > > > > > > ----- Original Message ----- > > > From: "David Treves" <[EMAIL PROTECTED]> > > > Date: Thu, 6 Jun 2002 17:02:52 +0200 > > > To: "JDJList" <[EMAIL PROTECTED]> > > > Subject: [jdjlist] Re: 2 SWING questions > > > > > > > > > > Nope, I am simply creating a new JButton and add it to the container. > > The > > > > behavior is abnormal since it is not consistent, sometimes (and I could > > not > > > > determine what causes it) the button's font is PLAIN and when the mouse > > > > hovers on it for the first time it becomes BOLD and stays that way... > > > > > > > > Is that a bug? Did you happen to encounter that behavior as well? > > > > > > > > (I am using jdk 1.3.1_01 on w2k box). > > > > > > > > Thanks, > > > > David Treves. > > > > > > > > > > > > ----- Original Message ----- > > > > From: "Paul Franz" <[EMAIL PROTECTED]> > > > > To: "JDJList" <[EMAIL PROTECTED]> > > > > Sent: Thursday, June 06, 2002 3:22 PM > > > > Subject: [jdjlist] Re: 2 SWING questions > > > > > > > > > > > > > Hmmm, I just checked out the source code for the Metal L&F and the > > real > > > > question I have is how is the Font being set to Font.PLAIN anyway? The > > > > reason I ask is that the default is Font.BOLD for all of the component > > text. > > > > Are you setting the font of the component to be Font.PLAIN? > > > > > > > > > > Paul Franz > > > > > > > > > > ----- Original Message ----- > > > > > From: "David Treves" <[EMAIL PROTECTED]> > > > > > Date: Thu, 6 Jun 2002 16:06:56 +0200 > > > > > To: "JDJList" <[EMAIL PROTECTED]> > > > > > Subject: [jdjlist] Re: 2 SWING questions > > > > > > > > > > > > > > > > Hi Paul, > > > > > > > > > > > > First, no question is stupid, since that situation is strange so > > > > anything > > > > > > can be... ;o) > > > > > > > > > > > > No, I use pure SWING (J)components only, and yes, I am using the > > default > > > > > > buttons, no home made components here. > > > > > > > > > > > > Any ideas? > > > > > > > > > > > > > > > > > > Thanks, > > > > > > David Treves. > > > > > > > > > > > > ----- Original Message ----- > > > > > > From: "Paul Franz" <[EMAIL PROTECTED]> > > > > > > To: "JDJList" <[EMAIL PROTECTED]> > > > > > > Sent: Thursday, June 06, 2002 3:04 PM > > > > > > Subject: [jdjlist] Re: 2 SWING questions > > > > > > > > > > > > > > > > > > > Here is a stupid question for ya: Are you using AWT components and > > > > Swing > > > > > > components together? Also, are you setting a default button? > > > > > > > > > > > > > > Paul Franz > > > > > > > > > > > > > > ----- Original Message ----- > > > > > > > From: "David Treves" <[EMAIL PROTECTED]> > > > > > > > Date: Thu, 6 Jun 2002 08:28:16 +0200 > > > > > > > To: "JDJList" <[EMAIL PROTECTED]> > > > > > > > Subject: [jdjlist] Re: 2 SWING questions > > > > > > > > > > > > > > > > > > > > > > Hi there, > > > > > > > > > > > > > > > > Yes, if I repaint the component it will make the font bold, but > > it > > > > is a > > > > > > funny behavior... Is it a bug or a coding error? > > > > > > > > > > > > > > > > David. > > > > > > > > ----- Original Message ----- > > > > > > > > From: [EMAIL PROTECTED] > > > > > > > > To: JDJList > > > > > > > > Sent: Wednesday, June 05, 2002 3:40 PM > > > > > > > > Subject: [jdjlist] Re: 2 SWING questions > > > > > > > > > > > > > > > > > > > > > > > > In reference to question #1 have you tried repainting the > > button. > > > > I've > > > > > > had this problem several times with different types of components. > > > > > > > > To change your membership options, refer to: > > > > > > > > http://www.sys-con.com/java/list.cfm > > > > > > > > > > > > > > > > To change your membership options, refer to: > > > > > > > > http://www.sys-con.com/java/list.cfm > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > _______________________________________________ > > > > > > > Sign-up for your own FREE Personalized E-mail at Email.com > > > > > > > http://www.email.com/?sr=signup > > > > > > > > > > > > > > > > > > > > > To change your membership options, refer to: > > > > > > > http://www.sys-con.com/java/list.cfm > > > > > > > > > > > > > > > > > > To change your membership options, refer to: > > > > > > http://www.sys-con.com/java/list.cfm > > > > > > > > > > > > > > > > > > > > > > -- > > > > > _______________________________________________ > > > > > Sign-up for your own FREE Personalized E-mail at Email.com > > > > > http://www.email.com/?sr=signup > > > > > > > > > > > > > > > To change your membership options, refer to: > > > > > http://www.sys-con.com/java/list.cfm > > > > > > > > > > > > To change your membership options, refer to: > > > > http://www.sys-con.com/java/list.cfm > > > > > > > > > > > > > > -- > > > _______________________________________________ > > > Sign-up for your own FREE Personalized E-mail at Email.com > > > http://www.email.com/?sr=signup > > > > > > > > > To change your membership options, refer to: > > > http://www.sys-con.com/java/list.cfm > > > > > > To change your membership options, refer to: > > http://www.sys-con.com/java/list.cfm > > > > > > -- > _______________________________________________ > Sign-up for your own FREE Personalized E-mail at Email.com > http://www.email.com/?sr=signup > > > To change your membership options, refer to: > http://www.sys-con.com/java/list.cfm To change your membership options, refer to: http://www.sys-con.com/java/list.cfm To change your membership options, refer to: http://www.sys-con.com/java/list.cfm