Package java.awt

Examples of java.awt.GridBagLayout$MixedConstraints


    /**
     *
     */
    private void initGUI()
    {
      this.setLayout(new GridBagLayout());
      GridBagConstraints constraints = new GridBagConstraints();

      // Add the width label
      constraints.gridx = 0;
      constraints.gridy = 0;
View Full Code Here


        if (playWithLineStyle) {
            tree.putClientProperty("JTree.lineStyle", lineStyle);
        }

        // Create the scroll pane and add the tree to it.
        GridBagLayout outergridbag = new GridBagLayout();
        GridBagConstraints outerc = new GridBagConstraints();

        JScrollPane treeView = new JScrollPane(tree);

        setLayout(outergridbag);

        outerc.fill = GridBagConstraints.BOTH;
        outerc.anchor = GridBagConstraints.WEST;
        outerc.insets = new Insets(10, 10, 10, 10);
        outerc.gridx = GridBagConstraints.REMAINDER;
        outerc.weighty = .75;
        outerc.weightx = 1.0;
        outergridbag.setConstraints(treeView, outerc);
        add(treeView);

        // Create the configuration pane
        JPanel configPanel = new JPanel();
        GridBagLayout gridbag = new GridBagLayout();
        GridBagConstraints c = new GridBagConstraints();
        configPanel.setLayout(gridbag);

        c.gridheight = GridBagConstraints.REMAINDER;
        Component da = drawingAttributes.getGUI();
        gridbag.setConstraints(da, c);
        configPanel.add(da);

        c.gridx = 1;
        c.gridheight = 1;
        c.gridy = 0;
        c.fill = GridBagConstraints.HORIZONTAL;
        c.insets = new Insets(0, 5, 0, 5);
        addFeatureButton = new JButton("Add Feature");
        addFeatureButton.addActionListener(this);
        addFeatureButton.setActionCommand(AddFeatureCmd);
        gridbag.setConstraints(addFeatureButton, c);
        configPanel.add(addFeatureButton);
        addFeatureButton.setEnabled(false);

        clearFeaturesButton = new JButton("Clear Features");
        clearFeaturesButton.addActionListener(this);
        clearFeaturesButton.setActionCommand(ClearFeaturesCmd);
        c.gridy = GridBagConstraints.RELATIVE;
        gridbag.setConstraints(clearFeaturesButton, c);
        configPanel.add(clearFeaturesButton);
        clearFeaturesButton.setEnabled(false);

        if (layer != null) {
            createLayerButton = new JButton("Set Features on Layer");
        } else if (layerHandler != null) {
            createLayerButton = new JButton("Create Layer");
        } else {
            createLayerButton = new JButton("Print Properties");
        }
        createLayerButton.addActionListener(this);
        createLayerButton.setActionCommand(CreateLayerCmd);
        gridbag.setConstraints(createLayerButton, c);
        configPanel.add(createLayerButton);
        createLayerButton.setEnabled(false);

        JPanel currentFeatureListPanel = PaletteHelper.createVerticalPanel(" Current Features: ");
        currentFeatureList = new JTextArea(EMPTY_FEATURE_LIST);
        currentFeatureList.setEditable(false);
        JScrollPane featureListScrollPane = new JScrollPane(currentFeatureList);
        featureListScrollPane.setPreferredSize(new Dimension(150, 10));
        currentFeatureListPanel.add(featureListScrollPane);

        c.gridx = 2;
        c.gridy = 0;
        c.weightx = 1.0;
        c.anchor = GridBagConstraints.NORTHWEST;
        c.gridheight = GridBagConstraints.REMAINDER;
        c.fill = GridBagConstraints.BOTH;
        gridbag.setConstraints(currentFeatureListPanel, c);
        configPanel.add(currentFeatureListPanel);

        GridBagLayout gridbag2 = new GridBagLayout();
        GridBagConstraints c2 = new GridBagConstraints();
        JPanel namePanel = new JPanel();
        namePanel.setLayout(gridbag2);

        c2.weightx = 0;
        c2.weighty = 0;
        c2.anchor = GridBagConstraints.WEST;
        JLabel nameLabel = new JLabel("Layer Name: ");
        gridbag2.setConstraints(nameLabel, c2);
        namePanel.add(nameLabel);

        c2.fill = GridBagConstraints.HORIZONTAL;
        c2.weightx = 1.0;
        c2.weighty = 1.0;
        nameField = new JTextField(layerName);
        gridbag2.setConstraints(nameField, c2);
        namePanel.add(nameField);

        outerc.anchor = GridBagConstraints.WEST;
        outerc.weighty = 0;
        outergridbag.setConstraints(namePanel, outerc);
View Full Code Here

    detailManagerPanel.add(classEditor, ConfigDescriptionEditor.CLASS_DETAIL_EDITOR_NAME);
    detailManagerPanel.add(textEditor, ConfigDescriptionEditor.TEXT_DETAIL_EDITOR_NAME);
    detailManagerPanel.add(enumerationEditor, ConfigDescriptionEditor.ENUM_DETAIL_EDITOR_NAME);

    final JPanel commonEntryEditorPanel = new JPanel();
    commonEntryEditorPanel.setLayout(new GridBagLayout());
    commonEntryEditorPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
View Full Code Here

            frame.setIconImage(image);
        }
        frame.setResizable(false);
        frame.setBackground(SystemColor.control);

        GridBagLayout layout = new GridBagLayout();
        frame.setLayout(layout);

        // the main panel keeps everything together
        Panel mainPanel = new Panel(layout);
