How to show ToolTip on FocusGained event
Situation is like following:
A JTextField has some ToolTip associated with it, I want to show that ToolTip on FocusGained event of that JTextField.
Here it is (note that resource is simply a class file that contains color and font settings -- nohting mysterious):
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class ToolTip extends Canvas {
protected String tip;
protected Component owner;
private Container mainContainer;
private LayoutManager mainLayout;
private boolean shown;
private int VERTICAL_OFFSET,HORIZONTAL_OFFSET,X,Y;
private final int HORIZONTAL_ENLARGE=10;
private FontMetrics fm;
public ToolTip(String tip, Component owner, Container mc, int bp, resource res) {
this.tip=tip;
this.owner=owner;
this.mainContainer=mc;
setBackground(res.ToolTipBGColor);
setForeground(res.ToolTipFGColor);
setFont(res.ToolTipFont);
fm=getFontMetrics(getFont());
X=owner.getLocationOnScreen().x;
Y=owner.getLocationOnScreen().y;
int w=owner.getSize().width;
int h=owner.getSize().height;
if (bp==0) { // top
HORIZONTAL_OFFSET=3;
VERTICAL_OFFSET=h;
} else if (bp==1) { // left
HORIZONTAL_OFFSET=w;
VERTICAL_OFFSET=0;
} else if (bp==2) { // right
HORIZONTAL_OFFSET=-fm.stringWidth(tip)-HORIZONTAL_ENLARGE;
VERTICAL_OFFSET=0;
} else { // bottom
HORIZONTAL_OFFSET=3;
VERTICAL_OFFSET=-fm.getHeight();
owner.addMouseListener(new MAdapter());
public void paint(Graphics g) {
g.drawRect(0,0,getSize().width,getSize().height);
g.drawString(tip,3,getSize().height-3);
private void addToolTip() {
mainContainer.setLayout(null);
setSize(fm.stringWidth(tip)+HORIZONTAL_ENLARGE, fm.getHeight());
setLocation(X-mainContainer.getLocationOnScreen().x+HORIZONTAL_OFFSET,
Y-mainContainer.getLocationOnScreen().y+VERTICAL_OFFSET);
if (mainContainer.getSize().width<(getLocation().x+getSize().width)) {
setLocation(mainContainer.getSize().width-getSize().width, getLocation().y);
mainContainer.add(this,0);
mainContainer.validate();
shown=true;
private void removeToolTip() {
if (shown) {
mainContainer.remove(0);
mainContainer.setLayout(mainLayout);
mainContainer.validate();
shown = false;
class MAdapter extends MouseAdapter {
public void mousePressed(MouseEvent me) {
if (me.getModifiers()==4) {
mainLayout=mainContainer.getLayout();
addToolTip();
me.consume();
public void mouseReleased(MouseEvent me) {
if (shown) removeToolTip();
}If you have problem modifying the code, noah.w is an expert in the GUI stuff, maybe he can help you.
Hope this helps!
;o)
V.V.
Similar Messages
-
How to show tooltip in data grid
I have a data grid .in that for showing toolti i have make showDataTips =true, it shows tooltip at every cell, but i need to hide the tooltip if cell is blank
This is very easy. IN your status field in your internal table, you simply write the icon to it. Make sure that the status field is defined as a character field with a length of 4. Then write the icon to it.
Type-pools: icon.
write icon_green_light as icon to itab-status.
Then when filling the field catalog, set the ICON flag. This puts the icon in the center of the cell in ALV.
xfc-icon = 'X'.
append xfc to ifc.
Regards,
Rich Heilman -
How to show busy times from events in one caldendar in another calendar
Hi all,
I have the following scenario: I am managing two calendars in iCal, one with private events and one with work-related events. The private events are entered manually, the work events are synched with an MS Exchange server. How can I show the times of private events as busy in the work calendar? I want to avoid scheduling conflicts without showing the details of my private events to work contacts.
Cheers,
MHi Brian,
Its possible.
Follow the procedure:
Create a HTML page in KM, which will hold 2 links. Give names to these links and href as follows.
Link1: http://<host>:<port>/irj/portal/iview1
Link2: http://<host>:<port>/irj/portal/iview2
Create KM Document iView (ABC) and provide path to document of this page.
Now create another page in PCD (XYZ), and 2 iviews.
Assign these 2 iViews on this page, but make them invisible on page.
In iView properties change the property Quick Link as follows (as given above):
for iView1: iview1
for iView2: iview2
Now open your role, create folder inside, and add KM Document iView (ABC). Open the properties of this iView in role and change the property, Initial state as Open, now it will open the KM document iView (ABC) in detail nav, and for opening page (XYZ) you must assign page to role, but make Invisible in Navigation areas to YES
i guess this solves your issue.
regards
Kedar Kulkarni
reward points for useful answers -
How to show thumbnails of an event on the same screen?
In the iPhoto tutorial, it shows that when you start in the All Events screen and you double-click on the Event you want to open, what you get is a screen full of thumbnails from that Event. But when I double-click on the Event I want, it just brings me to an enlarged version of that single image, and I have to use left and right arrows to get to other images in that Event. I even went to iPhoto-Preferences-Events and under the option for "Double-click Event" I chose "Shows Event photos" but still all I get is the single image. So, how do I get all the thumbnails of one Event like in the tutorial? Thanks. Franklin
Look to the lower right hand corner of our iPhoto window - the right hand side of the toolbar - the slider there is all the way to the right - move it toward the left until the desired number of thumbnails show.
Larry Nebel -
How to show tooltip on mouse right click...
Hi everyone!
I'm trying to show a tooltip when the user clicks on a button with the mouse right button but I'm having some problems starting, for example, with the tooltip position. For example, look at the the following example(without mouse listener yet):
public class test extends JFrame{
private JToolTip jtp = new JToolTip();
private JButton button = new JButton("a button");
private JPanel panel = new JPanel();
public test(){
add(panel);
panel.add(button);
jtp.setTipText("a tooltip");
jtp.setBounds(10,10,10,10);
jtp.setVisible(true);
panel.add(jtp);
public static void main(String[] args) {
test x = new test();
x.setVisible(true);
}Why the setBounds doesn't set the position? In fact it doesn't do anything.
Is it possible to the tooltip to partially overlap the button. As far I checked they only stay side by side.
I hope you understand my english...
FilipeUse this code to show custom tool tip.
You should also handle the hiding of the tool tip.
JButton button = new JButton("test");
button.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON3) {
JButton button = (JButton) e.getSource();
JToolTip tooltip = button.createToolTip();
PopupFactory popupFactory = PopupFactory.getSharedInstance();
tooltip.setTipText("a tooltip");
final Popup tooltip1 = popupFactory.getPopup(button, tooltip,
button.getLocationOnScreen().x + e.getX(),
button.getLocationOnScreen().y + e.getY() + 20);
tooltip1.show();
}); -
In MONTH, (PC) iCal only clearly lists 2 items a day. The 3rd item is "faded" and bottom portion cut off, w/ a "more" triangle in the lower-right corner. How can I expand (vertically) so the 3rd line posts clearly, and ONLY shows "more" if 4+ events?
Better yet... as there's a lot of "wasted" space w/ too large Month title and empty space surrounding the Month title above and too much space surrounding the month/year slider bar below, how can I minimize these to allow me more usable / valuable calendar "contents" so I don't need to waste so much time clicking "more" just to see the bottom of the truncated third event and find out there are no 4+ events posted that date? i.e. more "user-friendly" presentation?
Thx!
[email protected]In MONTH, (PC) iCal only clearly lists 2 items a day. The 3rd item is "faded" and bottom portion cut off, w/ a "more" triangle in the lower-right corner. How can I expand (vertically) so the 3rd line posts clearly, and ONLY shows "more" if 4+ events?
Better yet... as there's a lot of "wasted" space w/ too large Month title and empty space surrounding the Month title above and too much space surrounding the month/year slider bar below, how can I minimize these to allow me more usable / valuable calendar "contents" so I don't need to waste so much time clicking "more" just to see the bottom of the truncated third event and find out there are no 4+ events posted that date? i.e. more "user-friendly" presentation?
Thx!
[email protected] -
After importing clips to Final Cut, they do not show up in the events library. Events from 2014 show up, but not 2015.They show up in the timeline of my project, though. How can I see them in the events browser?
TThose aren't bins. Those are just groupings based on when the content was created or any other selected parameter. Use the action popup in the toolbar tho change the setting.
-
How do I show imported photos in Events?
I downloaded photos off my camera into iPhoto 9.5.1 (I have just upgraded to this). The photos are showing if I click on "last 12 months" but they are not showing up in Events. How do I get them into events?
I had the older version of iphoto and whenever I downloaded photos off of my camera, they would go directly into events.I had the older version of iphoto and whenever I downloaded photos off of my camera, they would go directly into events.
And they still do
Most likely your camera date is incorrect (correct on the camera - and for photos already imported by selecting the photops and using teh adjust time/date command) or your event sort is incorrect (correct by the view menu ==> sort events)
The photos are showing if I click on "last 12 months" but they are not showing up in Events. How do I get them into events?
Last 12 months is just one of many views of the photos in your library - events are another view - every photo in one view is also in every other view - you are just looking in the wrong place (see above)
LN -
My imported movie shows up in the event library under 2006 date, month of march, the movie name. I want the movie to show up in the event library under the date I choose and the movie name. How do I do this?
rogerhermans wrote:
I did change the name of the event. I cannot change the date of the event in the Modify command. The date and month was selected by the system as I did not name my event to start with. I now want to change the date (from 2006 to 1987) , delete the month and show the event name. I want the event library to post all my events by year (specified by me) and name of event.
you can change the date, so that FCPX categorizes it properly. First delete the clip(s) from FCPX, but not from your computer entirely, make sure you have the originals somewhere.
Open a terminal window and use the following command:
touch -t 198711280800.00 <path/filename of clip>
Where the format is: (use leading zeros if necessary for date & time)
first four digits: year
next four: month and day
next four: time of day (in 24 hour format)
next 2: seconds as a decimal (this is optional, if you leave it off you will get 00 seconds)
The above example will change the file date to Nov. 8, 1987 08:00:00 AM
This will change the created, modified and last access dates of the clip/file.
Then reimport the clip(s) and FCPX should categorize it properly. -
my iphone has calendar history for 10 years. my icloud only shows about 6-8 weeks back. how can i get icloud to show all the calendar events in the past that are on iphone?
I encountered a similar problem when finally (and with much regret) I was obliged to migrate my MobileMe to iCloud last month.
Many years of iCal history vanished without trace during this automated transition by Apple and iCloud then kindly synched the resulting vacuum back to iCal on my Mac.
Fortunately, iCloud wasn’t able to decimate iCal on my other Macs because (1) they are still running Snow and (2) I had switched them off as a precaution. Good job I did.
My solution was to export my iCal data on one of those other Macs to a backup file – then I imported that backup file into my Lion-updated Mac’s iCal. That restored all the iCloud-deleted iCal data back on to my Mac and this was promptly synched automatically to my Calendar on iCloud. So now it’s all there and showing.
Perhaps you could do something similar? In the meantime, be very careful not to let iCloud’s amnesia get synched to your iPhone (and other devices).
Experience has taught me never to trust an “upgrade” until it is proven to be working correctly and always to keep in reserve another Mac with a properly-functioning system and all synching to it switched off... -
In the Alarm & Event Query VI how to show the alarm data
In the Alarm & Event Query VI how to show the alarm data in the front pannel using the table or multicolumn listbox .thank you very much!!!
Hi,
Most likely there is something wrong with your specific database or your LabVIEW DSC installation. I just used the Alarm & Event Query.vi in my machine and it seems to work fine, I can see all the alarms as well as events containned in the database.
You may considerer generate another database (change the logging directory) and see if the behavior goes away. Also, make sure you have alarms and events on that database.
I could run the Alarm & Query.vi by just openning its front panel and placing the correct database in the appropriated control. -
How to show next instance of Recuring Event in Calendar List View
We have a calendar that we are using to display upcoming events. However we are unable to get a clean output of next instance date for recurring events such as paydays or monthly meetings. As opposed to showing next instance it shows the date
the event was originally put in the calendar.
I am guessing it will take a custom script, but I don't even know where to begin with that.Hi Swen,
According to your description, my understanding is that you want to display the recurring events as separated events in the calendar list view.
I recommend to create a Standard View, with Expanded Recurring Events for the calendar list,
and each instance of a recurring event will be showing in this view.
More reference:
http://office.microsoft.com/en-in/sharepoint-server-help/create-change-or-delete-a-view-of-a-list-or-library-HA102774516.aspx#_Toc337729214
Best regards.
Thanks
Victoria Xia
TechNet Community Support -
I have an iMac and a Drobo FS. The iMac can access the Drobo FS but iMovie does not allow me to select it as a storage location. The Drobo shows up in the Events Library but with the yellow triangle. I am running iMovie 08. Any help would be appreciated. Thanks!
As far as I know you cannot use a Drobo FS with iMovie.
For iMovie events the storage drive needs to be formatted as "Mac OSX Extended - Journaled" this is the HFS+ file system.
The Drobo FS uses the EXT3 file system, and it cannot be changed.
Very annoyingly this means that iMovie can only be used with a drive that is using the HFS+ file system.
I have a Drobo FS that I use with both PC's and Macs - and I love it. Sadly I cannot use iMovie with it. So I purchased a seperate Hard Drive - A G-Tech 3 Tb - and this works fine with iMovie.
As far as I know the FS Drobo's are the only ones that cannot be formatted to HFS+.
I don't know why Apple designed iMovie like this, but I find it very frustrating.
If you want extra storage for iMovie, you will need to purchase a drive that can be HFS+ formatted.
Here is a link to the Drobo site with the various file systems that they support:
http://support.drobo.com/app/answers/detail/a_id/29/kw/file%20system
Good luck. -
How To Show Blinking Cursor In Text Input Control
Hi,
How to show blinking cursor in a text input control?
I am using this for login page
Thanks.Hi!
you can try this!
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" horizontalAlign="center">
<mx:VBox horizontalAlign="center" paddingTop="100">
<mx:HBox horizontalAlign="center">
<mx:TextInput id = "textinput1" />
<mx:Spacer width="10"/>
<mx:TextInput id = "textinput2" />
</mx:HBox>
<mx:Spacer height="50"/>
<mx:HBox horizontalAlign="center">
<mx:Button label="setfocus1" click="setTextInputFocus1(event)"/>
<mx:Spacer width="5"/>
<mx:Button label="setfocus2" click="setTextInputFocus2(event)"/>
</mx:HBox>
</mx:VBox>
<mx:Script>
<![CDATA[
private function setTextInputFocus1(evt:Event):void{
textinput1.setFocus();
textinput1.setSelection(textinput1.text.length,textinput1.text.length);
private function setTextInputFocus2(evt:Event):void{
textinput2.setFocus();
textinput2.setSelection(textinput2.text.length,textinput2.text.length);
]]>
</mx:Script>
</mx:Application> -
How to show all items in the reading list? I think this option has been removed in Safari Version 7.0.2
Thanks. That solved it. I had my doubts since I wasn't concerned about my lost bookmarks. I was concerned about the broken functionality. In any event, restoring from a backup solved both the functionality and the lost bookmarks. I appreciate the response!
Maybe you are looking for
-
I run firefox browser on Windows 7. I am trying to synch with my android Galaxy note 3. When I am asked for a recovery key I am directed to pull down the "sync" option an use the choices. But all I pull down is a menu to set up synch. How do I find m
-
RH8 for Word - Strange page breaks and non-scoll headers
RH8 and Word 2007 generating WinHelp 2000. Normal page breaks are full page width. When I insert one in manually, it shows as only 2 inches wide. A tiopic with this short break does not show as a non-scroll header and does not get included in the bro
-
Premiere NEEDS Log and Transfer
Ok, so hear me out. I absolutely understand that Premiere edits almost every single format known to man, however I have one absolutely massive issue with this: Unless you use 2 extra pieces of adobe software (from my knowledge you need to use Prelude
-
Balance in Transaction Currency Error while Running J2IUN
Dear Expert, Hope you all must be doing great. While running the J2IUN transaction, System is generating Balance in Transaction currency becouse Cr PLA HECess repeatation.Here Credit side is 600 higher than Debit entry.please find the details of Acco
-
How to create a iqd in cognos? Which is tool used?
try to answer that question