Some improvements to sashform

Source: Internet
Author: User

When developing a Java program using eclipse, friends who have used sashform must know its functions. Yes, it is a container. The control placed in this container can be customized, and the control size can be changed by dragging sash. You can set the relative size of each control in sashform through sashform. setweights (INT [] weights.
Well, that's all right. However, if I want to fix the size of one (or more) Control in sashform (the size of this control remains unchanged when the size of sashform changes ), it is only when the sash adjacent to this control is dragged and the size of the sash changes. In this case, sashform will not be able to work properly.
So I wrote it again, called csashform. In addition to all the functions of sashform, it can also set a fixed size for its children control, I added an interface for it, public void setexactsizes (INT [] sizes ). This function is used to set the fixed size of each sub-control. The value range of each size is an integer greater than or equal to 0 or csashformdata. not_set, when the value is csashformdata. when not_set is used, it indicates that no value is set for it. If the control in sashform is vertically arranged, size is its height. If it is horizontally arranged, size is its width.

In use, setweights () and setsizes () can be used together (either separately ).
Example: Assume that a csashform control is horizontally arranged and has four controls. I want the width of 3rd controls to be 50 and the width ratio of other controls, then I can write the following two lines of code:

Csashform. setweights (
New
 
Int
[]
...
{


1
,
2
, Csashformdata. not_set,
3


}

);

Csashform. setsizes (
New
 
Int
[]
...
{



Csashformdata. not_set

,

Csashformdata. not_set

,
50
, Csashformdata. not_set

}

);

  
After my preliminary test, the program running result is normal. However, the running efficiency is not ideal. When the csashform is dragged, it will flash when the control size is changed. I will further improve it later.
I will not explain the specific implementation. If you are interested in the source code, click here.
Download. You can also use it for free, but you must follow eclipse Public License V1.0
. If you find any defect or have a good improvement method, contact me.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.