I have a TicTacToe board and I need to draw a line through the X's or O's when someone wins. I know how to use the paint method, repaint, etc (as far as how they're called & the basics). I'm just not sure how to go about actually drawing the line. I assume its by repeatedly calling repaint, but I'm unsure about the rest of the logic to actually get the line to run through the squares of the board. One way (I guess) would be to repeatedly give the method coordinates, and "dot" each coordinate until it formed a line. But I think that would be overkill . . & it would be pretty hard to get the coordinates that run through the middle of the JButtons anyway.
BestJewSinceJC
700
Posting Maven
Recommended Answers
Jump to PostIf you are wanting to paint the line over a grid of JButtons, you'll need to create a small component to install as the glass pane (you read about glass pane here). The …
All 3 Replies
BestJewSinceJC
700
Posting Maven
Ezzaral
2,714
Posting Sage
Team Colleague
Featured Poster
BestJewSinceJC
700
Posting Maven
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.