Pages

about my opensource eclipse java applications recently i'm studying GWT and Android

Sunday, August 07, 2005

Customize BorderLayout of Draw2D


If you customized BorderLayout.java ,you could do such things.

Certainly,If you overwrited getPreferedSize(),and you could do.
But If you did customize BorderLayout,You could control center figure of BorderLayout.
It's simple and usefull.

I copy from BorderLayout.java to CustomBorderLayout.java

and new field.
and create both of get and set methods.
private boolean stretchCenterWidth=true;
private boolean stretchCenterHeight=false;


and ,on layout() methods,
I replace code to when stretchCenter* is true,layoutmanager stretch figure width or height.
if(!stretchCenterHeight){
if (childSize.height <>
area.y += (area.height - childSize.height) / 2;
area.height = childSize.height;
}
}

if(!stretchCenterWidth){
if (childSize.width <>
area.x += (area.width - childSize.width) / 2;
area.width = childSize.width;
}
}
finally use call in your program like this.
CustomBorderLayout layout=new CustomBorderLayout(); layout.setStretchCenterWidth(true);
layout.setStretchCenterHeight(true);


FullCode
http://cvs.sourceforge.jp/cgi-bin/viewcvs.cgi/akjrcp/draw2dexample/src/example/draw2d/CustomBorderLayoutTest.java?rev=1.1&content-type=text/vnd.viewcvs-markup

7 comments:

Truecacuentos said...

great info!!! It´s just what i need

thanks ;)

Anonymous said...

Hello! 

Not sure if this is the right place to post this, but here is the story of my dog called Shandy.
He was my favourite pet and he was very lively, lots of fun and very obedient. His main
passion in life was to be taken for a long walk, culminating with a big run out in his favourite
park. I would try to take him on this walk everyday, weather permitting. The park itself
was about three miles away from our house. What do you think?

By the way, I love that too!  Where did you get that at?  

See you soon! WonderGirl 




how I make money with paid surveys

Anonymous said...

Hello! 

How do you change the size of your monitor?

Wow, I've found the same to be true too!  How did you find that?  

Bye, - MyGirl! 


how I make money with paid surveys

Anonymous said...

The best cars
dollar rent a car
car crash
auto insurance company
used car san diego
car price
avis car rental
new car
car auction

webmaster said...

In order to make money online in the best possible way, you need to figure out effective business strategies and we can help you with that. We, at Infinity Informations, are well known all over for providing efficient business solutions to our clients all over the world and as soon as you utilize our ecommerce solutions for the purpose of facilitating your online business, you would notice sudden and tremendous growth in your ecommerce venture. So, contact http://www.infyecommercesolution.com immediately and facilitate your online business.

Android app development said...

This is one of the genius and flexible post.I like your blog creativity.
Android app developers

Android developer said...

I absolutely enjoyed reading and hope you keep updating it frequently! I absolutely liked the abstraction you accept aloft here. It is actual accessible and advantageous one.

Android developer