Mouse over labels similar to IE toolbar

I'd like to have a couple of labels, say B(bold), I(italic) and U(underline), when you put mouse over, it will raise and when you press or click, it will sink, but the label position should remain SAME all the time.
I have my sample codes below which does this, the only thing that doesn't work is that the label position tends to change. Any ideas or solutions?
import java.awt.event.*;
public class Test extends JPanel {
     JLabel b, i, u;
     Test() {
          setLayout( new BorderLayout() );
          JPanel np = new JPanel( );
          JPanel sp = new JPanel( new GridLayout(0,3) );
          b = createLabel("B", "Bold");
          i = createLabel("I","Italic");
          u = createLabel("U", "Underline");
          sp.add( b );
          sp.add( i );
          sp.add( u );
          np.add( sp );
          np.add( new JButton("OK") );
          add( np, BorderLayout.NORTH );
          JTextArea ta = new JTextArea(20,30);
          add( new JScrollPane( ta ), BorderLayout.CENTER );
     JLabel createLabel(String text, String tip) {
          JLabel l = new JLabel( text );
          l.setName("UNCLICKED");
          l.setToolTipText( tip );
          l.setHorizontalAlignment(JLabel.CENTER );
          l.setBorder( BorderFactory.createEmptyBorder(10,10,10,10) );
          l.addMouseListener( new MouseAdapter( ) {
               public void mouseEntered(MouseEvent e) {
                    JLabel l = (JLabel) e.getSource();
                    if ( "UNCLICKED".equals( l.getName() ) ) {
                         l.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createRaisedBevelBorder(), BorderFactory.createEmptyBorder(10,10,10,10) ) );
               public void mouseExited( MouseEvent e) {
                    JLabel l = (JLabel) e.getSource();
                    if ( "UNCLICKED".equals( l.getName() ) ) {
                         l.setBorder( BorderFactory.createEmptyBorder(10, 10, 10, 10) );
               public void mousePressed( MouseEvent e ) {
                    JLabel l = (JLabel) e.getSource();
                    if ( "UNCLICKED".equals( l.getName() ) ) {
                         l.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createLoweredBevelBorder(), BorderFactory.createEmptyBorder(10, 10, 10, 10) ) );
               public void mouseClicked( MouseEvent e ) {
                    JLabel l = (JLabel) e.getSource();
                    System.out.println("clicked with name " + l.getName() );
                    if ( "UNCLICKED".equals( l.getName() ) ) {
                         l.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createLoweredBevelBorder(), BorderFactory.createEmptyBorder(10, 10, 10, 10) ) );
                         l.setName("CLICKED");
                    }else {
                         l.setBorder( BorderFactory.createEmptyBorder(10,10,10,10) );
                         l.setName("UNCLICKED");
          return l;
     public static void main(String args[] ) {
          JFrame f = new JFrame();
          f.setContentPane( new Test() );
          f.pack();
          f.setVisible(true);
}

I think the text moving because you sometimes use compoundBorder, sometimes use emptyBorder. Those borders have different thickness, and your text is squeezed.
Maybe you can try make your emptyBorder a little bit thicker, like (12, 12, 12, 12), see whether it can solve the problem.

Similar Messages

  • Mouse-Over Labels sometimes truncated (bug fix requested)

    Hello,
    In both Xcelsius 2008 and all subsequent fixes, the Mouse-Over labels are sometimes truncated.  It happens when I have a text category that could be translated as a number.  For example, if I name a category "1E" ("1E" is a type of problem that our department is tracking) then when I hover the mouse over the pie chart it will just say "1" as the category name.  "1A", "1F", etc work which would lead me to believe that it perceives "1E" to be the same as the exponential 1*10^1, which is why it is showing "1".  It happens even if the categories are specified as text.  I think this is a bug that should be addressed in the upcoming SP2.

    Hi,
       What version of Xcelsius and LiveOffice do you have in place?
       Also, did you actually raise an SAP ticket and recieve an confirmation from Support Engineer (via ADAPT) that a developer will look into it last year? Please note, nothing will get fix unless it is logged under the proper channel.
       From what I can see, this is the only relevant ADAPT similar to yours (KBArticle 1403226 - See below). Although this doesn't mention anything about Mouse-Over Labels. Hope it helps.
    Symptom
    Character 'e' which behind the numbers (like 1e) will be lost after refreshing Live Office objects
    Reproducing the Issue
    Create a table in SQL server, add some columns with nchar(10) type
    In this table, add some records with value like '1e', '1389e'
    Create a Universe based on this table
    Create a Webi report based on this Universe
    Create a Live Office object based on this Webi report
    Create an Xcelsius dashboard, and use Spreadsheet Table to show this Live Office object
    Choose 'refresh on load' or add a refresh button to refresh this connection
    You wiil find the character 'e' which behind the numbers (like 1e) will be lost
    (For detail information about the reproduce steps, please refer to attached doc with some screenshots)
    Cause
    The issue has been identified and logged under Problem Report ID ADAPT01296829 (Xcelsius side) and ADAPT01290988 (Live Office side)
    Resolution
    Apply fix packages at both Xcelsius and Live Office sides to fix this issue:
    Live Office FP2.3 or SP3
    XCelsius X5 LAFix2.0.3 or Xcelsius SP3
    Regards,
    Ken

  • How to change mouse-over label for a mx:CandleStickChart?

    I have an <mx:CandleStickChart .../> graph and want to change the default
    labels on the mouse-over window.  For example by default, the mouse-over window displays:
      line1: some label
      line2: open: #1
      line3: close: #2
      line4: high:  #3
      line5: low: #4
    I want to change the words "open", "close", "high", "low" to something else.  I optionally want to not show  the "close" line.
    Do you have any suggestions on how to do this?  If you do, please provide a short example.
    Thanks for taking the time to help.

    Hi
    First change the name from kPlusIconPNGIconRsrcID to kPlusIconPNGIconIRsrcID
    so "I" will indicate that your icon is inactive
    Create another resource id like:
    #define kPlusIconPNGIconIRsrcID 15
    #define kPlusIconPNGIconARsrcID 15
    Define paths to the icons
    resource PNGA(kPlusIconPNGIconIRsrcID) "../res/icons/PLUS_ICO_23_I.png" // Inactive icon
    resource PNGR(kPlusIconPNGIconARsrcID) "../res/icons/PLUS_ICO_23_A.png" // Active icon
    Regards
    Bartek

  • In firefox, whenever i have my mouse over the page (not the toolbar section), any selection i have moves. For example - a text entry box and the cursor keeps returning to the start of the box. This is only in firefox, everything else works fine (IE and Ch

    I have an issue with FF. Whenever I have my mouse on the page (not the toolbar area) any selection I make gets altered in the following way:-
    Text boxes - The cursor keeps moving to the left.
    "Radio" buttons - Selection keeps moving up.
    This is only happening in FF, I am not seeing this behaviour in Chrome or IE.
    == This happened ==
    Every time Firefox opened

    Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]
    If it does work in Safe-mode then disable all your extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    You can use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.
    You have to close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")

  • Mouse over pop up - not sticky note-can it be done?

    I am curious if there is a feature in Acrobat where by mousing over an area you can get a pop-up that provides information about the area you have moused over - much as you get when you hold the mouse over an item in the toolbar. I have looked and tried but, other than sticky notes-which are not really what I want - I have found nothing.
    Is that possible in Acrobat?
    Would appreciate any info or ideas.
    Joe

    You can use the button tool to create a button and in the properties add a tooltip. That will show on mouseover.
    Be sure and set the properties with no fill or border so it won't be visible.

  • Mouse Over Toolbar In Forms 4.5 and Registry stuff too

    Is it possible to create an MS Office 97 /ie3/ie4 type of mouse
    over toolbar in forms 4.5.....
    I'm trying (with litlle success) to use images as buttons ...
    unfortunately i have a lot of problems
    1. each button has 4 states: flat, up, down, disabled... which
    leads to 4 bitmaps...... 16 buttons * 4 bitmaps = 64 bitmaps to
    be loading depending on what buttons are doing....
    2. 1 could be solve by an array of images ( i think.... )
    which would be loaded at runtime and swapped into the buttons as
    i'd go.....
    3. programming all those triggers... to deal with the mouse
    states is very labourious and tricky (so what) but also i would
    think quite ineffient.......
    so if anyone could help me i'd really appreciate it
    Also... does forms 5 maybe suppourt mouse over toolbars????
    and lastly..... does oracle provide any mechanism for reading
    from the windows registry..... to allow username and company
    name to be extracted at runtime for use in a splash screen a la
    MS word/excel/vis c++ etc
    all help would be greatly appreciated....
    Thanks
    John Lanigan
    Core.
    null

    1. Check the tnsnames entry in forms 4.5 and 10g home
    2 open a command/dos prompt
    set the ORACLE_HOME (eg set %ORACLE_HOME%=C:\dev10g
    set the TNS_ADMIN
    3 Run tnsping <Enter your hostname>
    4 Also check if you have recently installed any virus scanner /any other appln
    5 Also run sqlplus from the command/dos prompt
    Rajesh Alex

  • How can I restore full webpages being shown when I run my mouse over the Mozilla icon on the toolbar?la

    Prior to today, when I ran my mouse over the Firefox icon on the tool bar I would get an image of whatever web page I had opened. Now, all I get is text. For example, if I had the BBC open, I could see the open web page by touching the Firefox icon with my mouse. Now all I get is test saying "BBC Player..." Whass up?

    You can check the <b>browser.taskbar.previews.*</b> prefs on the <b>about:config</b> page.
    *http://kb.mozillazine.org/about:config

  • How to make yellow dialog box not come up when I mouse over tabs?

    I hate the little small yellow background colored dialog box that pops up when you mouse over tabs on Firefox on Mac.
    The reason why this is an in convenience on the Firefox in Mac is when a dialog box comes up and you minimize Firefox the dialog box stays there on the screen, so you have to bring Firefox to the front and then mouse over it til the box go's away, and then finally you can minimize Firefox without having the dialog box stay on your screen.
    To negate this problem I want to know if their is a way for me to disable that dialog box from coming up at all. It also comes up when I mouse over my all in one sidebar add on and I have noticed it when you mouseover links on certain sites, like in Pandora when I am mousing over the different artists in my list the little box comes up, again it's not needed and very annoying.

    you must modify '''browser.chrome.toolbar_tips'''
    type in the address bar '''about:config'''
    then press the button''' i'll be careful i promise'''
    then type in the bar '''browser.chrome.toolbar_tips'''
    then '''Double-click''' on it, to make it''' false'''
    exit firefox and restart-it.
    See for more info : [http://kb.mozillazine.org/Browser.chrome.toolbar_tips Browser.chrome.toolbar tips ]
    thank you
    Please mark "Solved" the answer that really solve the problem, to help others with a similar problem.

  • One more nugget: Chart zoom with the "Mouse Over" effect

    Hello all.
    Just read my signature first, it might explain a lot. I do not intend to compete with Darren and I don't think this "nugget" (at least it supposed to be one) will amaze any of the LV veterans and this forum is rich of them. But maybe it will bring some new ideas to some of you or maybe it will be useful for some LV beginners (like me). It is very likely, my code will have some lapses, but please be gentle pointing that out to me. If you feel a need, you can always optimize the code and develope it further. Just don't forget to share!
    So back to the point.
    I am developing a project using LV. In my program there is a waveform chart which has to show 4 plots. Depending on the length of the X Scale, it sometimes gets hard to see the plots clearly because of their density.So I decided that I need a tool, which would zoom the chart in. And this is what I have came up with after a few "Google" searches to check which part of the bike is already invented and also a bit of programming by myself. 
    Maybe you guys (at least the veterans) know the BetterVIEW Consulting LV example where they have implemented the Mouse Over effect. So a part of their example has been used in this tool and part of the credit must go to them. I thank them a lot
    This tool uses a cluster and its property of visibility to show/hide the cluster depending on if the current position of the mouse cursor is in the desired range or not. The program also gets the image of the chart and returns the subset of the image. The subset is taken for the area arounf the mouse cursor. So if you move the mouse, the zoomed in area will also chage in response. After that, the subset of the image is zoomed in for better view. 
    The user might chage the zoom factor during the execution. Also it is possible to turn the zoom option On or Off if you don't wish to see it for the moment. 
    This is how the front panel looks like:
    And this is the image of the block diagram (see the attached files for the vi, the VI Snippet tool distorts the code too much, so I haven't added it):
    I haven't found anything the same in the forum. Yet I'm a newbie here and I don't have that much experience surfing it. If it wouldn't be something new (in the forum, not necessarily to some of you personally), just ignore the thread. I hope this was worth your time and your attention. 
    Good coding
    Message Edited by Giedrius.S on 02-11-2010 12:46 PM
    While evaluating my code please have in mind that I am a LV novice. Therefore sometimes my code might violate some coding rules that I have to learn about myself. But how else could I do that...
    Chart zoom with "Mouse Over" effect
    Attachments:
    Zoom.vi ‏198 KB
    Mouse_pos.vi ‏20 KB
    Check_pos.vi ‏18 KB

    Very nice Giedrius.
    It takes guts to "step up to the chalk board" so I will do what i can to give you some ideas to think about. This is similar to the type of feedback I offer durring our in-house code reviews.
    1) The floating property nodes outside the loop are not sequenced by wires so they could execute after the loop starts. Sometimes this could cause weird errors. Seq with the error cluster.
    2) Property nodes can be re-sized so you can apply more than one property setting in the same call. Property node have to execute in the UI thread (which is single threaded) so using a single nodes will force a single context switch rather than one for each.
    3) Setting the same property repeatedly in a loop just burns CPU. THe Scale min for both X an Y can be moved outside the loop ?
    4) THe Wait Until Next ms" function does not get used in any of my code. It is not a way to get a fixed wait but rather a random wait. If you code completes 1 ms after the next multiple, the delay is double less 1 ms. If you have multiple loops using them and it f the delay for each are not unique prime numbers, then the "Wait until next ms multiple" is a good (cough cough) way of getting them all to wake up at the same time and fight for the CPU.
    5)An Event Struture to monitor mouse enter/leave and mouse move (this would have to be a sepearte loop) is easier on the CPU than polling.
    6) Is that math in the case to handle the Chart position on the FP? If so then using the property nodes for the chart to find its postion will let you code adapt to GUI changes.
    7) Right to left wires are not well recieved.
    8) A Bundle by Name is prefered over a "Bundle" since it is self documenting. I know the Picture function so I can see that is the rectangle you are specifying but reader not famliar with that function would not be able to "READ" the code without poking at it.
    9) THe event structure would also help with setting the Zoom factor. Only poke it when you have to.
    That is all that comes to mind at the moment.
    Again thank you!
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Can I have a mouse-over function to play sound?

