本文整理汇总了Java中org.esa.snap.ui.GridBagUtils类的典型用法代码示例。如果您正苦于以下问题:Java GridBagUtils类的具体用法?Java GridBagUtils怎么用?Java GridBagUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GridBagUtils类属于org.esa.snap.ui包,在下文中一共展示了GridBagUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PromptDialog
import org.esa.snap.ui.GridBagUtils; //导入依赖的package包/类
public PromptDialog(final String title, final Descriptor[] descriptorList) {
super(SnapApp.getDefault().getMainFrame(), title, ModalDialog.ID_OK_CANCEL, null);
final JPanel content = GridBagUtils.createPanel();
final GridBagConstraints gbc = DialogUtils.createGridBagConstraints();
gbc.insets.right = 4;
gbc.insets.top = 2;
for(Descriptor descriptor : descriptorList) {
final JComponent prompt = addComponent(content, gbc, descriptor.label, descriptor.defaultValue, descriptor.type);
componentMap.put(descriptor.label, prompt);
gbc.gridy++;
}
getJDialog().setMinimumSize(new Dimension(400, 100));
setContent(content);
}
示例2: AttributeDialog
import org.esa.snap.ui.GridBagUtils; //导入依赖的package包/类
public AttributeDialog(final String title, final String[] listData, final String defaultValue) {
super(SnapApp.getDefault().getMainFrame(), title, ModalDialog.ID_OK, null);
listControl = new JList<>(listData);
if(defaultValue != null) {
listControl.setSelectedValue(defaultValue, true);
}
final JPanel content = GridBagUtils.createPanel();
final GridBagConstraints gbc = DialogUtils.createGridBagConstraints();
gbc.insets.top = 2;
JScrollPane scrollPane = new JScrollPane();
scrollPane.setViewportView(listControl);
content.add(scrollPane, gbc);
getJDialog().setMinimumSize(new Dimension(400, 100));
setContent(content);
}
示例3: createCheckersPane
import org.esa.snap.ui.GridBagUtils; //导入依赖的package包/类
@Override
public JPanel createCheckersPane() {
int length = 0;
if (allBands != null) {
length += allBands.length;
}
if (allTiePointGrids != null) {
length += allTiePointGrids.length;
}
checkBoxes = new JCheckBox[length];
final JPanel checkersPane = GridBagUtils.createPanel();
final GridBagConstraints gbc = GridBagUtils.createConstraints("insets.left=4,anchor=NORTHWEST,fill=HORIZONTAL");
final ActionListener checkListener = createActionListener();
addBandCheckers(new StringBuffer(), checkersPane, gbc, checkListener);
addTiePointCheckers(new StringBuffer(), checkersPane, gbc, checkListener);
GridBagUtils.addVerticalFiller(checkersPane, gbc);
return checkersPane;
}
示例4: createGeoCoordinatesPane
import org.esa.snap.ui.GridBagUtils; //导入依赖的package包/类
private JPanel createGeoCoordinatesPane() {
JPanel geoCoordinatesPane = GridBagUtils.createPanel();
setComponentName(geoCoordinatesPane, "geoCoordinatesPane");
GridBagConstraints gbc = GridBagUtils.createConstraints(
"insets.left=3,anchor=WEST,fill=HORIZONTAL, weightx=1.0");
GridBagUtils.setAttributes(gbc, "insets.top=4");
GridBagUtils.addToPanel(geoCoordinatesPane, new JLabel("North latitude bound:"), gbc, "gridx=0,gridy=0");
GridBagUtils.addToPanel(geoCoordinatesPane, UIUtils.createSpinner(paramNorthLat1, 1.0, "#0.00#"),
gbc, "gridx=1,gridy=0");
GridBagUtils.setAttributes(gbc, "insets.top=1");
GridBagUtils.addToPanel(geoCoordinatesPane, new JLabel("West longitude bound:"), gbc, "gridx=0,gridy=1");
GridBagUtils.addToPanel(geoCoordinatesPane, UIUtils.createSpinner(paramWestLon1, 1.0, "#0.00#"),
gbc, "gridx=1,gridy=1");
GridBagUtils.setAttributes(gbc, "insets.top=4");
GridBagUtils.addToPanel(geoCoordinatesPane, new JLabel("South latitude bound:"), gbc, "gridx=0,gridy=2");
GridBagUtils.addToPanel(geoCoordinatesPane, UIUtils.createSpinner(paramSouthLat2, 1.0, "#0.00#"),
gbc, "gridx=1,gridy=2");
GridBagUtils.setAttributes(gbc, "insets.top=1");
GridBagUtils.addToPanel(geoCoordinatesPane, new JLabel("East longitude bound:"), gbc, "gridx=0,gridy=3");
GridBagUtils.addToPanel(geoCoordinatesPane, UIUtils.createSpinner(paramEastLon2, 1.0, "#0.00#"),
gbc, "gridx=1,gridy=3");
return geoCoordinatesPane;
}
示例5: createPixelCoordinatesPane
import org.esa.snap.ui.GridBagUtils; //导入依赖的package包/类
private JPanel createPixelCoordinatesPane() {
GridBagConstraints gbc = GridBagUtils.createConstraints(
"insets.left=3,anchor=WEST,fill=HORIZONTAL, weightx=1.0");
JPanel pixelCoordinatesPane = GridBagUtils.createPanel();
setComponentName(pixelCoordinatesPane, "pixelCoordinatesPane");
GridBagUtils.setAttributes(gbc, "insets.top=4");
GridBagUtils.addToPanel(pixelCoordinatesPane, new JLabel("Scene start X:"), gbc, "gridx=0,gridy=0");
GridBagUtils.addToPanel(pixelCoordinatesPane, UIUtils.createSpinner(paramX1, 25, "#0"),
gbc, "gridx=1,gridy=0");
GridBagUtils.setAttributes(gbc, "insets.top=1");
GridBagUtils.addToPanel(pixelCoordinatesPane, new JLabel("Scene start Y:"), gbc, "gridx=0,gridy=1");
GridBagUtils.addToPanel(pixelCoordinatesPane, UIUtils.createSpinner(paramY1, 25, "#0"),
gbc, "gridx=1,gridy=1");
GridBagUtils.setAttributes(gbc, "insets.top=4");
GridBagUtils.addToPanel(pixelCoordinatesPane, new JLabel("Scene end X:"), gbc, "gridx=0,gridy=2");
GridBagUtils.addToPanel(pixelCoordinatesPane, UIUtils.createSpinner(paramX2, 25, "#0"),
gbc, "gridx=1,gridy=2");
GridBagUtils.setAttributes(gbc, "insets.top=1");
GridBagUtils.addToPanel(pixelCoordinatesPane, new JLabel("Scene end Y:"), gbc, "gridx=0,gridy=3");
GridBagUtils.addToPanel(pixelCoordinatesPane, UIUtils.createSpinner(paramY2, 25, "#0"),
gbc, "gridx=1,gridy=3");
return pixelCoordinatesPane;
}
示例6: addSubsetAcessory
import org.esa.snap.ui.GridBagUtils; //导入依赖的package包/类
private void addSubsetAcessory() {
subsetButton = new JButton("Subset...");
subsetButton.setMnemonic('S');
subsetButton.addActionListener(e -> openProductSubsetDialog());
subsetButton.setEnabled(getSelectedFile() != null || productToExport != null);
sizeLabel = new JLabel("0 M");
sizeLabel.setHorizontalAlignment(JLabel.RIGHT);
JPanel panel = GridBagUtils.createPanel();
GridBagConstraints gbc = GridBagUtils.createConstraints(
"fill=HORIZONTAL,weightx=1,anchor=NORTHWEST,insets.left=7,insets.right=7,insets.bottom=4");
GridBagUtils.addToPanel(panel, subsetButton, gbc, "gridy=0");
GridBagUtils.addToPanel(panel, sizeLabel, gbc, "gridy=1");
GridBagUtils.addVerticalFiller(panel, gbc);
setAccessory(panel);
addPropertyChangeListener(e -> updateState());
}
示例7: createOptionsPanel
import org.esa.snap.ui.GridBagUtils; //导入依赖的package包/类
private JPanel createOptionsPanel() {
toggleColorCheckBox = new JCheckBox("Invert plot colors");
toggleColorCheckBox.addActionListener(e -> toggleColor());
toggleColorCheckBox.setEnabled(false);
final JPanel optionsPanel = GridBagUtils.createPanel();
final GridBagConstraints gbc = GridBagUtils.createConstraints("anchor=NORTHWEST,fill=HORIZONTAL,insets.top=0,weightx=1,gridx=0");
GridBagUtils.addToPanel(optionsPanel, axisRangeControls[X_VAR].getPanel(), gbc, "gridy=0, insets.top=2");
GridBagUtils.addToPanel(optionsPanel, xProductList, gbc, "gridy=1,insets.left=4,insets.right=2");
GridBagUtils.addToPanel(optionsPanel, xBandList, gbc, "gridy=2,insets.left=4,insets.right=2");
GridBagUtils.addToPanel(optionsPanel, axisRangeControls[Y_VAR].getPanel(), gbc, "gridy=3,insets.left=0,insets.right=0");
GridBagUtils.addToPanel(optionsPanel, yProductList, gbc, "gridy=4,insets.left=4,insets.right=2");
GridBagUtils.addToPanel(optionsPanel, yBandList, gbc, "gridy=5,insets.left=4,insets.right=2");
GridBagUtils.addToPanel(optionsPanel, new JPanel(), gbc, "gridy=6");
GridBagUtils.addToPanel(optionsPanel, new JSeparator(), gbc, "gridy=7,insets.left=4,insets.right=2");
GridBagUtils.addToPanel(optionsPanel, toggleColorCheckBox, gbc, "gridy=8,insets.left=0,insets.right=0");
return optionsPanel;
}
示例8: NewClassifierDialog
import org.esa.snap.ui.GridBagUtils; //导入依赖的package包/类
public NewClassifierDialog(String title, String labelStr, String defaultValue) {
super(SnapApp.getDefault().getMainFrame(), title, ModalDialog.ID_OK, null);
final JPanel contentPane = new JPanel(new GridBagLayout());
final GridBagConstraints gbc = GridBagUtils.createDefaultConstraints();
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.gridx = 0;
gbc.gridy = 0;
nameTextField = new JTextField(defaultValue);
nameTextField.setColumns(24);
contentPane.add(new JLabel(labelStr), gbc);
gbc.gridx = 1;
contentPane.add(nameTextField, gbc);
setContent(contentPane);
}
示例9: SearchableFieldsDialog
import org.esa.snap.ui.GridBagUtils; //导入依赖的package包/类
public SearchableFieldsDialog(String title, String labelStr, String defaultValue) {
super(SnapApp.getDefault().getMainFrame(), title, ModalDialog.ID_OK, null);
final JPanel contentPane = new JPanel(new GridBagLayout());
final GridBagConstraints gbc = GridBagUtils.createDefaultConstraints();
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.gridx = 0;
gbc.gridy = 0;
textField = new JTextArea(defaultValue);
textField.setColumns(60);
textField.setRows(20);
contentPane.add(new JScrollPane(textField), gbc);
setContent(contentPane);
}
示例10: createGridBagConstraints
import org.esa.snap.ui.GridBagUtils; //导入依赖的package包/类
public static GridBagConstraints createGridBagConstraints() {
final GridBagConstraints gbc = GridBagUtils.createDefaultConstraints();
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.insets.top = 1;
gbc.insets.bottom = 1;
gbc.insets.right = 1;
gbc.insets.left = 1;
gbc.gridx = 0;
gbc.gridy = 0;
return gbc;
}
示例11: createCheckersPane
import org.esa.snap.ui.GridBagUtils; //导入依赖的package包/类
public JPanel createCheckersPane() {
DefaultMutableTreeNode root = new DefaultMutableTreeNode();
Map<String, Integer> groupNodeMap = initGrouping(root);
List<TreePath> selectedPaths = new ArrayList<>();
addBandCheckBoxes(root, selectedPaths, groupNodeMap);
addTiePointGridCheckBoxes(root, selectedPaths, groupNodeMap);
removeEmptyGroups(root, groupNodeMap);
TreeModel treeModel = new DefaultTreeModel(root);
checkBoxTree = new CheckBoxTree(treeModel);
checkBoxTree.getCheckBoxTreeSelectionModel().setSelectionPaths(selectedPaths.toArray(new TreePath[selectedPaths.size()]));
checkBoxTree.setRootVisible(false);
checkBoxTree.setShowsRootHandles(true);
checkBoxTree.getCheckBoxTreeSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
@Override
public void valueChanged(TreeSelectionEvent e) {
updateCheckBoxStates();
}
});
final DefaultTreeCellRenderer renderer = (DefaultTreeCellRenderer) checkBoxTree.getActualCellRenderer();
renderer.setFont(SMALL_ITALIC_FONT);
renderer.setLeafIcon(null);
renderer.setOpenIcon(null);
renderer.setClosedIcon(null);
Color color = new Color(240, 240, 240);
checkBoxTree.setBackground(color);
renderer.setBackgroundSelectionColor(color);
renderer.setBackgroundNonSelectionColor(color);
renderer.setBorderSelectionColor(color);
renderer.setTextSelectionColor(Color.BLACK);
GridBagConstraints gbc2 = GridBagUtils.createConstraints("insets.left=4,anchor=WEST,fill=BOTH");
final JPanel checkersPane = GridBagUtils.createPanel();
GridBagUtils.addToPanel(checkersPane, checkBoxTree, gbc2, "weightx=1.0,weighty=1.0");
return checkersPane;
}
示例12: addBandCheckers
import org.esa.snap.ui.GridBagUtils; //导入依赖的package包/类
private void addBandCheckers(final StringBuffer description, final JPanel checkersPane,
final GridBagConstraints gbc, final ActionListener checkListener) {
for (int i = 0; i < allBands.length; i++) {
Band band = allBands[i];
boolean checked = false;
for (Band selectedBand : selectedBands) {
if (band == selectedBand) {
checked = true;
numSelected++;
break;
}
}
description.setLength(0);
description.append(band.getDescription() == null ? "" : band.getDescription());
if (band.getSpectralWavelength() > 0.0) {
description.append(" (");
description.append(band.getSpectralWavelength());
description.append(" nm)");
}
final JCheckBox check = new JCheckBox(getRasterDisplayName(band), checked);
check.setFont(SMALL_PLAIN_FONT);
check.addActionListener(checkListener);
final JLabel label = new JLabel(description.toString());
label.setFont(SMALL_ITALIC_FONT);
gbc.gridy++;
GridBagUtils.addToPanel(checkersPane, check, gbc, "weightx=0,gridx=0");
GridBagUtils.addToPanel(checkersPane, label, gbc, "weightx=1,gridx=1");
checkBoxes[i] = check;
}
}
示例13: addTiePointCheckers
import org.esa.snap.ui.GridBagUtils; //导入依赖的package包/类
private void addTiePointCheckers(final StringBuffer description, final JPanel checkersPane,
final GridBagConstraints gbc, final ActionListener checkListener) {
for (int i = 0; i < allTiePointGrids.length; i++) {
TiePointGrid grid = allTiePointGrids[i];
boolean checked = false;
for (TiePointGrid selectedGrid : selectedTiePointGrids) {
if (grid == selectedGrid) {
checked = true;
numSelected++;
break;
}
}
description.setLength(0);
description.append(grid.getDescription() == null ? "" : grid.getDescription());
final JCheckBox check = new JCheckBox(getRasterDisplayName(grid), checked);
check.setFont(SMALL_PLAIN_FONT);
check.addActionListener(checkListener);
final JLabel label = new JLabel(description.toString());
label.setFont(SMALL_ITALIC_FONT);
gbc.gridy++;
GridBagUtils.addToPanel(checkersPane, check, gbc, "weightx=0,gridx=0");
GridBagUtils.addToPanel(checkersPane, label, gbc, "weightx=1,gridx=1");
checkBoxes[i + allBands.length] = check;
}
}
示例14: buildUI
import org.esa.snap.ui.GridBagUtils; //导入依赖的package包/类
private void buildUI() {
setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.insets = new Insets(DEFAULT_PADDING, DEFAULT_PADDING, DEFAULT_PADDING, DEFAULT_PADDING);
gbc.weighty = 0.01;
addTab("Windows Bundle", createTab(OSFamily.windows));
addTab("Linux Bundle", createTab(OSFamily.linux));
addTab("MacOSX Bundle", createTab(OSFamily.macosx));
GridBagUtils.addToPanel(this, this.bundleTabPane, gbc, "gridx=0, gridy=0, gridwidth=11, weightx=1");
GridBagUtils.addToPanel(this, new JLabel("Reflect in Variable:"), gbc, "gridx=0, gridy=1, gridwidth=1, weightx=0");
variablesCombo = getEditorComponent(OSFamily.all, "updateVariable", this.variables.stream().map(SystemVariable::getKey).toArray());
GridBagUtils.addToPanel(this, variablesCombo, gbc, "gridx=1, gridy=1, gridwidth=10, weightx=0");
GridBagUtils.addToPanel(this, new JLabel(" "), gbc, "gridx=0, gridy=2, gridwidth=11, weighty=1");
int selected = 0;
switch (Bundle.getCurrentOS()) {
case windows:
selected = 0;
break;
case linux:
selected = 1;
break;
case macosx:
selected = 2;
break;
}
this.bundleTabPane.setSelectedIndex(selected);
this.bundleTabPane.setUI(new BasicTabbedPaneUI());
}
示例15: run
import org.esa.snap.ui.GridBagUtils; //导入依赖的package包/类
@Override
public void run() {
try {
Path sourceBasePath = ResourceInstaller.findModuleCodeBasePath(GridBagUtils.class);
Path auxdataDir = getColorPalettesDir();
Path sourceDirPath = sourceBasePath.resolve("auxdata/color_palettes");
final ResourceInstaller resourceInstaller = new ResourceInstaller(sourceDirPath, auxdataDir);
resourceInstaller.install(".*.cpd", ProgressMonitor.NULL);
defaultColorPalettesInstalled = true;
} catch (IOException e) {
SnapApp.getDefault().handleError("Unable to install colour palettes", e);
}
}