Jump to content

Border Factory

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
Howdy_McGee

Howdy_McGee

    Programmer

  • Members
  • PipPipPipPip
  • 135 posts
Ok, so i'm making a Tic Tac Toe Board, GUI gridLayout. I'm wanting it to look like # of course

What I need to do is set up a black border bottom, so i figure an emptyBorder would be fine, but I'm not sure how to add color to it. I can add the thickness, but really that's just padding since theres not color.

I tried:
panelName.setBorder(BorderFactory.createEmptyBorder(Color.black, 10, 0, 0, 0));
panelName.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0, Color.black));

both of them error out :/

Anyone have any suggestions?

#2
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
I'd go for a matteBorder:
panelName.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.BLACK));
  • first parameter: thickness in pixels of the top border.
  • second parameter: thickness in pixels of the left border.
  • third parameter: thickness in pixels of the bottom border.
  • fourth parameter: thickness in pixels of the right border.
  • fifth parameter: the color


#3
Howdy_McGee

Howdy_McGee

    Programmer

  • Members
  • PipPipPipPip
  • 135 posts
That worked :D thanks!