View Full Code Here

        vfield.removeActionListener(al);
    }
   
    public void layoutPanel() {

        GridBagLayout gb = new GridBagLayout();
        GridBagConstraints c = new GridBagConstraints();
        setLayout(gb);

        c.insets = new Insets(3, 3, 3, 3);
        c.gridx = 0;
        c.gridy = 0;
        c.fill = GridBagConstraints.NONE;
        c.weightx = 0;
        c.anchor = GridBagConstraints.EAST;

        gb.setConstraints(htext, c);
        add(htext);

        c.gridx = 1;
        c.fill = GridBagConstraints.HORIZONTAL;
        c.weightx = 1f;
        c.anchor = GridBagConstraints.WEST;

        gb.setConstraints(hfield, c);
        add(hfield);

        c.gridx = 2;
        c.fill = GridBagConstraints.NONE;
        c.weightx = 0;
        gb.setConstraints(ptext1, c);
        add(ptext1);

        // Next row

        c.gridx = 0;
        c.gridy = 1;
        c.fill = GridBagConstraints.NONE;
        c.weightx = 0;
        c.anchor = GridBagConstraints.EAST;

        gb.setConstraints(vtext, c);
        add(vtext);

        c.gridx = 1;
        c.fill = GridBagConstraints.HORIZONTAL;
        c.weightx = 1f;
        c.anchor = GridBagConstraints.WEST;

        gb.setConstraints(vfield, c);
        add(vfield);

        c.gridx = 2;
        c.fill = GridBagConstraints.NONE;
        c.weightx = 0;
        gb.setConstraints(ptext2, c);
        add(ptext2);
    }
View Full Code Here

        createGUI(bg);
        layer.addComponentListener(this);
    }

    protected void createGUI(ButtonGroup bg) {
        GridBagLayout gridbag = new GridBagLayout();
        GridBagConstraints c = new GridBagConstraints();
        setLayout(gridbag);

        layerName = new JToggleButton(layer.getName());
        layerName.setBorderPainted(false);
        layerName.addActionListener(this);
        offColor = layerName.getBackground();
        layerName.setToolTipText(i18n.get(LayerPane.class,
                "layerName.tooltip",
                "Click to select layer"));
        layerName.setHorizontalAlignment(SwingConstants.LEFT);
        bg.add(layerName);

        c.gridy = 0;
        c.gridx = GridBagConstraints.RELATIVE;
        c.anchor = GridBagConstraints.WEST;
        c.insets = new Insets(0, 0, 0, 0);

        onoffButton = getOnOffButton();
        gridbag.setConstraints(onoffButton, c);
        add(onoffButton);

        paletteButton = getPaletteButton();
        gridbag.setConstraints(paletteButton, c);
        add(paletteButton);

        c.weightx = 1;
        c.fill = GridBagConstraints.HORIZONTAL;
        gridbag.setConstraints(layerName, c);
        add(layerName);
    }
View Full Code Here

     */
    protected LayerPane(String title) {
        super();
        // prevent null pointers somewhere...
        this.layer = com.bbn.openmap.layer.SinkLayer.getSharedInstance();
        GridBagLayout gridbag = new GridBagLayout();
        GridBagConstraints c = new GridBagConstraints();
        setLayout(gridbag);

        JSeparator sep = new JSeparator();
        sep.setToolTipText(title);

        c.anchor = GridBagConstraints.WEST;
        c.weightx = 1;
        c.fill = GridBagConstraints.HORIZONTAL;
        gridbag.setConstraints(sep, c);
        add(sep);
    }