    Hello all,
    I have a flash graphic here www.stainlessrhino.com top left
    corner. What I would like is for the graphic to play (soundless as
    it does now) when the page is loaded, however, if the user mouse
    over the swf a sound would play once. How would I accomplish this?
    Is it possible?
    Thank you!

    There are several ways to do this. The easiest way is to
    attach the sound to the graphic. Do this by editing the object you
    want, create a layer called sounds. Click on the first frame you
    want the sound to play in, press F6 to create a keyframe. Click in
    that keyframe and look in the Properties window. In the box labeled
    "Sound:" (go figure) you select the sound you want to play.
    If you are using a roll-over listener you can use the
    Sound.play() method to play the sound in the function. AS3.0
    example:
    myGraphic.addEventListener(MouseEvent.ROLL_OVER,
    myOverFunction);
    function myOverFunction(event:MouseEvent):void{
    play.sound(mySound);
    I recommend searching for "Playing Sounds" in the help
    documentation (F1).

  • Mouse Over Behaviour

    I am currently developing a toolbar application and have an
    issue with mouse events.
    Currently there is a parent canvas which has a mouseOut event
    where the canvas is hidden. Within that canvas there is a Hbox
    which contains images which have an mouse click event. When I mouse
    over the image it triggers the parent MouseOut event.
    having looked at
    http://nondocs.blogspot.com/2007/04/flexfaqmouseevents.html
    but it does not resolve the problem. having also tried to identify
    the event.target.id but it does not register for the imagme
    mouseOver and gives exception errors.
    Anybody got any ideas for the HBox child does not trigger the
    MouseOut event. Also tried switching it to a button.
    I would really like to not have to hack a solution with using
    the mouse x and y coordinates.
    Hope somebody can help Im going round in circles.
    Thanks

    The mouse events are very low-level and fire in unexpected
    ways.
    Usually you should use the rollOver and rollOut events. The
    seem to be better behaved.
    Tracy

  • Mouse Over Value in Pie Chart

    I have two questions -
    1. How do i restrict the no. of decimals in the Mouse Over values for Percentage in a Pie Chart ? The numeric values i can control but the percentage (which the system calculates) seems to be set at default two decimal places.
    2. While displaying the labels even though i am using the ouside end, inside end etc options - i can't seem to control the overlapping of a few labels. Offsetting is something that i need to do by hit and trial. too slow. and not all need to be offsetted. Can i selectively offset for a data point ?
    Please help....Cheers...

    Hi:
       For question1, do you mean the "Data Label->Percentage" right? I think the "Mouse-Over Values" could be set decimal places easily from  "Appearance->Text->Mouse-Over Values", but for "Data Label->Percentage" there is no direct way to show its decimal places. You can use "Label" component to build your percentage you like manually.
      For question2, if all position setting could not fit your need, you can also use label component to build your custom Data Labels.

  • Problem with mouse-over value on a column chart (by Series)

    Hi.
    First of all thanks for any offered tip.
    I am having a problem with a column chart.
    When I move the mouse over a column it should show a small pop-up (or tip) with the column name (series name) and the value (series value). The problem is that it displays an extra '1' just like the following:
    SeriesName
    1
    X.XXX
    How can I remove the extra '1' and only show the name and the value ?
    The data is populated by series (manually added).
    Mihai.

    Hi,
    Thanks for the tip Shanthakumar KA.
    Yes. It looks like the '1' is coming from the X Axis labels. The chart that I have built does not require any labels on the X Axis, so this was not set (X-Axis labels: Empty). I tried setting this to an empty cell, but the '1' still appears in the mouse-over tip.
    It is very weird. If I leave the X-Axis labels empty, I still get the '1' displayed which is very annoing.
    Are there any solutions for this except the re-building the tip with a label a.k.a. '[customize the mouse over values|http://xcelsiusandme.blogspot.com/2009/07/xm-sample-7-customizing-mouse-over.html].'
    Regards,
    Mihai.

  • I'm using Firefox on a Windows 7 OS, and I want to know how to disable the small window that appears when I hover my mouse over a tab, bookmark, etc.

    Okay, so when I'm using Firefox, say I have multiple window open, I hover my mouse over a window's panel at the bottom of the screen and a small box appears telling me about the webpage on that panel. The same thing occurs when I hover over a tab or a bookmark, it's very annoying and frequently blocks my cursor when I'm trying to work. How can I disable this feature?

    I do not use Adobe Reader, but use Foxit Reader in its place, and had the same problem. In Foxit Reader, I right-clicked in the area at the top where you would expect the toolbar to be (it was a blank area immediately above the displayed PDF file), and chose which toolbars to display and that has "stuck" and I still see the Foxit toolbars when I load a PDF file after system shutdown overnight. The only problem is that the area where you would expect the toolbars is still there and blank, but the toolbars that I selected appear immediately below that blank area. See if that works in Adobe Reader for you.

  • How to get text when mousing over image?

    Hey there, I am extremely new to Flash, but know other Adobe programs so tend to learn quickly.
    I desperately need to find out how to get text to pop up when i mouse over PART of the image and i havent been able to find any help online in the last two days (pulling my hair out in stress).
    Now i uploaded a rough mock up i did on Photoshop, so you can see when i mouseover the top layer of the cake i need a line to stretch out and the text to pop up at the end of it. Similarly if i moused over the cherry another piece of text needs to come up in the same manor.
    Also since i need it to be a website link so what format do i open it with when i go to FILE- NEW?
    Honestly thank you so much in advance to anyone that helps

    First you have to choose if you want to handle devices. If not and you want to stay in Flash I'll stick on topic.
    In the HTML version you could either use a good old fashioned image map (they're still fine in the HTML5 era) or you could use a layering technique (here's a random layering example).
    In Flash you can do it a few different ways. If you intend on keeping the image intact as a single object then you'll be essentially doing the same as an image map. You can draw invisible hitareas on the various parts of the object and have those areas trigger a specific function that will display your text. If you break up the image into the separate parts then you can directly assign those parts to fire off a function themselves.
    First I'd like to know your desired direction.

Maybe you are looking for

  • Password doesn't work after time machine recovery!

    My hard drive failed.  Got a new one installed.  Re-installed Mac OSX 10.4 from my original disks.  Then upgraded to Leopard with my upgrade disk.  Used Migration Assistant to bring over my old files etc from Time Machine...  When I used Migration As

  • CD Playback Issues

    Hi, I'm using iTunes 7.5 and I've been having trouble playing CDs using it (I'm not trying to import them, just play them). It plays the first two tracks, then suddenly stops. When I try to start the third track, iTunes stops responding. I have to fo

  • Is chaining pageflow actions allowed?

    Hi, I have 2 different actions which chain to a third action (which seperates the common logic): @jpf:forward name="success" path="showBookList.do" addBookToList(BookDetailsForm form) { // add a book return new Forward("success"); @jpf:forward name="

  • My nokia e 90 wont trun on

    hi all          i was updating the software for nokia e90 ,during updating i dont know how it trun off. i am trying to trun on it but it wont plz help me in this matter regards

  • TM on transplanted drive

    I recently had to have my internal hard drives moved to a new macpro (some sort of ram trouble). So my old drives are in the new computer -- and all my files and apps are fine. But time machine does not recognize my original backups. It's trying to s