Pregunta

In GEF (Graphical Editing Framework), is it possible to change the size of a check box and the check mark inside it?

I tried three methods:

  • setPreferredSize
  • setSize
  • setBounds

But they can only widen the padding between it and its parent.

¿Fue útil?

Solución

Checkbox is implemented by using an Image inside a label. There are two images, one for the checked checkbox and one for the unchecked checkbox. Because of this, I don't there is an easy way to re-size the checkbox.

Possible solutions: 1. If you just need a larger checkbox of a specific size, create your own Checkbox. The code of the original class is small and very simple. 2. If you need the checkbox's size to change, you will have to create a new Graphics object and create a new image on demand using the scale method (this is a bit complex, you have to create a GC from a new image, create an SWTGraphics using the GC and then scale it. 3. Convince your client that he doesn't want a new checkbox :-).

Good luck.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top