Results 1 to 3 of 3
  1. #1
    ellias2007 is offline Member
    Join Date
    Feb 2010
    Posts
    25
    Rep Power
    0

    Unhappy JButton.setBackground() Problem

    Hi All,
    When i apply the setBackground() Method to a JButton to set its Background, i face i Problem :
    Under Mac Os : The JButton DOSE NOT change its color,
    when i take my code to my other computer under Windows : OK, the JButton change...
    i am wondering ....
    1) Why under my Mac OS i face this problem...
    2) and Why i get two different results from a same code ??? Java is not Portable?? and independant of the OS?? or it is the swing that makes the problem???
    My code is so simple :
    MyJButton.setBackground(new Color(255,100,100));
    Thanks to any help...
    :confused:

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    The background color and drawing of the button is usually accomplished through the look and feel. Your directly manipulating it may be allowed by some of the look and feels but not by others. You may wish to change the color through the look and feel instead.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Please see what JavaRanch has to say about cross-posting: BeForthrightWhenCrossPostingToOtherSites

    The same etiquette applies here, the Sun/Oracle site, and most other programming fora. Thank you for your cooperation.

Similar Threads

  1. A problem with JScrollBar and the Jbutton
    By cowboy in forum New To Java
    Replies: 5
    Last Post: 12-19-2009, 09:17 PM
  2. Problem on adding JButton on JPanel NEED HELP
    By boisk in forum AWT / Swing
    Replies: 15
    Last Post: 03-15-2009, 02:27 PM
  3. JButton Problem
    By wassim in forum AWT / Swing
    Replies: 6
    Last Post: 02-18-2009, 10:29 PM
  4. Help with JButton
    By geoffreybarwise in forum New To Java
    Replies: 4
    Last Post: 05-21-2008, 10:48 AM
  5. Problem with JButton
    By Marcus in forum AWT / Swing
    Replies: 1
    Last Post: 07-05-2007, 05:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •