Results 1 to 5 of 5
  1. #1
    Banana937 is offline Member
    Join Date
    Jul 2012
    Posts
    2
    Rep Power
    0

    Default JButton Highlighting/Colors Help (Mac OS X)

    I just attended a week of programming camp at which we were using Windows 7 with Eclipse Indigo. I made a TicTacToe game using JButtons. Upon returning home, I loaded my files from a flash drive to my home computer (Mac Snow Leopard running Eclipse Juno) and imported all of my projects. My JButtons were all colored light grey when display on Windows, and changed to white when the square had alright been used, however on my Mac, I receive no such luck. My buttons are all the generic white color. Is there any way I can have the colors display on OS X, or does it not work?

    My second question pertains to the constant annoyance of "highlighting". For some reason, I can't find any forum threads that touch upon this issue anywhere on the internet (either because people who encounter it are smart enough to fix it or because no one is smart enough to ask), so I decided to make my own. Essentially, the boxes have a highlight around them that I can't seem to get rid of. I have included a picture.
    JButton Highlighting/Colors Help (Mac OS X)-screen-shot-2012-07-13-8.57.23-pm.png
    I've tried:

    Java Code:
    button1.setBorderPainted(false);
    but that doesn't work because that makes the entire border invisible, not just the highlight. Included is a link to a pastie of both classes (I felt they were too long to include in a CODE tag).

    MyWin
    TicTacToe

  2. #2
    Banana937 is offline Member
    Join Date
    Jul 2012
    Posts
    2
    Rep Power
    0

    Default Re: JButton Highlighting/Colors Help (Mac OS X)

    Bump.

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

    Default Re: JButton Highlighting/Colors Help (Mac OS X)

    For the button colors, check out tutorials on changing Swing's Look & Feel.

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,449
    Blog Entries
    7
    Rep Power
    20

    Default Re: JButton Highlighting/Colors Help (Mac OS X)

    My guess is that the focus is painted for those buttons (press the tab key and see if another button paints itself with that blue border line); if so, setFocusPainted(false) on those buttons.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,197
    Rep Power
    19

    Default Re: JButton Highlighting/Colors Help (Mac OS X)

    Quote Originally Posted by JosAH View Post
    if so, setFocusPainted(false) on those buttons.
    And if that doesn't do it, try setRolloverEnabled(false).

    A more general tip: when trying to set any property that can have only two states, go through the API looking for methods that take a boolean parameter.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. JLabel highlighting in crossword
    By Cortezz15 in forum AWT / Swing
    Replies: 3
    Last Post: 05-09-2012, 07:31 PM
  2. HIGHLIGHTING certain strings
    By onions in forum New To Java
    Replies: 3
    Last Post: 05-01-2012, 05:04 PM
  3. Search Result and Highlighting
    By sprateek in forum Lucene
    Replies: 0
    Last Post: 10-08-2011, 01:50 PM
  4. Highlighting with exact match
    By ashkandaie in forum Lucene
    Replies: 3
    Last Post: 09-09-2010, 06:36 AM
  5. Eclipse Syntax Highlighting
    By garrettgjb in forum Eclipse
    Replies: 1
    Last Post: 08-24-2009, 03:10 PM

Posting Permissions

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