Article View: aus.computers.java
Article #1171Re: Beginner Needs Help: Trying to get a Text Editor going
From: P.Sarat Chandra Sai
Date: Mon, 28 Jun 1999 00:00
Date: Mon, 28 Jun 1999 00:00
73 lines
3415 bytes
3415 bytes
Real tricky question you got. I took me too much time to figure out
what was wrong. I couldnt figure out at first but finally I got this
idea. As far as the code is concerned it is fine. But when you say
fontPlain.addActionListener(this) , there lies the problem. Does your
application or applet or class which includes the initialization
implements the ActionListener Interface? Otherwise try doing it. But
then as you say the code compiles well, then there should be no
problem. But check this out and if it does not work, I got another
solution. But that afterwards.If this aint working send me the code in
mail and I will fix it up for you.
In article <930523282.266344@Chaos.es.co.nz>,
"Michael Rowlands" <michaelrowlands@bigfoot.com> wrote:
> Hi,
> I am trying to get a text editor going and I am having a few problems
with
> CheckboxMenuItem, I want to create a CheckboxMenuItem which allows
the user
> to select if the font is plain,bold, or italic and to deselect plan
if
> italic or bold is select and vice versa.
> The code complies but when I click on plain for instance italic and
bold are
> still ticked. I have used the following code (all of my code is in
the
> attachment)
>
> public void itemStateChanged(ItemEvent event) /*also tried same code
in
> public void actionPerformed
> (ActionEvent e)*/
>
> CheckboxMenuItem item = (CheckboxMenuItem)event.getSource();
>
> if (item.equals(fontPlain)) file://try putting text strings in i.e.
> "Plain"etc
> fontPlain
> {
> fontPlain.setState(true);
> fontItalic.setState(false);
> fontBold.setState(false);
> repaint(); file://friend suggested
> }
> }
>
> I have declared fontPlain as "private CheckboxMenuItem fontPlain =
new
> CheckboxMenuItem("Plan");" and set it on the menu by
> " MenuItem fontPlain = new CheckboxMenuItem("Plain",true);
file://insure
> that
> var is "true"
> fontPlain.addActionListener(this);
> fontStyle.add(fontPlain);"
> I believe that this is my main problem is that the menu is not
refreshing
> but I do not know how to fix it
>
> Many Thanks
>
> Michael Rowlands
>
>
--
P.Sarat Chandra Sai ,Java Developer ,@urservice
Join <A HREF="http://www.deja.com/~javadev">Java
Developer's Forum</A> to get personal attention
and answers to your doubts by e-mail
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Technical Details
Message-ID:
<7l7gh2$ct2$1@nnrp1.deja.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<930523282.266344@Chaos.es.co.nz>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 113ae9,33f124d302e27e52 X-Google-Attributes: gid113ae9,public X-Google-Thread: 10fd6d,33f124d302e27e52 X-Google-Attributes: gid10fd6d,public X-Google-Thread: 10d6db,33f124d302e27e52 X-Google-Attributes: gid10d6db,public X-Google-Thread: 10a146,33f124d302e27e52 X-Google-Attributes: gid10a146,public From: P.Sarat Chandra Sai <psaratsai@my-deja.com> Subject: Re: Beginner Needs Help: Trying to get a Text Editor going Date: 1999/06/28 Message-ID: <7l7gh2$ct2$1@nnrp1.deja.com> X-Deja-AN: 494698379 References: <930523282.266344@Chaos.es.co.nz> X-Http-Proxy: 1.0 x23.deja.com:80 (Squid/1.1.22) for client 194.170.168.92 Organization: Deja.com - Share what you know. Learn what you don't. X-Article-Creation-Date: Mon Jun 28 09:50:28 1999 GMT Newsgroups: aus.computers.java,comp.lang.java.gui,comp.lang.java.help,comp.lang.java.programmer X-Http-User-Agent: Mozilla/4.51 [en] (Win98; I)