Slider.verticalThumIcon ? How to set a custom icon for JSlider

Hi Guys,
Can anyone please tell me where I am going wrong in the code below.
I am trying to change the thum icon for JSlider to a custom one, but for some reason the new thum icon is not getting displayed.....
UIDefaults defaults = UIManager.getDefaults();
defaults.put("Slider.verticalThumbIcon", new ImageIcon(Slider.class.getResource("./cursor.jpg")));
defaults.put("Slider.background", Color.BLUE);
final JSlider slider = new JSlider();
slider.setPreferredSize(new Dimension(250,20));
getContentPane().add(slider, BorderLayout.NORTH);
I can see the blue background, BUT I still see the default thumb icon.
I also tried using
defaults.put("Slider.verticalThumbIcon", new ImageIcon("./cursor.jpg"));
Thanks a ton...

this works OK
import java.awt.*;
import javax.swing.*;
import javax.swing.plaf.basic.BasicSliderUI;
import java.net.URL;
import javax.imageio.ImageIO;
class Testing extends JFrame
  public Testing()
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setLocation(200,100);
    JSlider slider = new JSlider(0,100,0);
    slider.setUI(new MyBasicSliderUI(slider));
    slider.setMajorTickSpacing(10);
    slider.setMinorTickSpacing(5);
    slider.setPaintTicks(true);
    slider.setPaintLabels(true);
    JPanel jp = new JPanel();
    jp.add(slider);
    getContentPane().add(slider);
    pack();
  class MyBasicSliderUI extends BasicSliderUI
    Image im;
    public MyBasicSliderUI(JSlider js)
      super(js);
    public void paintThumb(Graphics g)
      try
        URL url = new URL(getClass().getResource("Save.gif"), "Save.gif");
        im = ImageIO.read(url);
      catch(Exception e){e.printStackTrace();}
      Rectangle thumb = thumbRect;
      g.drawImage(im,thumb.x,thumb.y,null);
  public static void main(String[] args){new Testing().setVisible(true);}
}

