当前位置: 首页>>代码示例>>Java>>正文


Java GridBagUtils.createConstraints方法代码示例

本文整理汇总了Java中org.esa.snap.ui.GridBagUtils.createConstraints方法的典型用法代码示例。如果您正苦于以下问题:Java GridBagUtils.createConstraints方法的具体用法?Java GridBagUtils.createConstraints怎么用?Java GridBagUtils.createConstraints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.esa.snap.ui.GridBagUtils的用法示例。


在下文中一共展示了GridBagUtils.createConstraints方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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;
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:19,代码来源:DefaultBandChoosingStrategy.java

示例2: 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;
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:26,代码来源:ProductSubsetDialog.java

示例3: 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;
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:26,代码来源:ProductSubsetDialog.java

示例4: 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());
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:20,代码来源:ProductFileChooser.java

示例5: 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;
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:18,代码来源:DensityPlotPanel.java

示例6: 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;
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:38,代码来源:GroupedBandChoosingStrategy.java

示例7: 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;
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:11,代码来源:GeoLocationController.java

示例8: 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;
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:9,代码来源:ProductChooser.java

示例9: 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;
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:12,代码来源:RoiMaskSelector.java

示例10: createUI

import org.esa.snap.ui.GridBagUtils; //导入方法依赖的package包/类
/**
 * Creates the user interface
 */
private void createUI() {
    // the label
    final JLabel label = new JLabel(this.label + ":");
    setName(label, this.label);

    // the list
    JComponent scrollPane = createFileArrayComponent();

    // the add button
    final JButton addButton = createAddFileButton();
    // the remove button
    final JButton removeButton = createRemoveFileButton();
    // the move up button
    final JButton moveUpButton = createMoveUpFileButton();
    // the move down button
    final JButton moveDownButton = createMoveDownFileButton();

    // the button panel
    final JPanel buttonPanel = new JPanel();
    setName(buttonPanel, this.label);
    buttonPanel.add(addButton);
    buttonPanel.add(removeButton);
    buttonPanel.add(moveUpButton);
    buttonPanel.add(moveDownButton);

    // the base panel
    basePanel = GridBagUtils.createDefaultEmptyBorderPanel();
    setName(basePanel, this.label);
    final GridBagConstraints gbc = GridBagUtils.createConstraints(null);
    gbc.anchor = GridBagConstraints.WEST;
    gbc.weightx = 1;

    gbc.gridy++;
    basePanel.add(label, gbc);
    gbc.anchor = GridBagConstraints.EAST;
    basePanel.add(buttonPanel, gbc);

    gbc.gridy++;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.gridwidth = 2;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weightx = 1;
    gbc.weighty = 1;
    basePanel.add(scrollPane, gbc);

}
 
开发者ID:senbox-org,项目名称:s2tbx,代码行数:50,代码来源:S2tbxFileArrayEditor.java

示例11: 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();
        }
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:73,代码来源:ProductSubsetDialog.java

示例12: createUI

import org.esa.snap.ui.GridBagUtils; //导入方法依赖的package包/类
/**
 * Creates the user interface
 */
private void createUI() {
    // the label
    final JLabel label = new JLabel(this.label + ":");
    setName(label, this.label);

    // the list
    JComponent scrollPane = createFileArrayComponent();

    // the add button
    final JButton addButton = createAddFileButton();
    // the remove button
    final JButton removeButton = createRemoveFileButton();

    // the button panel
    final JPanel buttonPanel = new JPanel();
    setName(buttonPanel, this.label);
    buttonPanel.add(addButton);
    buttonPanel.add(removeButton);

    // the base panel
    basePanel = GridBagUtils.createDefaultEmptyBorderPanel();
    setName(basePanel, this.label);
    final GridBagConstraints gbc = GridBagUtils.createConstraints(null);
    gbc.anchor = GridBagConstraints.WEST;
    gbc.weightx = 1;

    gbc.gridy++;
    basePanel.add(label, gbc);
    gbc.anchor = GridBagConstraints.EAST;
    basePanel.add(buttonPanel, gbc);

    gbc.gridy++;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.gridwidth = 2;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weightx = 1;
    gbc.weighty = 1;
    basePanel.add(scrollPane, gbc);

}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:44,代码来源:FileArrayEditor.java

示例13: initComponents

