JSlider + Display value in a text tool tip box

Hello,
I am new to Java. I want to display the value in a text tool tip box of the JSlider as the user moves the knob . Is there any way to achieve this.
I tried setting up the value of text tool tip in the stateChanged method. But that didn't helped
Ritesh

Finally Got it working. Below I am attaching the code for reference
Thanks for your code. It came very handy
The only problem is that toolTextTip is appearing on one side rather than below the cursor.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class EventTest
public static void main(String[] args)
JFrame f = new JFrame();
System.out.println("starting application");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(new setSlider(),"North");
JSlider slide = new JSlider();
slide.setToolTipText("Hello");
f.getContentPane().add(slide,"South");
f.setSize(400,400);
f.setLocation(200,200);
f.setVisible(true);
class setSlider extends JSlider implements ChangeListener, MouseMotionListener{
public setSlider(){
setToolTipText("hello " + new Integer(getValue()).toString());
this.setMaximum(10);
this.setMinimum(0);
this.setValue(2);
this.setMajorTickSpacing(2);
this.setMinorTickSpacing(1);
this.setPaintTicks(true);
this.setPaintLabels(false);
this.addMouseMotionListener(this);
this.addChangeListener(this);
public void stateChanged(ChangeEvent e) {
setToolTipText(new Integer(getValue()).toString());
System.out.println(this.getToolTipText());
KeyStroke controlF1 = KeyStroke.getKeyStroke("control F1");
ActionListener toolTipAction = getActionForKeyStroke( controlF1 );     
if (toolTipAction != null)     {          
ActionEvent postTip = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "");
toolTipAction.actionPerformed( postTip );
public void mouseDragged(MouseEvent e){
System.out.println("here");
setToolTipText(new Integer(getValue()).toString());
System.out.println(this.getToolTipText());
KeyStroke controlF1 = KeyStroke.getKeyStroke("control F1");
ActionListener toolTipAction = getActionForKeyStroke( controlF1 );     
if (toolTipAction != null)     {          
ActionEvent postTip = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "");
toolTipAction.actionPerformed( postTip );
public void mouseMoved(MouseEvent e){

Similar Messages

  • Label Text & Tool Tip Text within 9.0.5 dose not work.

    When I set the label or tool tip text within the view objects attribute panel, I do not see those values or tips when my views are displayed. I'm using JDeveloper 9.0.5.
    Thanks

    This is a known issue with the preview release. In the production release, the column headers, message prompts and tips, etc will be EL bound to the values from the model (in the case of BC4J those are the UI Hints).
    In the preview release, you can use the visual editor to change the hardcoded column headers, prompts and tips to the text you desire.

  • Table Output text tool tip does not update on PPR

    We have a adf table with a Lov and a out put text .
    On changing the LOV, the out put text also change . but, on we mouse over on the tool tip does not changed . any suggestions ?
    below code :
    <af:outputText value="#{row.PlanTitle}" id="ot4" partialTriggers="soc3 si2"/>
    However , if we refresh the table or reload after save , the toop tip also get change . but we need to update the tool tip on change the lov . any suggestion ?
    Jdev : 11.1.1.3.0
    browser : all ,

    Hi,
    taking it from:
    +"However , if we refresh the table or reload after save , the toop tip also get change . but we need to update the tool tip on change the lov . any suggestion ? "+
    The autput text component is part of a table ? If so then the table needs to be refreshed as the values in there are stamped. If I am wrong with my table assumption and the output text is part of a form, try setting clientComponent="true" for the output text field
    Frank

  • Alt-text 'tool tip' not appearing on some images

    We get pdf files created by outside sources that we then need to publish on our webpage.  I add tags to the pdf, then add the alt-text to the images via the Touch Up Text tool.  As well as I can determine, the tag for the alt-text is present in the pdf.  The Read Out Loud function in Acrobat reads the alt-text correctly as does a screen reader.  But the 'tool tip' does not appear on all images.  It seems that the more complex, mulitple layered dwg type images do not display the text, either from the browser, or from Acrobat itself.  Other dwg source images do work, and photgraphic images are ok.
    I have gone back through the pdfs to verify the existence of the figure tag, and that the alt-text is there.
    I have opened the tags dialog, looked at the properties, and added the text to the Title field as well as the alt-text and Actual Text.
    I have converted the images to jpgs, which resolves the issue, but greatly reduces the quality of the image.
    I am using Acrobat Pro 8.1.4 on a Windows XP, sp2 system.
    I am aware that the ADA requirement do not require the 'tool-tip' to function, but when you have many, many pages of images in a pdf using a screen reader or the read out loud function to test is not feasible for testing.  We need to have the tool-tip working, and I have run out of ideas on how to make it work.

    I just figured out that those photos had been set to a blending mode of Multiply
    because an earlier iteration of the design used transparency. But to the eye, they
    look like normal photos, so I didn't realize they were set to Multiply.
    This solved the problem but it's not heartening news. What if my graphic legitimately
    did have a blending mode set? What would my workaround be if I needed to set Alt Text
    for those images?

  • Dynamic Values in Business Graphics Tool Tip

    hi,
    I am using business graphics ui element in my webdynpro application.I am able to get the graghical output correctly.I want to have tool tip in my graph so when I place the cursor on a point, the tool tip should give the corresponding value.I have used the following code
    try
         String[] catLabels = {
                        "Team 1", "\1Tomoko Akino", "\1Hans Bosch", "\1Marvin Smith",
                        "Team 2", "\1Jose Vega", "\1Bao Yin", "Out of office" };
            String[][] pointCustomizing = {
                        { "approved", "cancelled", "approvedPartTime" },
                        { "approved" },
                        { "approved" },
                        { "sent", "approvedPartTime", "notsentPartTime", "notsent"},
                        { "approved", "zSeveralEntries", "zSeveralEntries",
                          "zSeveralEntries", "zSeveralEntries", "zSeveralEntries",
                          "zSeveralEntries" },
                        { "outOfOffice", "outOfOffice", "outOfOffice", "outOfOffice",
                          "outOfOffice", "outOfOffice", "outOfOffice", "outOfOffice",
                          "outOfOffice", "outOfOffice", "outOfOffice", "outOfOffice",
                          "outOfOffice", "outOfOffice", "outOfOffice" }
            String[][] pointLabels = {
                        { "1", "2", "2", "2", "4", "3", "3", "3", "1", "1", "2", "1",
                          "2", "1", "1" }
            String[][][] timeValues = {
                        { { "20020528", "20020606" }, { "20020606", "20020608" },
                          { "20020610", "20020611" } },
                        { { "20020531", "20020606" } },
                        { { "20020607", "20020613" } },
                        { { "20020527", "20020601" }, { "20020606", "20020607" },
                          { "20020612", "20020613" }, { "20020617", "20020619"} },
                        { { "20020531", "20020606" }, { "20020531", "20020601" },
                          { "20020601", "20020602" }, { "20020602", "20020603" },
                          { "20020603", "20020604" }, { "20020604", "20020605" },
                          { "20020605", "20020606" } },
                        { { "20020527", "20020528" }, { "20020528", "20020529" },
                          { "20020529", "20020530" }, { "20020530", "20020531" },
                          { "20020531", "20020601" }, { "20020603", "20020604" },
                          { "20020604", "20020605" }, { "20020605", "20020606" },
                          { "20020606", "20020607" }, { "20020607", "20020608" },
                          { "20020610", "20020611" }, { "20020611", "20020612" },
                          { "20020612", "20020613" }, { "20020617", "20020618" },
                          { "20020618", "20020619" }}
            String s[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","a1","a2","a3","a4","a5","a6","a7","a8","a9","a10","a11","a12","a13","a14",};
            IPrivateSBusinessGraphicsSampleView.ICategoryNode catNode = wdContext.nodeCategory();
            for (int catIndex = 0; catIndex < catLabels.length; ++catIndex)
               IPrivateSBusinessGraphicsSampleView.ICategoryElement  catElement = catNode.createCategoryElement();
               catNode.addElement(catElement);
               catElement.setDescription(catLabels[catIndex]);
            // loop over series
            IPrivateSBusinessGraphicsSampleView.ISeriesNode seriesNode = wdContext.nodeSeries();
            for (int seriesIndex = 0; seriesIndex < timeValues.length; ++seriesIndex)
               IPrivateSBusinessGraphicsSampleView.ISeriesElement seriesElement = seriesNode.createSeriesElement();
               seriesNode.addElement(seriesElement);
               // set series attributes (...)
               IPrivateSBusinessGraphicsSampleView.IPointNode pointNode = seriesElement.nodePoint();
               // loop over points
               for (int pointIndex = 0; pointIndex < timeValues[seriesIndex].length; ++pointIndex)
                 IPrivateSBusinessGraphicsSampleView.IPointElement
                           pointElement = pointNode.createPointElement();
                 pointNode.addElement(pointElement); 
                 String ename = s[pointIndex];
                 wdComponentAPI.getMessageManager().reportSuccess("name:"+ename);
                 pointElement.setStartValue(timeValues[seriesIndex][pointIndex][0]);
                 pointElement.setEndValue(timeValues[seriesIndex][pointIndex][1]);
                 pointElement.setCuId(pointCustomizing[seriesIndex][pointIndex]);
                 pointElement.setLabel(pointLabels[seriesIndex][pointIndex]);    
                 pointElement.setToolTip(ename );
         catch(Exception e)
                 wdComponentAPI.getMessageManager().reportSuccess("exc2:"+e);
    By the above code ,I am getting the tool tip with the value "a" in all locations.
    But I need to have different values in the tooltip corresponding to the location.
    Please Help....
    Thanks in advance,
    Shamila

    hi,
    Still  I did not get the dynamic tool tip..........
    In wdDoInit() I have written the following code
    try
         String[] catLabels = { "Team 1", "\1Tomoko Akino", "\1Hans Bosch", "\1Marvin Smith",
                   "Team 2", "\1Jose Vega", "\1Bao Yin", "Out of office" };
            String[][] pointCustomizing = {
                        { "approved", "cancelled", "approvedPartTime" },
                        { "approved" },
                        { "approved" },
                        { "sent", "approvedPartTime", "notsentPartTime", "notsent"},
                        { "approved", "zSeveralEntries", "zSeveralEntries",
                          "zSeveralEntries", "zSeveralEntries", "zSeveralEntries",
                          "zSeveralEntries" },
                        { "outOfOffice", "outOfOffice", "outOfOffice", "outOfOffice",
                          "outOfOffice", "outOfOffice", "outOfOffice", "outOfOffice",
                          "outOfOffice", "outOfOffice", "outOfOffice", "outOfOffice",
                          "outOfOffice", "outOfOffice", "outOfOffice" }  };
                    String[][] pointLabels = {{ " ", " ", " " },{ " " },{ " " },{ " ", " ", " ", " "},{ " ", " ", " ", " ", " ", " ", " " },
                                  { "1", "2", "2", "2", "4", "3", "3", "3", "1", "1", "2", "1", "2", "1", "1" } };
                  String[][][] timeValues = {{        { "20020528", "20020606" },
                          { "20020606", "20020608" },
                          { "20020610", "20020611" } },
                        {  { "20020531", "20020606" } },
                        {   { "20020607", "20020613" }  },
                        {   { "20020527", "20020601" },
                          { "20020606", "20020607" },
                          { "20020612", "20020613" },
                          { "20020617", "20020619"} },
                        { { "20020531", "20020606" }, { "20020531", "20020601" },
                          { "20020601", "20020602" }, { "20020602", "20020603" },
                          { "20020603", "20020604" }, { "20020604", "20020605" },
                          { "20020605", "20020606" } },
                        { { "20020527", "20020528" }, { "20020528", "20020529" },
                          { "20020529", "20020530" }, { "20020530", "20020531" },
                          { "20020531", "20020601" }, { "20020603", "20020604" },
                          { "20020604", "20020605" }, { "20020605", "20020606" },
                          { "20020606", "20020607" }, { "20020607", "20020608" },
                          { "20020610", "20020611" }, { "20020611", "20020612" },
                          { "20020612", "20020613" }, { "20020617", "20020618" },
                          { "20020618", "20020619" }}  };
            String s[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","a1","a2","a3","a4","a5","a6","a7","a8","a9","a10","a11","a12","a13","a14",};
            IPrivateSBusinessGraphicsSampleView.ICategoryNode catNode = wdContext.nodeCategory();
            IPrivateSBusinessGraphicsSampleView.ICategoryElement  catElement;
            for (int catIndex = 0; catIndex < catLabels.length; ++catIndex)
                catElement = catNode.createCategoryElement();
               catNode.addElement(catElement);
               catElement.setDescription(catLabels[catIndex]);
             // loop over series
            IPrivateSBusinessGraphicsSampleView.ISeriesNode seriesNode = wdContext.nodeSeries();
            for (int seriesIndex = 0; seriesIndex < timeValues.length; ++seriesIndex)
               IPrivateSBusinessGraphicsSampleView.ISeriesElement seriesElement = seriesNode.createSeriesElement();
               seriesNode.addElement(seriesElement);
               // set series attributes (...)
               IPrivateSBusinessGraphicsSampleView.IPointNode pointNode = seriesElement.nodePoint();
               IPrivateSBusinessGraphicsSampleView.IPointElement  pointElement;
               // loop over points
               for (int pointIndex = 0; pointIndex < timeValues[seriesIndex].length; pointIndex++)
                 //IPrivateSBusinessGraphicsSampleView.IPointElement
                 pointElement = pointNode.createPointElement();
                 pointNode.addElement(pointElement); 
                 String ename = s[pointIndex];
                  wdComponentAPI.getMessageManager().reportSuccess("name:"+ename);
                 pointElement.setStartValue(timeValues[seriesIndex][pointIndex][0]);
                 pointElement.setEndValue(timeValues[seriesIndex][pointIndex][1]);
                 pointElement.setCuId(pointCustomizing[seriesIndex][pointIndex]);
                 pointElement.setLabel(pointLabels[seriesIndex][pointIndex]);    
                  pointElement.setToolTip(ename );
    catch(Exception e){        wdComponentAPI.getMessageManager().reportSuccess("exc2:"+e);    }
    In wdDoModifyView() I have written the following code
    try
         IWDBusinessGraphics graph = (IWDBusinessGraphics)view.getElement("BusinessGraphics");
         IWDAbstractSeries allSeries[] = graph.getSeriesList();
         IWDSimpleSeries series;
         wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("length : "+allSeries.length+" value:"+allSeries[0]);
         for(int j=0;j<allSeries.length;j++)
           series = (IWDSimpleSeries)allSeries[j];
          for(int i=0;j<wdContext.nodeSeries().size();i++)
              wdContext.nodeSeries().setLeadSelection(i);
              series.setTooltip(series.getValue());
      catch(Exception e)
         wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("exc modify :"+e);
    The node structure is
    Root Node
    >Category>Description
    >Series>Point-->CuId
    >Series>Point-->endvalue
    >Series>Point -->Startvalue
    >Series>Point -->label
    >Series>Point --->Tooltip
    In BusinessGraphis seriesSource-Series node ,tooltip-Series.Point.ToolTip is mapped
    In Category description-Category.Description is mapped
    In Series pointsource-Series.Point, tooltip-series.point.tooltip is mapped
    In Point CustomisingId-eries.point.cuId.label-Series.label, tooltip-series.point.Tooltip,valuesource -series.point is mapped
    In Numericvalue value-series.point.startvalue is mapped
    In Numericvalue value-series.point.endvalue is mapped
    When I deploy my application I am getting <b>java.lang.ClassCastException</b> Exception at the line  <b>series = (IWDSimpleSeries)allSeries[j];</b>
    What is reaseon?.....
    Please help..............
    I want to get dynamic value in the tool tip of the graph.
    Thanks in advance,
    Shamila,

  • How to get the display value of selected item in list box?

    I have a page with an HtmlSelectOneListbox that is filled with an ArrayList of SelectItem objects.
    The SelectItem objects contain a Key and Value. The Value is displayed in the ListBox.
    The value parameter of the listbox is bound to a bean property which is called selectedListItem.
    The bean property selectedListItem contains the Key of the SelectItem that is selected.
    How do I obtain the Value of the selectedListItem?
    I need to be able to get the Value field that is displayed, not just the Key to the item that is displayed.
    Edited by: burferd on Nov 3, 2007 10:03 PM

    How are you filling in the value of the menu? Obtain it back by the same way. Or pass it along the key in a object.
    This article may give useful insights: http://balusc.blogspot.com/2007/09/objects-in-hselectonemenu.html

  • Showing dynamic text on tool tip

    Hi Gurus,
    I have the following requirements :
    In our system we have to show the Hijri dates for the corresponding Gregorian Date in Standard Oralce Self Service Forms on Mouse Over of that text as tool tip or by some other means.
    Can anyone suggest solution for this.
    In custom table we have stored Hirji and corresponding Gregorian dates.
    I can create a view object which can query the Hijri date from the database for the Gregorian date.
    Problem is how to display this Hijri date as Tool tip .
    Thanks
    Suresh

    import oracle.apps.fnd.framework.webui.OADataBoundValueViewObject;
    //Code to display Dynamic ToolTip on Column
    OAAdvancedTableBean TableBean=(OAAdvancedTableBean)webBean.findChildRecursive("TableName");
    TableBean.prepareForRendering(pageContext);
    OAMessageStyledTextBean ItemName=(OAMessageStyledTextBean)TableBean.findChildRecursive("ItemId);
    OADataBoundValueViewObject ExpTip = new OADataBoundValueViewObject(ItemName, "VoAttribute");
    ExpType.setAttributeValue(oracle.cabo.ui.UIConstants.SHORT_DESC_ATTR, ExpTip);
    Thanks
    Babu

  • Html markup/tool tip appears on  website

    The html markup/tool tip boxes appear on our newly published
    website Aardvarkartbazaar.com. They show- up when you hover over
    the artwork on the Art For Sale section. Any suggestions on how to
    remove these from appearing on our website would be much
    appreciated.

    I see that the title attributes contain stuff like:
    title="
    Artist: Mike Sweeney
    &lt;br&gt;
    &lt;br&gt;
    $60 (S &amp; H included)
    &lt;br&gt;
    &lt;br&gt;
    you actually can´t have html tags within title or alt
    attributes, that´s why it´s getting displayed "as is" --
    use plain text only

  • Reg: problem in displaying as key and text

    Hi Friends,
    I have a problem while displaying values for 0profit_ctr.
    In Development box report working fine. In production it giving problem.
    ISSUE:
    I want to display the 0Profit_ctr as key and text format. In development box it showing correct. I cross verified the properties of 0proft_ctr charcaterstic in report of  development and production box. In both it is defined as dispaly key and text.
    Also cross verified the infoobject (0Profit_ctr) details, In both Business Explorer general settings defined as Display as Key and Text.
    Everything is same in production and development box for this. Even though in production it showing as text and key. we need to display it as key and text.
    any suggestion on this.
    Regards
    Mrk.

    It could be that the infoObject has been disturbed, have you tried just re-activating the object in Production.
    Also check the following link :
    I am able to search only by text and not by Key in filter.

  • Tool Tip Code

    I have the below code that works great, however I want to
    make some minor adjustments to make the tool tip a bit more
    dynamic.
    1) Need the Text to be Bold
    2) I would like rounded corners instead of a plain box
    3) I would like to add a slight drop shadow behind tool tip
    box
    Can anyone take a look at the code and help me clean it up
    and also add the above attributes!
    Thanks in advance!

    A guide on how to configure a Dropshadowfilter can be found
    here:
    http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveD ocs_Parts&file=00002189.html

  • General preference box unchecked but tool tips still showing up in PPro CC

    I've tried checking and unchecking the tool tips box in general preferences but the tool tips are still appearing - and getting in my way.  ;-)   Any ideas?  thanks.

    Are all the tooltips still popping up, or are do most of them go away while others remain? I believe it's by design that the following tooltip-esque popups remain: clip info in Timeline, marker info in the Timeline and the Source & Program monitors, Start/End/Duration when mouse pointer is over the beginning of the timebar in the Source or Program monitor.
    Let us know if either you're still seeing other tooltips or if you think the preference should hide all tooltips.

  • Artifacting on menu tool tip right click

    Why does the tool tip box in the menu contain artifacting at the bottom when you right click to force quit, etc.?
    Screenshot @http://d.pr/i/d3He
    Hopefully this will get resolved in the future.

    I cannot find a similar option on Mac
    System Preferences/Keyboard/Keyboard Shortcuts - did you look there?

  • Displaying the full text as a tool tip from selectbox(combobox)

    Hi friends,
    I struggling with the following problem.
    In the struts application the selectbox contain the text but it is not displaying the total teat because of the text to large.but i want to display the text in the form of tool tip when the mouse over on the selectbox.
    please find out this problem

    Hi..
    <logic:notEmpty property="tooltip" name="goods">
    <html:text styleClass="maskenInfoTypo" property="prefix" size="3" maxlength="3" title="<bean:write name="goods" property="tooltip"/>"/>
    </ogic:notEmpty>
    The tooltip is not coming. Whatever you give in title attribute is being taken as a string. I tried with both single quote and double quote
    But if you give the same bean write in alert(given below) all the values are coming properly
    <script>
    <logic:notEmpty property="tooltip" name="goods">
    alert('<bean:write name="goods" property="tooltip"/>');
    </logic:notEmpty>
    </script>
    Please help me��.

  • Tool Tip Text for field values in ALV report

    Hi,
    How to get the tool tip text for the field values in ALV report.
    Thanks & Regards,
    Pallavi.

    Hi,
    In fieldcatalog specify the TOOLTIP.
    <b>
    LVC_S_FCAT-TOOLTIP
    </b>
    In this speicfyteh tooltip you want.
    Then append this to the fieldcatalog.
    Hope this solves ur problem.

  • Trying to make tool tip text visible longer

    Having no luck finding a way to keep tool tip text visible for longer period of time. Keeping it visible for as long as the mouse is over the component would be ideal but any increase would be helpful.
    Is there a way to set the time the tip is displayed?

    Hi,
    Try the following code:
    ToolTipManager.sharedInstance().setDismissDelay(100000);
    That should keep your ToolTip showing for a long time. Change the value if you want it longer.
    Adrian

Maybe you are looking for

  • SAP HR - adhoc query/infoset

    Hi, I have an Infoset which is based on Logical database PNP & it has few additional fields. I added a new additional field in Infoset  and the requirement is to add the additional field to the selection screen of "Infoset Query". But in the Infoset

  • Configure High Availability in SharePoint 2013 having Single Farm

    Hi All, we are having 2 SharePoint server having single farm and two databases in cluster. we need to Configure HA and NLB between these 2 SharePoint Servers. Please Help..!!

  • Having trouble implementing Captivate simulation in an iFrame

    Hi all, hoping you can give me some pointers. I'm trying to implement Captivate scalable html5 simulations in a proprietary LMS that requires that I place it in an iFrame.  It works, but the scaling is not working properly.  Immediately upon loading,

  • Stuttering during Playback of .wav files

    I get stuttering during Playback of .wav files in my PC music library. I am using X-Fi Elite Pro. This doesn't do it all of the time, only occasionally. @97.22.92.33

  • Spatial Performance

    'm building a system which stores Geographical data, and trying to use the spatial functions in the Oracle database. Amongst the tables there are: blpu - one row per property in the county, each row has a spatial point object indicating its position.