Re: newbie question: Problem creating a myJButton class

Discussion in 'Java' started by Johan, Jun 27, 2003.

  1. Johan

    Johan Guest

    Pete, thanks for Your reply.
    I've also changed the color to one of the 'default' colors and it works
    fine. Does anybody know why it's not working with a custom color? I'd realy
    like to know because I prefer my custom colors above the default ones.

    Thanks.

    Johan

    pete kirkham wrote:
    > Johan wrote:
    >
    >> Sergio, thanks for Your reply. I've done what you suggested,
    >> unfortunately it didn't solve it :(

    >
    >
    > That's odd, it works fine on my machine with:
    >
    > private void jbInit() throws Exception {
    > this.setBorder(null);
    > this.setPreferredSize(new Dimension(128, 64));
    > this.setBackground(beige);
    > addMouseListener(this);
    > }
    >
    > But I had to change the colour of the border to have a noticable effect,
    > a one pixel border of very nearly the same intensity as the ground
    > doesn't show up that well.
    >
    >
    > Pete
    >
    Johan, Jun 27, 2003
    #1
    1. Advertising

  2. Johan

    pete kirkham Guest

    Johan wrote:
    > Pete, thanks for Your reply.
    > I've also changed the color to one of the 'default' colors and it works
    > fine. Does anybody know why it's not working with a custom color? I'd
    > realy like to know because I prefer my custom colors above the default
    > ones.


    It does work for custom colours.

    If you make a really wide border (eg:
    BorderFactory.createLineBorder(light_blue, 12) ) then you can see the
    change.

    The eye resolves detail, such as a one pixel border, by intensity rather
    than colour. Colour is then applied by the brain to the edges of the
    detail. This is why cartoons drawn with black outlines and solid colour
    interioirs look like idealised real world things, not just wierd.

    The difference in intensity can be calculated approximately* by:

    |(238,236,223)| - |(232,237,255)| 403 - 418 15
    --------------- --------------- = --------- = --- ~= 3.4%
    |(255,255,255)| |(255,255,255)| 442 442

    Which just isn't enough to notice for a one pixel detail on most monitors.


    Pete

    *the eye actually weights red, blue and green levels differently to each
    other and dependent on ambient light
    pete kirkham, Jun 27, 2003
    #2
    1. Advertising

  3. Johan

    Johan Guest

    Thanks Pete.

    pete kirkham wrote:
    > Johan wrote:
    >
    >> Pete, thanks for Your reply.
    >> I've also changed the color to one of the 'default' colors and it
    >> works fine. Does anybody know why it's not working with a custom
    >> color? I'd realy like to know because I prefer my custom colors above
    >> the default ones.

    >
    >
    > It does work for custom colours.
    >
    > If you make a really wide border (eg:
    > BorderFactory.createLineBorder(light_blue, 12) ) then you can see the
    > change.
    >
    > The eye resolves detail, such as a one pixel border, by intensity rather
    > than colour. Colour is then applied by the brain to the edges of the
    > detail. This is why cartoons drawn with black outlines and solid colour
    > interioirs look like idealised real world things, not just wierd.
    >
    > The difference in intensity can be calculated approximately* by:
    >
    > |(238,236,223)| - |(232,237,255)| 403 - 418 15
    > --------------- --------------- = --------- = --- ~= 3.4%
    > |(255,255,255)| |(255,255,255)| 442 442
    >
    > Which just isn't enough to notice for a one pixel detail on most monitors.
    >
    >
    > Pete
    >
    > *the eye actually weights red, blue and green levels differently to each
    > other and dependent on ambient light
    >
    Johan, Jun 27, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. E11
    Replies:
    1
    Views:
    4,698
    Thomas Weidenfeller
    Oct 12, 2005
  2. Snoeys Andy
    Replies:
    2
    Views:
    405
    White Wolf
    Sep 12, 2003
  3. christopher diggins
    Replies:
    16
    Views:
    729
    Pete Becker
    May 4, 2005
  4. Joseph Turian
    Replies:
    5
    Views:
    572
  5. Christian Maier
    Replies:
    3
    Views:
    489
    John Harrison
    Feb 15, 2007
Loading...

Share This Page