Click to See Complete Forum and Search --> : Status Bar - How to ?


DeviPrasad
August 13th, 1999, 09:36 AM
hai,
I would like to display some help information on a component (lets us say a custom Status Bar) as the cursor moves over a MenuItem. How can this be done ?

Keep smiling!!!
Keep working hard!!!
Keep climbing high!!!

Sameet Nasnodkar
August 13th, 1999, 11:39 PM
you could try the mouseMove method in Java 1.0 or the MouseMotionListener in Java 1.1 or Java 2.

Sameet Nasnodkar
Senior Executive - Web Development
AFL Limited

DeviPrasad
August 16th, 1999, 11:18 PM
hai,
Regarding ur answer to my question (regarding displaying a message in the status bar when the mouse moves
over a menu item), the method u suggested, i feel, is not feasible. This is because, u can add listeners only to
to a Compoent. In my case, a MenuItem is not derived from Component. Hence the compiler will report as
there is no method called addMouseMotionListener(...) in MenuComponent, or MenuItem or Menu.
thanx,
Devi Prasad M. P.

Keep smiling!!!
Keep working hard!!!
Keep climbing high!!!

unicman
August 17th, 1999, 12:09 AM
I read the documentation for MenuItem. I couldn't figure out if we will get focus events for MenuItem.

If u want to show help regarding a component or a menuitem
(provided u get focus event for it), u can just set the text in the
status-bar on the focus gained event.

- UnicMan
http://members.tripod.com/unicman

August 17th, 1999, 02:06 AM
Hi,
This is just a suggestion. U have the processEvent() method there in MenuComponent. Override the method in the class whi

August 17th, 1999, 03:58 AM
Sorry cant read the other replies to this but you could try something like this

1. for each awt class (TextField etc) that you wish to recieve feedback on create new class which extends it and adds only a single String which will contain description . Update the constructors to set this string and add a getDesc() function to retrieve it.

2. AddFocusListener Handlers in form which contains components.
rInhalerY.addFocusListener(this);

3. add this code to focusGained() // Nothing required in FocusLost() by the way
e.g public void focusGained(FocusEvent fe)
{
if(fe.getSource() instanceof MyTextField)
{
MyTextField tField = (MyTextField) fe.getSource();
theBar.setSBar(tField.getDesc());
tField.selectAll();
}

else if(fe.getSource() instanceof MyButton)
{
MyButton mBut = (MyButton) fe.getSource();
theBar.setSBar(mBut.getDesc());
}

else if(fe.getSource() instanceof MyCheckbox)
{
MyCheckbox cBox = (MyCheckbox) fe.getSource();
theBar.setSBar(cBox.getDesc());
}
}
5. Make sure you have created the actual Status Bar component / could be panel etc, with Label on it.

Hope this was of help my Man. Please ignore if not.
Rory Shearer
rshearer@computing.dundee.ac.uk