Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

I need help with Look&Feel .  RSS feed

 
Ammar Salem
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers, I am trying to change the look and feel of the toolbar I created.I keep getting errors,would you please have a look.

the toolbar code with internal frame

Internal frame work fine but whenever i try to change the Look&Feel these errors occure:


F:\MyJava\Swing&Others>java ToolbarFrame4
Unrecognized L&F request action: Java
LookAndFeel Class not found: com.sun.java.swing.palf.MotiflookAndfeel
Unrecognized L&F request action: Win
Unrecognized L&F request action: Java
LookAndFeel Class not found: com.apple.mrj.swing.MacLookAndFeel
Unrecognized L&F request action: Java
LookAndFeel Class not found: com.sun.java.swing.palf.MotiflookAndfeel
Unrecognized L&F request action: Win
LookAndFeel Class not found: com.apple.mrj.swing.MacLookAndFeel
Unrecognized L&F request action: Java
LookAndFeel Class not found: com.sun.java.swing.palf.MotiflookAndfeel
Unrecognized L&F request action: Win
Unrecognized L&F request action: Win
LookAndFeel Class not found: com.sun.java.swing.palf.MotiflookAndfeel

I am looking forward for your help.
Regards,
Ammar
 
Brian Cole
Author
Ranch Hand
Posts: 935
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ammar Salem:

Unrecognized L&F request action: Java
LookAndFeel Class not found: com.sun.java.swing.palf.MotiflookAndfeel


Lots of problems:
  • spelling error: Change every palf to plaf.
  • spelling error: MotifLookAndFeel has a capital L.
  • You're using an outdated class name for mac L&F. Current mac L&F is at apple.laf.AquaLookAndFeel I think.
  • Your button is called "Win" but your listener is checking for "Windows" so they don't match.
  • Some L&Fs just aren't available on some systems. For example, the Windows L&F is generally available only on Windows systems and the Mac L&F is generally available only on Mac systems.


  • Better, I think, is not to hard-code the strings. How about something like


    Then in the listener: UIManager.setLookAndFeel(e.getActionCommand());
     
    Ammar Salem
    Ranch Hand
    Posts: 60
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I am really Honoured to have you answering my questions Sir Brian.Thank you very much. I will try to apply your suggestions.
    Sincerely,
    Ammar
     
    Don't get me started about those stupid light bulbs.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!