Similar Messages

  • How to set my own icon for java frame ??

    I create a java class it extends JFrame. I want to change default icon on the left_top corner and using my own icon. It is a --.gif file. How to do it. When I try to modify it using setIconImage( Image image), I met problem. I cann't new Image("--.gif"). I don't know how to create a Image object using a string(file name). I try to use ImageIcon , but it is not image obj. Thanks. Gary

    According to the documentation setIconImage does the following: Sets the image to be displayed in the minimized icon for this frame. Not all platforms support the concept of minimizing a window.
    So,
    1) It does not change the icon in the top-left corner
    2) It does not work on all platforms.

  • How to set a particular icon for a directory in the file system?

    Hello
    I'd like to know if it is possible, when creating a directory using file.mkdir(), to define a particular icon instead of the default system icon?
    If yes how to proceed?
    Thanks for your answer.
    David

    For XP you are going to have to dummy up one of these files:
    Desktop.ini
    I have no idea what some of the entries mean, but placing the file in the directory seems to do the trick
    [.ShellClassInfo]
    IconFile=%SystemDrive%\Downloads\IconSets\00946_tux\Tux Folder\Tux.ico
    IconIndex=0
    [{BE098140-A513-11D0-A3A4-00C04FD706EC}]
    Attributes=1
    IconArea_Image=%SystemDrive%\Pictures\cassie_0069.jpgThe file should be easy to write using Java , but what exact entries you need... try searching microsift ..........

  • How do I get custom icon for favorites on my tool bar instead of a empty square

    I am trying to add an Image to a book marked page on my favorites toolbar that has a empty square and do not seem to be able to do this .I keep trying add ons but they are only allowing common icons .I know that I have been able to create buttons easily in the past but can not do so now .I tried several add ons that say just right click and i have looked at customize tool bar .I am missing somethig what is it ?

    ''Be patient, most of us are volunteers.''
    That webpage doesn't have a Favicon image.
    Come up with an image that you want and pick an extension [https://addons.mozilla.org/en-US/firefox/search/?q=Favicon&appver=15.0.1&platform=windows that inserts a Favicon or changes the Favicon].

  • Custom icon for my USB flash drive?

    Alright, now I realize I'm probably missing something here, but it's getting away from me here. All I want to do is have a custom icon for my flash drive that will show up on any Mac that I plug it into.
    As it is, I can assign a coustom icon (by doing the old get-info-copy-and-paste-the-icon thingie), but it doesn't show up when I plug it into another Mac. I just get the generic disk icon. What am I missing? This has to be quite simple.

    Trey,
    I may be PITW, but I think the icons used to represent various volumes/devices are (if customized) specific to a system (not the volume/device). Thus you would have to set the custom icon for your flash drive on each system you wanted to see it.
    A WAG: I haven't the slightest idea if it would work for a flash drive, but for a CD one would drag the custom icon (.icns file) to the root level of the CD and rename it .VolumeIcon.icns before burning the CD.
    Lee C
    "The early bird may get the worm but the second mouse gets the cheese." -- Willie Nelson
    See the article Backup::Restore.
    Dual 2.5 Power Mac G5   Mac OS X (10.4.3)  

  • How to set a custom column in a workflow task.

    Hello,
    I'm looking for some assistance a bit with how to set a custom column in a Workflow Task.
    I have a List Workflow that starts when an item is created in a list. The workflow, platform type SharePoint 2013, starts a new task, Task1, with Content Type 1. This Content Type has a custom column called Age. Once the Task1 is completed a new task, Task2,
    with Content Type 2, starts and has the same column Age, as Task1.
    How can I populate the Age column in Task2 with the content of the Age column in Task1?
    Since I start the task by running "Assign a task to ..." Action I was thinking to copy the Age column from the Task1 to the list item that started Task1, which has a column Age as well, and then in Task2 to start another workflow - which is associated
    with the Content Type 2,  that would try to read the Age column from the list item that started Task2, which was set once Task1 was competed - I know it's complex but this is how I was thinking. 
    The problem with this approach is that I can't get a reference to the list item that started Task2 to read the Age from the list item.
    Is there a better approach? I use SharePoint Designer 2013 to design all this.
    Any assistance is appreciated.
    Thank you.

    Hello Sebastian,
    you can get the Age column from Task 1 and then update the Task 2 Age column with that value. I am not sure why you want to run another workflow on Task 2.
    You can perform below steps to set Age column from Task 1 to Task 2.
    1.  Create Task 1 using Assign a task , wait till the task is completed.
    2. Get the Age column value based on Task 1 once the task is completed.
    3.Create Task 2 using Assign a task ,  uncheck wait till the task is completed option.
    4. Update the Task 2 with Age column in Task1.
    5. Use Wait for the field to equal value , check for Task Status is completed or not.
    >>The problem with this approach is that I can't get a reference to the list item that started Task2 to read the Age from the list item.
    you can get the related item from task list item to get the main list item.
    Other option is, Use Javascript and CSOM  in task edit form to get the Age column from Task1 and prepoluate the Age value when Task2 is opened.
    Hope this helps.
    My Blog- http://www.sharepoint-journey.com|
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful

  • "I would like to know how to set the default view for the columns. Somewhere I read it could be done in by music icon under Library.  Can't find it.  Thanks

    "I would like to know how to set the default view for the columns that are shown in iTunes. Every time I open it, I have to either go to the options, or right-click to get the pop-up options, and delete "rating" and add "composer." I'd really like to just do it once and be done with it."  Somewhere I read you could do this by clicking on the Music icon under LIBRARY then arramge the columns.  Trouble is, I can't find a Musi Folder or icon in my user library.
    Any help would be appreiated.  OSX 10.9.2  iTunes version 11.1.5  Thanks!!! CW!

    From the iTunes menu bar try View>Show View Options.  Make sure what you want to see is checked and what you don't is unchecked.  You can do this (may need to do this) for any playlists, your main Library, etc.
    Good luck
    srb

  • HT201684 In Yosemite this no longer works, has anyone figured this out? How to set a custom default umask for all applications?

    In Yosemite this no longer works, has anyone figured this out? How to set a custom default umask for all applications?
    I've tried everything to get a custom umask set for all apps. It just seems impossible...
    Is there a replacement for launchd-user.conf?

    Please file a bug report: https://bugreport.apple.com
    I am sure this is something that got lost, like environment variables, in the Yosemite/iOS merger.

  • How to set up custom ring tone for a specific contact?

    If someone can guide me how to set up custom ring tone already downloaded from iTunes
    of a specifice  contact? Thanks.

    Tap contacts, select the contact, click edit,  go to ringtone, select ringtone

  • How to set partner determination procedure for customer hierarhies.........

    hi,
    sap gurus,
    how to set partner determination procedure for customer
    hierarhies.........
    regards,
    balaji.t
    09990019711.

    Hello Rajesh,
    The PDP is set up in customizing.You must create a regular partner determination procedure.In the IMG choose
    CRM>Basic Functions>Partner Processing-->Define Partner Determination Procedure
    You can define a partner determination procedure for each object type.
    PDP assigned to the object type Campaign can also be campaign-type-dependent.
    IMG:CRM>Marketing>Marketing Planning and Campaign Management>Partner Processing>
    Assign Partner Determination Procedure
    Hope this helps!
    Best Regards,
    Shanthala Kudva.

  • How to set up automatic payment for the purchase order

    Hi, All,
    I have one question how to set up automatically payment for the Rent Office purchase Order?
    There is the requirement from the client. They want to create one kind of purchase order for the Office Rent, then pay the fees in the certain time of every month to the vendor for the rent fees without any invoice. Whatu2019s the normal solution for this kind of purchase order? Is it ERS? Or something else?
    Please give me the details and business flow. Also please tell me how to setup in the SAP and T-code.
    Thanks in advance

    Either you can set up ERS or you can pay directly from the FI side.
    Prerequisites
    Evaluated receipt settlement must be flagged in the purchase order item.
    The vendor must be flagged as being subject to ERS in the vendor master record.
    The goods receipt must refer to a purchase order.
    Goods-receipt-based Invoice Verification must be defined for the purchase order item.
    A tax code must have been maintained in the purchase order item.
    The order price of the materials may not be an estimated price.
    If you flag a vendor as being subject to ERS, the system sets the ERS indicator as a default in each item when you create a purchase order for the vendor. You can prevent this happening for certain vendors by flagging the info record for the material and the vendor as not being subject to ERS.
    In Purchasing, you can delete the default ERS indicator in a purchase order item.
    Choose Logistics Invoice Verification ® Automatic Settlement ® Evaluated Receipt Settlement (ERS).
    The selection screen appears.
    You can use the following criteria to narrow down selection of the transactions to be settled:
    Company code
    Plant
    Goods receipt posting date
    Goods receipt document
    Fiscal year of the goods receipt
    Vendor
    Purchase order and order item
    You can define the selection criteria for the invoice documents by:
    Delivery
    Purchase order
    Purchase order item
    Goods receipt document
    Credit memo
    Invoice
    Currency
    Choose  Execute.
    The system issues a log for Evaluated Receipt Settlement, which displays the following:
    Settled
    In line with your selection criteria, the system displays all the order items that were settled (or if you are working in test mode, which would have been settled).
    Could not be settled
    In line with your selection criteria, the system displays all order items for which ERS is defined but could not be settled. It also lists the reasons.
    If the system reports being unable to invoice a transaction, you should exclude the transaction from ERS to avoid it being included in the log the next time ERS is run.
    Select the item and choose Exclude from ERS.
    The system also generates and possibly sends a message to inform the vendor(s) about the transaction settled, depending on the settings in Customizing.
    You can display the following environment information for the order items selected. To do this, choose Goto ®:
    Display purchase order
    Display invoice
    Display material document
    Display long text

  • How to set up Airport Extreme for 11ac and 11n?

    I have just purchased the new Airport Extreme (August 2014) because Apple's website states
    Simultaneous dual-band support.
    AirPort Extreme features simultaneous dual-band 802.11ac Wi‑Fi. That means it transmits at both the 2.4GHz and 5GHz frequencies at the same time. So no matter which band your wireless devices use, they’ll automatically connect to the best available band for the fastest possible performance.
    I have number of Macs in my home from a new MacBook Pro with Mavericks to a Macbook Air with Snow Leopard (due to required software) and iPads.
    So after setting up the new Extreme my new MacBook only accesses 11n as does my older Macs. I checked by holding down the option key while clicking the WiFi icon at the top of my Mac. Well, not so automatic then as I was expecting 11ac and 3 times faster access (as stated by Apple).
    I then looked for some documentation for setting up but cannot find anything.
    Hence my question here.
    How to set up Airport Extreme for 11ac and 11n simultaneously?
    At present the new Extreme is no better than my previous 2 year old one.
    Thank you.
    Michael

    How to set up Airport Extreme for 11ac and 11n simultaneously?
    Assuming that it is operating correctly, 802.11ac and 802.11b/g/n are broadcast simultaneously by default.
    Simultaneous dual-band support.
    AirPort Extreme features simultaneous dual-band 802.11ac Wi‑Fi. That means it transmits at both the 2.4GHz and 5GHz frequencies at the same time. So no matter which band your wireless devices use, they’ll automatically connect to the best available band for the fastest possible performance.
    That is advertising. The real information is usually found in the small and hard to read footnotes:
    Based on theoretical peak speeds. Actual speeds will be lower.
    AirPort Extreme is based on an IEEE 802.11ac draft specification. Performance based on comparison with Apple’s 802.11n products. Comparison assumes AirPort Extreme network with 802.11ac-enabled computer. Speed and range will be less if an 802.11a/b/g product joins the network. Accessing the wireless network requires a Wi‑Fi-enabled device. Actual speed will vary based on range, connection rate, site conditions, size of network, and other factors. Range will vary with site conditions.
    Since the 802.11ac signal is being broadcast only using the 5 GHz band, some users report that they have had better results by using the option to assign a different name to the 5 GHz band, and then pointing their Mac to that specific signal or network. You may want to try that option.
    But first as a test, please locate the MacBook Pro about 10-15 feet or 3-4 meters from the AirPort Extreme with clear line-of-sight between the two devices. Restart both the AirPort Extreme and the Macbook Pro and then check to see if the Mac is connected to an 802.11ac signal.
    If not, please power off your other wireless devices...computers, mobile devices, etc. temporarily, and try the same test again.
    Please report on your results.

  • How to create a "Custom Color" for highlighting? (Acrobat XI)

    March 10, 2014
    How to create a "Custom Color" for highlighting? (Acrobat XI)
    The numbers in the RGB and other fields change as various numbers are changed.
    I wanted to create a pale orange:
    Hue               13      Red      255
    Saturation   240      Green  177
    Luminosity    86       Blue     140
    I'd selected one of the orange squares in the color grid, to display the general orange area of the slider.
    I moved the slider to select a pale orange, which generated the above numbers.   Since this wasn't directly available to save to a Custom Color, I tried to  edit the numbers.  Unfortunately, the other numbers changed, making it impossible to actually create a color.
    Any suggestions would be appreciated.
    Note:  I used Techsmith's Snagit to show screen shots in a Word document.
    When I attempted to browse and upload the file, the error message said "[The content type of this image is not allowed.]"
    OK...what images *are* allowed?

    Hi Don,
    I saw Gilad answered your question in another forum post.
    Do you have everything you need at this point?
    Let me know if you need further assistance.
    Kind regards, Stacy

  • How to set displayed column width for a search help

    I have created an elementary search help for a custom field with a value table behind it.
    The search help functions correctly, but when displayed the column widths are all 10 characters. The user has to adjust the column to view the descriptive text.
    Can anyone tell me how to set default column widths for the help?

    Please  open you Elementary search  help  and see the Column  width   behind the Fields of your ...there  increase the width of the fields
    "Activate it  and refresh
    reward  points if it is usefull .....
    Girish

  • Custom icon for module_webappsresultsmap

    As the title says...
    When you make a search on the Google map, the icon that shows where the place  is, is a standard Google Map icon.
    Is it possible to override and add a custom icon for this?
    It would be nice to have it within the tag...
    ie. {module_webappsresultsmap,GoogleKey,width,height,ResultsPage,SortType,Image}
    Or have the image within the web app so that each location has a different icon.

    I tried submitting this same problem as a feature request and/or bug report.
    Unfortunately, and somewhat disconcertingly, the Captivate Bug Report form also doesn't work. No matter how thoroughly I entered my request, I got these error messages:
    The following error(s) must be corrected before this form can be completed:
    Please enter your name
    Please enter your E-mail address
    Please select if it is feature request or the bug report.
    Please select a product
    Please enter the issue description

Maybe you are looking for

  • Acrobat X fill in form distribution issue

    I created a fill in form in Acobat X for MACs and twice attempted to distribute the form to 32 recipients using my Acrobat.com account.  The distribution seems to stall while "sending".  The form does not show up on my Acrobat.com account nor were th

  • How to implement the pessimistic locking using toplink with sybase

    we want to allocate the unique primary key to each row when many user try to insert the records concurrently..So what we are trying to do is we calculate the maximum of Primary Key and incremented it by 1. Now we want to Apply the locking concept on

  • Renting movies from my ipod touch

    I tried renting a movie on my ipod touch. I clicked "rent" which was interrupted by a new set of terms and conditions. After agreeing to the terms and conditions it told me to try my rental again so I did. My account has been debited for 2 movie rent

  • My computer died and took my itunes music with it

    Help! my old Dell died, and took my music with it. I've spend a lot of money on music and tv shows from itunes, and I would like to get them on my new computer, but there doesn't seem to be a way to do that. Shouldn't I be able to take the things i'v

  • Has anyone experienced problems moving from ModileMe to iCloud?

    I have MobileMe installed on my iMac 27.  When I try to switch over to iCloud I get an iCloud window that that has a button that says "Move to iCloud".  When I select the button I'm asked to reenter my passward as though I attempting to use the "Find