views:

352

answers:

1

Hello everybody I have created a table layout manager by extending a manager. Every thing is working fine but when I tried to create and set rounded border by using BorderFactory it is actually displaying a square instead of rounded square, please help me by send your valuable suggestions. Even though I have tried to add that border to a custom label field that also behave in a same manner.

A: 

BorderFactory is only available after 4.6 so for all version i used to do like.

VerticalFieldManager vfm = new VerticalFieldManager() {
            protected void paint(Graphics graphics) {
                int oldColor = graphics.getColor();
                graphics.setColor(Color.RED);
                graphics.drawRoundRect(0, 0, getWidth(), getHeight(), 10, 10);
                graphics.setColor(oldColor);

            }

            protected void sublayout(int maxWidth, int maxHeight) {

                setExtent(Display.getWidth() / 2, Display.getHeight() / 2);
            }

        };

this sample code is for hint only. by overriding paint(),sublayout() and drawFocus(). you can customize manager.

Vivart
hello Vivart thanks for quick reply. According to your suggestion it fill round rect by changing some code but it does not display vertical field manager content. It on display filled round rect. I think this is because after painting all the fields inside the manager it will call the manager's paint. Please tell me the way so I will able to draw fields/components inside the manager after drawing it's background. Please check (http://www.freeimagehosting.net/image.php?a0d61a80d8.jpg) for my requirement. And check (http://www.freeimagehosting.net/image.php?81c13e12af.jpg) current screen
Sachin