View Full Code Here

     * Creates and adds the labels and entry fields for latitude and
     * longitude
     */
    protected void makeWidgets() {
        String locText;
        GridBagLayout gridbag = new GridBagLayout();
        GridBagConstraints c = new GridBagConstraints();

        setLayout(gridbag);
        locText = i18n.get(DMSCoordPanel.class,
                "border",
                "Degress|Minutes|Seconds");
        setBorder(new TitledBorder(new EtchedBorder(), locText));

        locText = i18n.get(DMSCoordPanel.class, "latlabel", "Latitude DMS: ");
        JLabel latlabel = new JLabel(locText);
        c.gridx = 0;
        gridbag.setConstraints(latlabel, c);
        add(latlabel);

        c.gridx = GridBagConstraints.RELATIVE;
        degLat = new JTextField(4);
        gridbag.setConstraints(degLat, c);
        add(degLat);

        minLat = new JTextField(4);
        gridbag.setConstraints(minLat, c);
        add(minLat);

        secLat = new JTextField(4);
        gridbag.setConstraints(secLat, c);
        add(secLat);

        locText = i18n.get(DMSCoordPanel.class, "lonlabel", "Longitude DMS: ");
        JLabel lonlabel = new JLabel(locText);
        c.gridx = 0;
        c.gridy = 1;
        gridbag.setConstraints(lonlabel, c);
        add(lonlabel);

        c.gridx = GridBagConstraints.RELATIVE;
        degLon = new JTextField(4);
        gridbag.setConstraints(degLon, c);
        add(degLon);

        minLon = new JTextField(4);
        gridbag.setConstraints(minLon, c);
        add(minLon);

        secLon = new JTextField(4);
        gridbag.setConstraints(secLon, c);
        add(secLon);
    }
View Full Code Here

        JPanel component = new JPanel();
        component.setLayout(new BorderLayout());

        JPanel propertyPanel = new JPanel();

        GridBagLayout gridbag = new GridBagLayout();
        GridBagConstraints c = new GridBagConstraints();
        c.insets = new Insets(2, 10, 2, 10);
        propertyPanel.setLayout(gridbag);

        int i = 0;
        for (Iterator it = sortedKeys.iterator(); it.hasNext();) { // iterate
            // properties
            String prop = (String) it.next();

            String marker = prop;
            if (prefix != null && prop.startsWith(prefix)) {
                marker = prop.substring(prefix.length() + 1);
            }

            if (marker.startsWith(".")) {
                marker = marker.substring(1);
            }

            String editorMarker = marker
                    + PropertyConsumer.ScopedEditorProperty;
            String editorClass = info.getProperty(editorMarker);
            if (editorClass == null) {
                editorClass = defaultEditorClass;
            }

            // instantiate PropertyEditor
            Class propertyEditorClass = null;
            PropertyEditor editor = null;
            try {
                propertyEditorClass = Class.forName(editorClass);
                editor = (PropertyEditor) propertyEditorClass.newInstance();
                if (editor instanceof PropertyConsumer) {
                    ((PropertyConsumer) editor).setProperties(marker, info);
                }
                editors.put(prop, editor);
            } catch (Exception e) {
                e.printStackTrace();
                editorClass = null;
            }

            Component editorFace = null;
            if (editor != null && editor.supportsCustomEditor()) {
                editorFace = editor.getCustomEditor();
            } else {
                editorFace = new JLabel("Does not support custom editor");
            }

            if (editor != null) {
                Object propVal = props.get(prop);
                if (Debug.debugging("inspector")) {
                    Debug.output("Inspector loading " + prop + "(" + propVal
                            + ")");
                }
                editor.setValue(propVal);
            }

            // Customized labels for each property, instead of the
            // abbreviated nature of the true property names.
            String labelMarker = marker + PropertyConsumer.LabelEditorProperty;
            String labelText = info.getProperty(labelMarker);
            if (labelText == null) {
                labelText = marker;
            }

            JLabel label = new JLabel(labelText + ":");
            label.setHorizontalAlignment(SwingConstants.RIGHT);

            c.gridx = 0;
            c.gridy = i++;
            c.weightx = 0;
            c.fill = GridBagConstraints.NONE;
            c.anchor = GridBagConstraints.EAST;

            gridbag.setConstraints(label, c);
            propertyPanel.add(label);

            c.gridx = 1;
            c.anchor = GridBagConstraints.WEST;
            c.fill = GridBagConstraints.HORIZONTAL;
            c.weightx = 1f;

            gridbag.setConstraints(editorFace, c);
            propertyPanel.add(editorFace);

            String toolTip = (String) info.get(marker);
            label.setToolTipText(toolTip == null ? "No further information available."
                    : toolTip);
View Full Code Here

                ColorPropertyEditor.this.setValue(color);
            }
        });

        JPanel panel = new JPanel();
        GridBagLayout gridbag = new GridBagLayout();
        GridBagConstraints c = new GridBagConstraints();
        c.anchor = GridBagConstraints.WEST;
        c.weightx = 1;
        panel.setLayout(gridbag);
        gridbag.setConstraints(button, c);
        panel.add(button);

        return panel;
    }
View Full Code Here

TOP

Related Classes of java.awt.GridBagLayout$MixedConstraints

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.