• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

PLAF: sideeffect resizing and painting

 
vik nuckchady
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
i am trying to give another shape (a polygon other than a square) to a JButton by creating another ButtonUI. I am however encountering some problems
1. The fillPolygon(myPolygon) from Graphics does not seem to work when i am trying to paint the new shape. However a drawPolygon(myPolygon) and a fillOval(0, 0, width, height) do work.
2. When the frame containing the JButton is resized, there are traces of the outline of the button (from a call to drawPolygon()) for all the sizes that the button is while the frame is being resized.
Would anyone have an idea of what i could be doing wrong or missing. Thanks in advance.
Here is the code i am using in case it might be helpful:

regards Vik
[ January 16, 2003: Message edited by: vik nuckchady ]
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've run your code, and I don't see either of the problems you mention... fillPolygon() works for me, and I don't see the redraw problem... I'm using JDK 1.4.1, what version are you using? One thing that I would recommend is that you put the outline Polygon inside the paint method... otherwise you keep adding points to the polygon, which may cause the redraw problem you see...

Here's the code that I am using... ( I also modified the code to make a triangular button instead of rectangular... )

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic