本文整理汇总了Java中org.esa.snap.ui.GridBagUtils.createPanel方法的典型用法代码示例。如果您正苦于以下问题:Java GridBagUtils.createPanel方法的具体用法?Java GridBagUtils.createPanel怎么用?Java GridBagUtils.createPanel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.esa.snap.ui.GridBagUtils
的用法示例。
在下文中一共展示了GridBagUtils.createPanel方法的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: 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;
}
示例9: showResults
import org.esa.snap.ui.GridBagUtils; //导入方法依赖的package包/类
private void showResults(MaskAreaStatistics areaStatistics) {
final double roundFactor = 10000.0;
final double maskAreaR = MathUtils.round(areaStatistics.getMaskArea(), roundFactor);
final double meanPixelAreaR = MathUtils.round(areaStatistics.getMaskArea() / areaStatistics.getNumPixels(),
roundFactor);
final double pixelAreaMinR = MathUtils.round(areaStatistics.getPixelAreaMin(), roundFactor);
final double pixelAreaMaxR = MathUtils.round(areaStatistics.getPixelAreaMax(), roundFactor);
final JPanel content = GridBagUtils.createPanel();
final GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets.right = 4;
gbc.gridy = 0;
gbc.weightx = 0;
gbc.insets.top = 2;
addField(content, gbc, "Number of Mask pixels:", String.format("%15d", areaStatistics.getNumPixels()), "");
addField(content, gbc, "Mask area:", String.format("%15.3f", maskAreaR), "km^2");
addField(content, gbc, "Mean pixel area:", String.format("%15.3f", meanPixelAreaR), "km^2");
addField(content, gbc, "Minimum pixel area:", String.format("%15.3f", pixelAreaMinR), "km^2");
addField(content, gbc, "Maximum pixel area:", String.format("%15.3f", pixelAreaMaxR), "km^2");
gbc.insets.top = 8;
addField(content, gbc, "Mean earth radius:", String.format("%15.3f", areaStatistics.getEarthRadius()), "km");
final ModalDialog dialog = new ModalDialog(SnapApp.getDefault().getMainFrame(),
Bundle.CTL_ComputeMaskAreaAction_DialogTitle() + " - " + mask.getDisplayName(),
content,
ModalDialog.ID_OK | ModalDialog.ID_HELP,
getHelpCtx().getHelpID());
dialog.show();
}
示例10: createPageUIContentPane
import org.esa.snap.ui.GridBagUtils; //导入方法依赖的package包/类
private static JPanel createPageUIContentPane(JPanel pane) {
JPanel contentPane = GridBagUtils.createPanel();
final GridBagConstraints gbc = GridBagUtils.createConstraints("fill=HORIZONTAL,anchor=NORTHWEST");
gbc.insets.top = 15;
gbc.weightx = 1;
gbc.weighty = 0;
contentPane.add(pane, gbc);
GridBagUtils.addVerticalFiller(contentPane, gbc);
return contentPane;
}
示例11: createCheckersPane
import org.esa.snap.ui.GridBagUtils; //导入方法依赖的package包/类
private JPanel createCheckersPane() {
checkBoxes = new JCheckBox[allProducts.length];
final JPanel checkersPane = GridBagUtils.createPanel();
final GridBagConstraints gbc = GridBagUtils.createConstraints("insets.left=4,anchor=WEST,fill=HORIZONTAL");
final StringBuffer description = new StringBuffer();
addProductCheckers(description, checkersPane, gbc);
return checkersPane;
}
示例12: createPanel
import org.esa.snap.ui.GridBagUtils; //导入方法依赖的package包/类
public JPanel createPanel() {
final JPanel roiMaskPanel = GridBagUtils.createPanel();
GridBagConstraints roiMaskPanelConstraints = GridBagUtils.createConstraints("anchor=SOUTHWEST,fill=HORIZONTAL,insets.top=2");
GridBagUtils.addToPanel(roiMaskPanel, useRoiMaskCheckBox, roiMaskPanelConstraints,
",gridy=0,gridx=0,weightx=1");
GridBagUtils.addToPanel(roiMaskPanel, roiMaskComboBox, roiMaskPanelConstraints,
"gridy=1,insets.left=4");
GridBagUtils.addToPanel(roiMaskPanel, showMaskManagerButton, roiMaskPanelConstraints,
"gridheight=2,gridy=0,gridx=1,weightx=0,ipadx=5,insets.left=0");
return roiMaskPanel;
}
示例13: createUI
import org.esa.snap.ui.GridBagUtils; //导入方法依赖的package包/类
private JComponent createUI() {
editExpressionButton = new JButton("Edit Expression...");
editExpressionButton.setName("editExpressionButton");
editExpressionButton.addActionListener(createEditExpressionButtonListener());
final JPanel gridPanel = GridBagUtils.createPanel();
int line = 0;
final GridBagConstraints gbc = new GridBagConstraints();
gbc.gridy = ++line;
GridBagUtils.addToPanel(gridPanel, paramBand.getEditor().getLabelComponent(), gbc,
"weightx=0, insets.top=3, gridwidth=1, fill=HORIZONTAL, anchor=WEST");
GridBagUtils.addToPanel(gridPanel, paramBand.getEditor().getComponent(), gbc,
"weightx=1, insets.top=3, gridwidth=2, fill=HORIZONTAL, anchor=WEST");
gbc.gridy = ++line;
GridBagUtils.addToPanel(gridPanel, paramBandType.getEditor().getLabelComponent(), gbc,
"weightx=0, insets.top=3, gridwidth=1, fill=HORIZONTAL, anchor=WEST");
GridBagUtils.addToPanel(gridPanel, paramBandType.getEditor().getComponent(), gbc,
"weightx=1, insets.top=3, gridwidth=2, fill=HORIZONTAL, anchor=WEST");
gbc.gridy = ++line;
GridBagUtils.addToPanel(gridPanel, paramBandUnit.getEditor().getLabelComponent(), gbc,
"weightx=0, insets.top=3, gridwidth=1, fill=HORIZONTAL, anchor=WEST");
GridBagUtils.addToPanel(gridPanel, paramBandUnit.getEditor().getComponent(), gbc,
"weightx=1, insets.top=3, gridwidth=2, fill=HORIZONTAL, anchor=WEST");
gbc.gridy = ++line;
GridBagUtils.addToPanel(gridPanel, paramNoDataValue.getEditor().getLabelComponent(), gbc,
"weightx=0, insets.top=3, gridwidth=1, fill=HORIZONTAL, anchor=WEST");
GridBagUtils.addToPanel(gridPanel, paramNoDataValue.getEditor().getComponent(), gbc,
"weightx=1, insets.top=3, gridwidth=2, fill=HORIZONTAL, anchor=WEST");
gbc.gridy = ++line;
GridBagUtils.addToPanel(gridPanel, paramExpression.getEditor().getLabelComponent(), gbc,
"weightx=0, insets.top=3, gridwidth=1, fill=HORIZONTAL, anchor=NORTHWEST");
GridBagUtils.addToPanel(gridPanel, paramExpression.getEditor().getComponent(), gbc,
"weightx=1, weighty=1, insets.top=3, gridwidth=2, fill=BOTH, anchor=WEST");
gbc.gridy = ++line;
GridBagUtils.addToPanel(gridPanel, editExpressionButton, gbc,
"weighty=0, insets.top=3, gridwidth=3, fill=NONE, anchor=EAST");
return gridPanel;
}
示例14: initUI
import org.esa.snap.ui.GridBagUtils; //导入方法依赖的package包/类
private void initUI() throws Exception {
final JPanel contentPane = new JPanel(new BorderLayout(4, 4));
final JPanel northPane = GridBagUtils.createPanel();
final GridBagConstraints gbc = DialogUtils.createGridBagConstraints();
gbc.gridy++;
DialogUtils.addComponent(northPane, gbc, "Name:", nameField);
gbc.gridy++;
DialogUtils.addComponent(northPane, gbc, "Input Folder:", inputFolderField);
inputFolderField.setColumns(50);
gbc.gridx = 2;
northPane.add(inputFolderButton, gbc);
gbc.gridy++;
DialogUtils.addComponent(northPane, gbc, "Output Folder:", outputFolderField);
gbc.gridx = 2;
northPane.add(outputFolderButton, gbc);
gbc.gridy++;
DialogUtils.addComponent(northPane, gbc, "Processing Graph:", graphField);
gbc.gridx = 2;
northPane.add(graphButton, gbc);
gbc.gridy++;
gbc.gridx = 0;
northPane.add(pairsCheckBox, gbc);
gbc.gridx = 1;
final JLabel maxSlavesLabel = new JLabel("Max Number of Slaves:");
maxSlavesLabel.setHorizontalAlignment(JLabel.RIGHT);
northPane.add(maxSlavesLabel, gbc);
gbc.gridx = 2;
northPane.add(maxSlavesField, gbc);
repositoryListCombo = new JComboBox<>();
repositoryListCombo.setRenderer(new ComboCellRenderer());
repositoryListCombo.setVisible(false);
repositoryListCombo.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent event) {
if (event.getStateChange() == ItemEvent.SELECTED) {
final RepositoryInterface repo = (RepositoryInterface)repositoryListCombo.getSelectedItem();
dbPane.setRepository(repo);
}
}
});
gbc.gridy++;
gbc.gridx = 0;
gbc.gridwidth = 1;
northPane.add(repositoryListCombo, gbc);
contentPane.add(northPane, BorderLayout.NORTH);
final MyDatabaseQueryListener dbQueryListener = new MyDatabaseQueryListener();
dbPane = new DatabasePane();
dbPane.setDBQuery(aoi.getSlaveDBQuery());
dbPane.addListener(dbQueryListener);
dbPane.setVisible(false);
contentPane.add(dbPane, BorderLayout.WEST);
worldMapUI = new WorldMapUI();
worldMapUI.addListener(dbQueryListener);
contentPane.add(worldMapUI.getWorlMapPane(), BorderLayout.EAST);
setContent(contentPane);
}
示例15: createUI
import org.esa.snap.ui.GridBagUtils; //导入方法依赖的package包/类
private void createUI() {
ActionListener productNodeCheckListener = e -> updateUIState();
checkers = new ArrayList<>(10);
JPanel checkersPane = GridBagUtils.createPanel();
setComponentName(checkersPane, "CheckersPane");
GridBagConstraints gbc = GridBagUtils.createConstraints("insets.left=4,anchor=WEST,fill=HORIZONTAL");
for (int i = 0; i < productNodes.length; i++) {
ProductNode productNode = productNodes[i];
String name = productNode.getName();
JCheckBox productNodeCheck = new JCheckBox(name);
productNodeCheck.setSelected(selected);
productNodeCheck.setFont(SMALL_PLAIN_FONT);
productNodeCheck.addActionListener(productNodeCheckListener);
if (includeAlways != null
&& StringUtils.containsIgnoreCase(includeAlways, name)) {
productNodeCheck.setSelected(true);
productNodeCheck.setEnabled(false);
} else if (givenProductSubsetDef != null) {
productNodeCheck.setSelected(givenProductSubsetDef.containsNodeName(name));
}
checkers.add(productNodeCheck);
String description = productNode.getDescription();
JLabel productNodeLabel = new JLabel(description != null ? description : " ");
productNodeLabel.setFont(SMALL_ITALIC_FONT);
GridBagUtils.addToPanel(checkersPane, productNodeCheck, gbc, "weightx=0,gridx=0,gridy=" + i);
GridBagUtils.addToPanel(checkersPane, productNodeLabel, gbc, "weightx=1,gridx=1,gridy=" + i);
}
// Add a last 'filler' row
GridBagUtils.addToPanel(checkersPane, new JLabel(" "), gbc,
"gridwidth=2,weightx=1,weighty=1,gridx=0,gridy=" + productNodes.length);
ActionListener allCheckListener = e -> {
if (e.getSource() == allCheck) {
checkAllProductNodes(true);
} else if (e.getSource() == noneCheck) {
checkAllProductNodes(false);
}
updateUIState();
};
allCheck = new JCheckBox("Select all");
allCheck.setName("selectAll");
allCheck.setMnemonic('a');
allCheck.addActionListener(allCheckListener);
noneCheck = new JCheckBox("Select none");
noneCheck.setName("SelectNone");
noneCheck.setMnemonic('n');
noneCheck.addActionListener(allCheckListener);
JScrollPane scrollPane = new JScrollPane(checkersPane);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
JPanel buttonRow = new JPanel(new FlowLayout(FlowLayout.LEFT, 4, 4));
buttonRow.add(allCheck);
buttonRow.add(noneCheck);
setLayout(new BorderLayout());
add(scrollPane, BorderLayout.CENTER);
add(buttonRow, BorderLayout.SOUTH);
setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7));
updateUIState();
}