List of usage examples for com.jgoodies.forms.layout ConstantSize getUnit
public Unit getUnit()
From source file:com.intellij.uiDesigner.radComponents.FormLayoutColumnProperties.java
License:Apache License
private static void showConstantSize(final ConstantSize size, final JComboBox unitsCombo, final JSpinner spinner) { double value = size.getValue(); ConstantSize.Unit unit = size.getUnit(); if (unit.equals(ConstantSize.DIALOG_UNITS_X) || unit.equals(ConstantSize.DIALOG_UNITS_Y)) { unitsCombo.setSelectedItem("dlu"); } else {/*from w w w. ja v a 2s . co m*/ unitsCombo.setSelectedItem(unit.abbreviation()); } spinner.setModel(new SpinnerNumberModel(0.0, 0.0, Double.MAX_VALUE, 1.0)); spinner.setValue(value); }
From source file:com.intellij.uiDesigner.radComponents.RadFormLayoutManager.java
License:Apache License
private static ConstantSize scaleSize(final FormSpec rowSpec, final RadContainer container, final int newPx) { if (rowSpec.getSize() instanceof ConstantSize) { ConstantSize oldSize = (ConstantSize) rowSpec.getSize(); int oldPx = oldSize.getPixelSize(container.getDelegee()); double newValue = Math.round(oldSize.getValue() * newPx / oldPx * 10) / 10; return new ConstantSize(newValue, oldSize.getUnit()); }/* w ww . j av a2 s. c om*/ return new ConstantSize(newPx, ConstantSize.PIXEL); }