Why setRolloverIcon cant function in JToolBar ** NEED HELP ** URGENT

this is the sample coding
* WHY when the user positions the mouse over
button...the Images dint change
import javax.swing.JToolBar;
import javax.swing.JButton;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JTextArea;
import javax.swing.JScrollPane;
import javax.swing.JPanel;
import java.awt.*;
import java.awt.event.*;
public class ToolBarDemo extends JFrame {
protected JTextArea textArea;
protected String newline = "\n";
public ToolBarDemo() {
//Do frame stuff.
super("ToolBarDemo");
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
//Create the toolbar.
JToolBar toolBar = new JToolBar();
addButtons(toolBar);
//Create the text area used for output.
textArea = new JTextArea(5, 30);
JScrollPane scrollPane = new JScrollPane(textArea);
//Lay out the content pane.
JPanel contentPane = new JPanel();
contentPane.setLayout(new BorderLayout());
contentPane.setPreferredSize(new Dimension(400, 100));
contentPane.add(toolBar, BorderLayout.NORTH);
contentPane.add(scrollPane, BorderLayout.CENTER);
setContentPane(contentPane);
protected void addButtons(JToolBar toolBar) {
JButton button = null;
//first button
button = new JButton(new ImageIcon("images/save2.gif"));
button.setRolloverIcon (new ImageIcon("images/save2.gif"));
button.setToolTipText("This is the left button");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
displayResult("Action for first button");
toolBar.add(button);
//second button
button = new JButton(new ImageIcon("images/view2.gif"));
button.setRolloverIcon (new ImageIcon("images/view2.gif"));
button.setToolTipText("This is the middle button");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
displayResult("Action for second button");
toolBar.add(button);
//third button
button = new JButton(new ImageIcon("images/delete2.gif"));
button.setRolloverIcon (new ImageIcon("images/delete2.gif"));
button.setToolTipText("This is the right button");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
displayResult("Action for third button");
toolBar.add(button);
protected void displayResult(String actionDescription) {
textArea.append(actionDescription + newline);
public static void main(String[] args) {
ToolBarDemo frame = new ToolBarDemo();
frame.pack();
frame.setVisible(true);
}

This is a known Bug (# 4260485).
As showed there, setRolloverIcon works fine in Metal
JPanels, but not in Metal JToolBars.
(So, you should try with Windows or Motif look and feel).
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
public class ToolbarTest extends JPanel implements ActionListener
static final String iconDefName=".gif";
static final String iconRollName="images/middle.gif";
private static Icon getIcon(String name)
return (Icon)((UIDefaults.LazyValue)LookAndFeel.makeIcon(
ToolbarTest.class, name)).createValue(null);
JButton button;
JComboBox lnf;
ToolbarTest()
setLayout(new BorderLayout());
Icon iconRoll = getIcon(iconRollName);
Icon iconDef = getIcon(iconDefName);
JToolBar toolbar = new JToolBar();
button = new JButton(iconDef);
button.setRequestFocusEnabled(false);
button.setMargin(new Insets(1,1,1,1));
button.setPressedIcon(iconRoll);
button.setRolloverIcon(iconRoll);
button.setRolloverEnabled(true);
toolbar.add(button);
add(toolbar, BorderLayout.NORTH);
JButton button2 = new JButton(iconDef);
button2.setRequestFocusEnabled(false);
button2.setMargin(new Insets(1,1,1,1));
button2.setPressedIcon(iconRoll);
button2.setRolloverIcon(iconRoll);
button2.setRolloverEnabled(true);
add(button2, BorderLayout.WEST);
UIManager.LookAndFeelInfo[] lnfs =
UIManager.getInstalledLookAndFeels();
String lnfClasses[] = new String[lnfs.length];
for (int i = 0; i < lnfs.length; i++)
lnfClasses[i] = lnfs.getClassName();
lnf = new JComboBox(lnfClasses);
lnf.setSelectedItem(UIManager.getSystemLookAndFeelClassName());
lnf.addActionListener(this);
add(lnf, BorderLayout.SOUTH);
public void actionPerformed(ActionEvent e)
String selectedlnf = (String)lnf.getSelectedItem();
try {
UIManager.setLookAndFeel(selectedlnf);
SwingUtilities.updateComponentTreeUI(this);
System.out.println(button);
} catch (Exception ee) {}
public static void main(String args[])
JFrame frame = new JFrame("Rollover property of button in toolbar");
     frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
     JOptionPane.setRootFrame(frame);
     try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {}
frame.getContentPane().add(new ToolbarTest());
frame.pack();
frame.setSize(new Dimension(300,150));
frame.show();

Similar Messages

  • Error during generation of the function module..need help urgently

    Hello everyone,
                            m trying to generate data source in BWDevelopment.
    After mapping all the BW fields to Source Object elements I click on Generate DataSource(for UD Connect) so following error comes
    'An error occurred in step 1 during generation of the function module'
    RFC connection is fine, error free and extractor is also fine.
    Where could be the problem?
    Thanks & Regards,
    Priyanka

    Hello everybody,
                             my problem is solved.For the UDConnect, whatever DATA SOURCES you create gets registered in a FUNCTION MODULE which has a capacity of only 99 enties, so to increase it implement the SAP NOTE 876340 - UDC Error available on SERVICE MARKET PLACE.
    This problem occurs with BW version 3.5 level 17 or below.
    Regards,
    Priyanka
    Edited by: Priyanka Joshi on Jun 10, 2008 11:03 AM

  • My ipad is saying connect to itunes because it has been disabled. but my itunes says i need to unlock it before i cant do anything. i need help.

    My ipad is saying connect to itunes because it has been disabled. but my itunes says i need to unlock it before i cant do anything. i need help.

    Hi Stephanie,
    Welcome to Apple Support Communities.
    It sounds like you're going to have to put the iPad in to recovery mode before you can restore it. The article linked below provides more details about the passcode lock and will walk you through putting the process of restoring from recovery mode.
    iOS: Forgot passcode or device disabled
    http://support.apple.com/kb/ht1212
    Use recovery mode
    Follow these steps if you never synced your device with iTunes, if you don't have Find My iPhone set up, or if you can't get to your own computer. You'll need to put your device in recovery mode, which will erase the device and its passcode. Then you'll restore your device as new or from a backup.
    Disconnect all cables from your device.
    Turn off your device.
    Press and hold the Home button. While holding the Home button, connect your device to iTunes. If your device doesn't turn on automatically, turn it on.
    Continue holding the Home button until you see the Connect to iTunes screen.
    iTunes will alert you that it has detected a device in recovery mode.
    Click OK, then restore the device.
    Cheers!
    -Jason

  • Third party app. The vault anyone loose all their information and cant retrieve it? Need help lost all my info.

    Third party app The vault anyone loose all their information and cant retrieve it? Need help lost all my info.

    Contact the developer of the app.
    Restore from your backup.

  • Need help regarding may ipad, i cant access my ipad, need help regarding may ipad, i cant access my ipad

    need help regarding may ipad, i cant access my ipad, need help regarding may ipad, i cant access my ipad

    Can you be little more specific?

  • My MacBook Pro has problem in iphoto,, I cant open it,, I need help please,,,,

    My MacBook Pro has problem in iphoto,, I cant open it,, I need help please,,,,

    Last login: Sun Apr 22 19:11:11 on ttys000
    Marlons-MacBook-Pro:~ ryanmnhs$ ls -la ~/Library/LaunchAgents
    total 40
    drwx------   7 ryanmnhs  staff   238  5 Nov 23:09 .
    drwx------@ 48 ryanmnhs  staff  1632 13 Jan 09:53 ..
    -rw-r--r--   1 ryanmnhs  staff   574 24 Oct 22:29 com.adobe.ARM.202f4087f2bbde52e3ac2df389f53a4f123223c9cc56a8fd83a6f7ae.plist
    -rw-r--r--   1 ryanmnhs  staff   618 22 Oct  2011 com.apple.AddressBook.ScheduledSync.PHXCardDAVSource.BAF380D0-E780-4E82-86BF-77 2440AB4936.plist
    -rw-r--r--   1 ryanmnhs  staff   895  4 Sep  2011 [email protected].plist
    -rw-r--r--   1 ryanmnhs  staff   802 21 Mar 12:56 com.facebook.videochat.ryanmnhs.plist
    -rw-r--r--@  1 ryanmnhs  staff   805  6 Sep  2011 com.google.keystone.agent.plist
    Marlons-MacBook-Pro:~ ryanmnhs$ 
    ,,,,,,,,THIS IS THE RESULT,, WHAT DOES THIS MEAN? HOW CAN I FIX MY PROBLEM? UP TO THIS DATE MY WORD, EXCEL AND POWERPOINT STILL DONT WORK!!!!PLEASE HELP ME, ANYONE? THANK YOU...

  • Username and password- Need help urgently!

    Hi
    1) First of all, i have received an email stating that my account under Removed personal information to comply withCommunity GuidelinesandTerms and Conditions of Use.
    is being banned as there is multiple obsence post. I need to clarify that i have never used my account to post in BBM forum before. Even if i did, is when i need help urgently for my BBM application. Currently i am holding 4 bbms now. Have never came across this issue. Pls check and advise
    2) I urgently need to setup my email accounts. But this time round, when i logged in, they required for my email id and password. And yes my email id is Removed personal information to comply withCommunity GuidelinesandTerms and Conditions of Use. all the while for the past 4 years. I am unable to log in. I tried all kinds of password but unable to log into my mobile settings
    Verfiy Blackberry ID
    This application requires u to verify ur blackberry id to continue.
    blackberry ID username:
    Removed personal information to comply withCommunity GuidelinesandTerms and Conditions of Use.
    password:
    I went to the forget password option, unfortunately as i have never retrieved my password before, i am unable to remember the security question as i did not use it for the past 4 years.
    Pls advise.
    Urgent and thanks

    Hi,
    I have been trying this technique for the past 4 days. It doesnt work no matter how i change the password at the link that u gave me. Even though it's being reset accordingly, i am still unable to log in the password at my mobile. i am 100% sure that i have entered the correct password at my mobile. ( verify blackberry id) . I want to setup new email accounts under "setup" . Upon me clicking " email accounts", it prompt for the one key password. I have never faced this issue before. I am very very sure that my password is correct. Pls advise as i need to add email accounts. Other programs are working fine without any password required being prompt. ie. blackberry world
    This is very very urgent to be resolved. Pls help.

  • Need help urgently with OS X and Windows 7

    I need help urgently.
    I installed Windows 7 on my macbook pro with OS X Lion. After installing Windows7, I accidently converted the basic volumes to dynamic volumes and now i can't even boot to OS X.
    Please help me how to recover my OS X Lion. If I have to delete Windows and bootcamp partitions, it is OK.
    I just want to get back my OS X bootable.
    Thanks

    thihaoo wrote:
    Sorry
    I can't even see the OS X partition when I hold down the "Option" key.
    I could see OS X and Windows partitions if I hold down Option key before changing the partitions to Dynamic partitions from Basic in Windows 7.
    Now can't see OS X partiton and only see Winodws partition but when I tried to boot onto Windows7 , I got BSOD and macbook pro restart.
    Please help
    The usual reason for the OSX partition to be invisible under these circumstances is that it has been trashed by Windows.
    Do you have a backup?

  • Need help urgently, I upgraded my iPhone 4 with new OS 5, but at the last restore failed. Apple Customer Care helped me to resynch my phone with all that available in Library. I've got all back except my Contact no. Pls help guys, thnx

    Need help urgently, I upgraded my iPhone 4 with new OS 5, but at the last restore failed. Apple Customer Care helped me to resynch my phone with all that available in Library. I've got all back except my Contact no. Pls help guys, thnx Plz guys anyone can help plzz....I've lost all contact and I dont even have any secondary back up also...!!!

    If you've had it for less than a year, then it's still under warranty.  Take it to an Apple store or an authorized service facility.  See http://support.apple.com/kb/HT1434

  • Need help urgent,my iphone is stuck at connect to itunes screen.when i restore with itunes it shows error -1. please help me

    need help urgent, my iphone is stuck at connect to itunes screen, when i restore it using itunes, it shows error -1...may someone help me plz....

    See:
    iOS: Unable to Update or Restore
    http://support.apple.com/kb/ht1808

  • BB Curve 8900 need help urgently!!!!!

    hey my blackberry 8900 rebooted but now it says "Reload Software:552" and no matter what buttons I press it just won't work, please tel me what to do I really need help urgently!!
    Solved!
    Go to Solution.

    Before you do anything else:  Do a simple reboot on the BlackBerry in this manner: With the BlackBerry device POWERED ON, remove the battery for a minute, and then reinsert the battery to reboot. A reboot in this manner is prescribed for most glitches and operating system errors, and you will lose no data on the device doing this.
    Please let us know if that reboots the device properly or not.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • I tried to buy the  WhatsApp app. The card has been charged. but the app wasnt downloaded.i need help Urgently.

    I tried to buy the  WhatsApp app. The card has been charged. but the app wasnt downloaded.i need help Urgently.

    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    To see which iOS version is installed, tap Settings > General > About

  • Sound trouble need help urgent please

    Could somebody tell me how i can fix my problem.
    problem: when my curve 8520 is in silence profile en i start typing in a phnoe number i hear nothing,
    but when my phone is in normal profile i hear i beep with every number of the phone number i enter.
    so i want to know how i can stop my bb from making this noise

    My friend it is a fillable form, can i email you the pdf that iam trying to fill out? then would you be able to tell me how to do it please mate?
    I have attached the form, i need to fill in those boxes so that everything is accuratly height + spacing is correct, and to do it fast, thats all im after.
    Date: Sun, 27 Jun 2010 18:31:58 -0600
    From: [email protected]
    To: [email protected]
    Subject: Need Help Urgent Please
    If is a fillable form, just tab to the next field. What we do not understand from you is IF it is a fillable form or not. If it is not, then the 3 options I gave can be used. Placing text is always a problem. You might find it useful to turn on the grid to help in placing your typewriter fields. However, if it is fillable you do not have to create any fields to type in, you just leave the tool as the hand tool and select the predefined fields with the cursor or the tab key and type accordingly. If the field is a checkbox, then you just use the space key to activate it.
    So, are we talking about a fillable form or something that has the appearance of a form, but not fields to fill in. This is what Bernd has been try to find out and you keep suggesting it is fillable as we read what you have said.
    >

  • IPod does not function well. i need help!!

    I got this iPod, bought frm korea. Tried to dwnld songs in it. Wen connected to computer, it doesnt come out in iTunes. It comes out at mycom. Wen i dwnld songs manually, it cannot be play & my ipod went blank and turn off. went i connect it back, the files are corrupted and ther are viruses on it. itried evry solutions on the internet. i even format it wic i shud not do it. i need help. & this ipod doesnt look like an original one. since i bought it overseas, its hard for me to find a service product here.

    As you now know, it appears you have a fake iPod.
    http://discussions.apple.com/thread.jspa?threadID=972344&tstart=0

  • I got an iphone for my birthday, and when i tried to use it, there was still the apple id from the previous owner so now i cant use it, i need help please

    I need help unlocking an ipod that has the previous owners apple id and it wont let me log on and the previous owner, no longer is able to be reached.

    You will need to contact the previous owner, only they can reomve it from their account : http://support.apple.com/kb/TS4515
    If you can't contact them and get them to remove it then you won't be able to use the phone.

Maybe you are looking for

  • How to reinstall Acrobat X Pro? I purchased Acrobat X at a retail staore and Acrobat X Pro from the Adobe Website.

    I just installed a Solid State Hard-drive on my computer and am now looking for a way to reinstall Acrobat X Pro that I purchased from the Adobe Website. I purchased Acrobat X from a retail store. I dont need to install Acrobat X from the Disc before

  • Ffmpeg support for stepmania-cvs

    I have been looking into adding ffmpeg support for the stepmania-cvs package. The main problem is that StepMania will continue to depend on the old 0.4.9-pre1 version of ffmpeg in order for video support to work properly. Following the directions on

  • Expdp/impdp

    Hi All, WE are planning to refresh a schema from Prod to QA on Prod the Tablespace size is as below TABLESPACE_NAME %Used Free(Gb) Total(Gb) STATUS CONTENTS Ext_Mgmt Aloc_Ty ============================== ======= ========= ========= ========== ======

  • Missing US english Qwerty Keyboard Layout?

    Hello, in the Systeme Preferences > Language & Text > Input Sources, I have a lot of exotic, and definitly nice, keyboard layout, but there is no basic US english QWERTY keyboard layout. The closest would be "british" or "canadian english" but I want

  • Aperture 2.1.4 with Snow Leopard

    Mouse and touch pad will not work to progress images or slides since upgrading to SL. Have downloaded and reloaded Aperture but still has corrected the problem. The only way to browse the images is to use the arrows.