Article View: aus.computers.java
Article #1170Beginner Needs Help: Trying to get a Text Editor going
From: Michael Rowlands
Date: Mon, 28 Jun 1999 00:00
Date: Mon, 28 Jun 1999 00:00
41 lines
2289 bytes
2289 bytes
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
Technical Details
Message-ID:
<930523282.266344@Chaos.es.co.nz>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 113ae9,33f124d302e27e52,start X-Google-Attributes: gid113ae9,public X-Google-Thread: 10d6db,33f124d302e27e52,start X-Google-Attributes: gid10d6db,public X-Google-Thread: 10a146,33f124d302e27e52,start X-Google-Attributes: gid10a146,public X-Google-Thread: 10fd6d,33f124d302e27e52,start X-Google-Attributes: gid10fd6d,public From: "Michael Rowlands" <michaelrowlands@bigfoot.com> Subject: Beginner Needs Help: Trying to get a Text Editor going Date: 1999/06/28 Message-ID: <930523282.266344@Chaos.es.co.nz> X-Deja-AN: 494560180 Cache-Post-Path: Chaos.es.co.nz!unknown@p43-max6.dun.ihug.co.nz Organization: The Internet Group (Dunedin) X-MSMail-Priority: Normal X-Priority: 3 X-Cache: nntpcache 2.3.3 (see http://www.nntpcache.org/) X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Newsgroups: aus.computers.java,comp.lang.java.gui,comp.lang.java.help,comp.lang.java.programmer