本文整理匯總了Java中org.eclipse.swt.custom.SashForm.getWeights方法的典型用法代碼示例。如果您正苦於以下問題:Java SashForm.getWeights方法的具體用法?Java SashForm.getWeights怎麽用?Java SashForm.getWeights使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.custom.SashForm
的用法示例。
在下文中一共展示了SashForm.getWeights方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: backupWeightsAndSize
import org.eclipse.swt.custom.SashForm; //導入方法依賴的package包/類
private void backupWeightsAndSize(Position pos) {
SashForm sf = positionSashFormMap.get(pos);
if (sf != null) {
weightsBackup.get(sf)[0] = sf.getWeights()[0];
weightsBackup.get(sf)[1] = sf.getWeights()[1];
}
}
示例2: restoreSashWeight
import org.eclipse.swt.custom.SashForm; //導入方法依賴的package包/類
/**
* Restore the sash weight from a memento
*
* @param sash
* @param fMemento
* @param weightKey
* @param sashDefaultWeight
*/
public static void restoreSashWeight( final SashForm sash,
final IMemento fMemento,
final String weightKey,
final int[] sashDefaultWeight) {
final int[] sashWeights = sash.getWeights();
final int[] newWeights = new int[sashWeights.length];
for (int weightIndex = 0; weightIndex < sashWeights.length; weightIndex++) {
final Integer mementoWeight = fMemento.getInteger(weightKey + Integer.toString(weightIndex));
if (mementoWeight == null) {
try {
newWeights[weightIndex] = sashDefaultWeight[weightIndex];
} catch (final ArrayIndexOutOfBoundsException e) {
newWeights[weightIndex] = 100;
}
} else {
newWeights[weightIndex] = mementoWeight;
}
}
sash.setWeights(newWeights);
}
示例3: saveSashWeight
import org.eclipse.swt.custom.SashForm; //導入方法依賴的package包/類
/**
* Store the weights for the sash in a memento
*
* @param sashForm
* @param state
* @param weightKey
*/
public static void saveSashWeight(final SashForm sashForm, final IDialogSettings state, final String weightKey) {
final int[] weights = sashForm.getWeights();
for (int weightIndex = 0; weightIndex < weights.length; weightIndex++) {
state.put(weightKey + Integer.toString(weightIndex), weights[weightIndex]);
}
}