import org.esa.snap.ui.GridBagUtils; //导入方法依赖的package包/类
@Override
protected void initComponents() {
    init = true;

    computePanel = new MultipleRoiComputePanel(this, getRaster());
    exportButton = getExportButton();

    final JPanel exportAndHelpPanel = GridBagUtils.createPanel();
    GridBagConstraints helpPanelConstraints = GridBagUtils.createConstraints("anchor=NORTHWEST,fill=HORIZONTAL,insets.top=2,weightx=1,ipadx=0");
    GridBagUtils.addToPanel(exportAndHelpPanel, new JSeparator(), helpPanelConstraints, "fill=HORIZONTAL,gridwidth=2,insets.left=5,insets.right=5");
    GridBagUtils.addToPanel(exportAndHelpPanel, exportButton, helpPanelConstraints, "gridy=1,anchor=WEST,fill=NONE");
    GridBagUtils.addToPanel(exportAndHelpPanel, getHelpButton(), helpPanelConstraints, "gridx=1,gridy=1,anchor=EAST,fill=NONE");

    final JPanel rightPanel = GridBagUtils.createPanel();
    GridBagConstraints extendedOptionsPanelConstraints = GridBagUtils.createConstraints("anchor=NORTHWEST,fill=HORIZONTAL,insets.top=2,weightx=1,insets.right=-2");
    GridBagUtils.addToPanel(rightPanel, computePanel, extendedOptionsPanelConstraints, "gridy=0,fill=BOTH,weighty=1");
    GridBagUtils.addToPanel(rightPanel, createAccuracyPanel(), extendedOptionsPanelConstraints, "gridy=1,fill=BOTH,weighty=1");
    GridBagUtils.addToPanel(rightPanel, exportAndHelpPanel, extendedOptionsPanelConstraints, "gridy=2,anchor=SOUTHWEST,fill=HORIZONTAL,weighty=0");

    final ImageIcon collapseIcon = UIUtils.loadImageIcon("icons/PanelRight12.png");
    final ImageIcon collapseRolloverIcon = ToolButtonFactory.createRolloverIcon(collapseIcon);
    final ImageIcon expandIcon = UIUtils.loadImageIcon("icons/PanelLeft12.png");
    final ImageIcon expandRolloverIcon = ToolButtonFactory.createRolloverIcon(expandIcon);

    hideAndShowButton = ToolButtonFactory.createButton(collapseIcon, false);
    hideAndShowButton.setToolTipText("Collapse Options Panel");
    hideAndShowButton.setName("switchToChartButton");
    hideAndShowButton.addActionListener(new ActionListener() {

        private boolean rightPanelShown;

        @Override
        public void actionPerformed(ActionEvent e) {
            rightPanel.setVisible(rightPanelShown);
            if (rightPanelShown) {
                hideAndShowButton.setIcon(collapseIcon);
                hideAndShowButton.setRolloverIcon(collapseRolloverIcon);
                hideAndShowButton.setToolTipText("Collapse Options Panel");
            } else {
                hideAndShowButton.setIcon(expandIcon);
                hideAndShowButton.setRolloverIcon(expandRolloverIcon);
                hideAndShowButton.setToolTipText("Expand Options Panel");
            }
            rightPanelShown = !rightPanelShown;
        }
    });


    contentPanel = new JPanel(new GridLayout(-1, 1));
    contentPanel.setBackground(Color.WHITE);
    contentPanel.addMouseListener(popupHandler);

    final JScrollPane contentScrollPane = new JScrollPane(contentPanel);
    contentScrollPane.setBorder(null);
    contentScrollPane.setBackground(Color.WHITE);

    backgroundPanel = new JPanel(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    GridBagUtils.addToPanel(backgroundPanel, contentScrollPane, gbc, "fill=BOTH, weightx=1.0, weighty=1.0, anchor=NORTH");
    GridBagUtils.addToPanel(backgroundPanel, rightPanel, gbc, "gridx=1, fill=VERTICAL, weightx=0.0");

    JLayeredPane layeredPane = new JLayeredPane();
    layeredPane.add(backgroundPanel);
    layeredPane.add(hideAndShowButton);
    add(layeredPane);
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:67,代码来源:StatisticsPanel.java

示例14: createUI

import org.esa.snap.ui.GridBagUtils; //导入方法依赖的package包/类
/**
 * Responsible for creating the UI layout.
 *
 * @param chartPanel the panel of the chart
 * @param optionsPanel the options panel for changing settings
 * @param roiMaskSelector optional ROI mask selector, can be {@code null} if not wanted.
 */
protected void createUI(ChartPanel chartPanel, JPanel optionsPanel, RoiMaskSelector roiMaskSelector) {
    this.roiMaskSelector = roiMaskSelector;
    final JPanel extendedOptionsPanel = GridBagUtils.createPanel();
    GridBagConstraints extendedOptionsPanelConstraints = GridBagUtils.createConstraints("insets.left=4,insets.right=2,anchor=NORTHWEST,fill=HORIZONTAL,insets.top=2,weightx=1");
    GridBagUtils.addToPanel(extendedOptionsPanel, new JSeparator(), extendedOptionsPanelConstraints, "gridy=0");
    if (this.roiMaskSelector != null) {
        GridBagUtils.addToPanel(extendedOptionsPanel, this.roiMaskSelector.createPanel(), extendedOptionsPanelConstraints, "gridy=1,insets.left=-4");
        GridBagUtils.addToPanel(extendedOptionsPanel, new JPanel(), extendedOptionsPanelConstraints, "gridy=1,insets.left=-4");
    }
    GridBagUtils.addToPanel(extendedOptionsPanel, optionsPanel, extendedOptionsPanelConstraints, "insets.left=0,insets.right=0,gridy=2,fill=VERTICAL,fill=HORIZONTAL,weighty=1");
    GridBagUtils.addToPanel(extendedOptionsPanel, new JSeparator(), extendedOptionsPanelConstraints, "insets.left=4,insets.right=2,gridy=5,anchor=SOUTHWEST");

    final SimpleScrollPane optionsScrollPane = new SimpleScrollPane(extendedOptionsPanel,
                                                                    ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                                                                    ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    optionsScrollPane.setBorder(null);
    optionsScrollPane.getVerticalScrollBar().setUnitIncrement(20);

    final JPanel rightPanel = new JPanel(new BorderLayout());
    rightPanel.add(createTopPanel(), BorderLayout.NORTH);
    rightPanel.add(optionsScrollPane, BorderLayout.CENTER);
    rightPanel.add(createChartBottomPanel(chartPanel), BorderLayout.SOUTH);

    final ImageIcon collapseIcon = UIUtils.loadImageIcon("icons/PanelRight12.png");
    final ImageIcon collapseRolloverIcon = ToolButtonFactory.createRolloverIcon(collapseIcon);
    final ImageIcon expandIcon = UIUtils.loadImageIcon("icons/PanelLeft12.png");
    final ImageIcon expandRolloverIcon = ToolButtonFactory.createRolloverIcon(expandIcon);

    hideAndShowButton = ToolButtonFactory.createButton(collapseIcon, false);
    hideAndShowButton.setToolTipText("Collapse Options Panel");
    hideAndShowButton.setName("switchToChartButton");
    hideAndShowButton.addActionListener(new ActionListener() {

        private boolean rightPanelShown;

        @Override
        public void actionPerformed(ActionEvent e) {
            rightPanel.setVisible(rightPanelShown);
            if (rightPanelShown) {
                hideAndShowButton.setIcon(collapseIcon);
                hideAndShowButton.setRolloverIcon(collapseRolloverIcon);
                hideAndShowButton.setToolTipText("Collapse Options Panel");
            } else {
                hideAndShowButton.setIcon(expandIcon);
                hideAndShowButton.setRolloverIcon(expandRolloverIcon);
                hideAndShowButton.setToolTipText("Expand Options Panel");
            }
            rightPanelShown = !rightPanelShown;
        }
    });

    backgroundPanel = new JPanel(new BorderLayout());
    backgroundPanel.add(chartPanel, BorderLayout.CENTER);
    backgroundPanel.add(rightPanel, BorderLayout.EAST);

    JLayeredPane layeredPane = new JLayeredPane();
    layeredPane.add(backgroundPanel, new Integer(0));
    layeredPane.add(hideAndShowButton, new Integer(1));
    add(layeredPane);
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:68,代码来源:ChartPagePanel.java

示例15: createMiddlePanel

import org.esa.snap.ui.GridBagUtils; //导入方法依赖的package包/类
protected JPanel createMiddlePanel(BindingContext bindingContext) {
    final JLabel boxSizeLabel = new JLabel("Box size: ");
    final JSpinner boxSizeSpinner = new JSpinner();
    final JCheckBox computeInBetweenPoints = new JCheckBox("Compute in-between points");
    final JCheckBox useCorrelativeData = new JCheckBox("Use correlative data");

    correlativeFieldSelector = new CorrelativeFieldSelector(bindingContext);
    final PropertyDescriptor boxSizeDescriptor = bindingContext.getPropertySet().getProperty("boxSize").getDescriptor();
    boxSizeDescriptor.setValueRange(new ValueRange(1, 101));
    boxSizeDescriptor.setAttribute("stepSize", 2);
    boxSizeDescriptor.setValidator(new Validator() {
        @Override
        public void validateValue(Property property, Object value) throws ValidationException {
            if (((Number) value).intValue() % 2 == 0) {
                throw new ValidationException("Only odd values allowed as box size.");
            }
        }
    });
    bindingContext.bind("boxSize", boxSizeSpinner);
    bindingContext.bind("computeInBetweenPoints", computeInBetweenPoints);
    bindingContext.bind("useCorrelativeData", useCorrelativeData);
    EnablePointDataCondition condition = new EnablePointDataCondition();
    pointDataSourceEnablement = bindingContext.bindEnabledState("pointDataSource", true, condition);
    dataFieldEnablement = bindingContext.bindEnabledState("dataField", true, condition);

    bindingContext.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            updateDataSource();
            updateDataSet();
            updateUIState();
        }
    });

    JPanel dataSourceOptionsPanel = GridBagUtils.createPanel();
    GridBagConstraints dataSourceOptionsConstraints = GridBagUtils.createConstraints("anchor=NORTHWEST,fill=HORIZONTAL,insets.top=2");
    GridBagUtils.addToPanel(dataSourceOptionsPanel, boxSizeLabel, dataSourceOptionsConstraints, "gridwidth=1,gridy=0,gridx=0,weightx=0,insets.left=4");
    GridBagUtils.addToPanel(dataSourceOptionsPanel, boxSizeSpinner, dataSourceOptionsConstraints, "gridwidth=1,gridy=0,gridx=1,weightx=1,insets.left=0");
    GridBagUtils.addToPanel(dataSourceOptionsPanel, computeInBetweenPoints, dataSourceOptionsConstraints, "gridwidth=2,gridy=1,gridx=0,weightx=2");
    GridBagUtils.addToPanel(dataSourceOptionsPanel, useCorrelativeData, dataSourceOptionsConstraints, "gridy=2,insets.top=16");
    GridBagUtils.addToPanel(dataSourceOptionsPanel, correlativeFieldSelector.pointDataSourceLabel, dataSourceOptionsConstraints, "gridy=3,insets.top=0,insets.left=4");
    GridBagUtils.addToPanel(dataSourceOptionsPanel, correlativeFieldSelector.pointDataSourceList, dataSourceOptionsConstraints, "gridy=4,insets.left=4");
    GridBagUtils.addToPanel(dataSourceOptionsPanel, correlativeFieldSelector.dataFieldLabel, dataSourceOptionsConstraints, "gridy=5,insets.left=4");
    GridBagUtils.addToPanel(dataSourceOptionsPanel, correlativeFieldSelector.dataFieldList, dataSourceOptionsConstraints, "gridy=6,insets.left=4");

    xAxisRangeControl.getBindingContext().bind(PROPERTY_NAME_MARK_SEGMENTS, new JCheckBox("Mark segments"));
    yAxisRangeControl.getBindingContext().bind(PROPERTY_NAME_LOG_SCALED, new JCheckBox("Log10 scaled"));

    JPanel displayOptionsPanel = GridBagUtils.createPanel();
    GridBagConstraints displayOptionsConstraints = GridBagUtils.createConstraints("anchor=SOUTH,fill=HORIZONTAL,weightx=1");
    GridBagUtils.addToPanel(displayOptionsPanel, xAxisRangeControl.getPanel(), displayOptionsConstraints, "gridy=0");
    GridBagUtils.addToPanel(displayOptionsPanel, xAxisRangeControl.getBindingContext().getBinding(PROPERTY_NAME_MARK_SEGMENTS).getComponents()[0], displayOptionsConstraints, "gridy=1");
    GridBagUtils.addToPanel(displayOptionsPanel, yAxisRangeControl.getPanel(), displayOptionsConstraints, "gridy=2");
    GridBagUtils.addToPanel(displayOptionsPanel, yAxisRangeControl.getBindingContext().getBinding(PROPERTY_NAME_LOG_SCALED).getComponents()[0], displayOptionsConstraints, "gridy=3");

    JPanel middlePanel = GridBagUtils.createPanel();
    GridBagConstraints middlePanelConstraints = GridBagUtils.createConstraints("anchor=NORTHWEST,fill=HORIZONTAL,insets.top=2,weightx=1");
    GridBagUtils.addToPanel(middlePanel, dataSourceOptionsPanel, middlePanelConstraints, "gridy=0");
    GridBagUtils.addToPanel(middlePanel, new JPanel(), middlePanelConstraints, "gridy=1,fill=VERTICAL,weighty=1");
    GridBagUtils.addToPanel(middlePanel, displayOptionsPanel, middlePanelConstraints, "gridy=2,fill=HORIZONTAL,weighty=0");

    return middlePanel;
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:64,代码来源:ProfilePlotPanel.java


注:本文中的org.esa.snap.ui.GridBagUtils.createConstraints方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。