Example usage for java.awt GridBagConstraints NONE

List of usage examples for java.awt GridBagConstraints NONE

Introduction

In this page you can find the example usage for java.awt GridBagConstraints NONE.

Prototype

int NONE

To view the source code for java.awt GridBagConstraints NONE.

Click Source Link

Document

Do not resize the component.

Usage

From source file:org.multibit.viewsystem.swing.view.panels.ShowPreferencesPanel.java

private JPanel createAppearancePanel(int stentWidth) {
    MultiBitTitledPanel appearancePanel = new MultiBitTitledPanel(
            controller.getLocaliser().getString("showPreferencesPanel.appearanceTitle"),
            ComponentOrientation.getOrientation(controller.getLocaliser().getLocale()));

    GridBagConstraints constraints = new GridBagConstraints();

    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 0;// w  w  w .j  a  v  a2s  . co  m
    constraints.gridy = 3;
    constraints.weightx = 0.1;
    constraints.weighty = 0.3;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    JPanel indent = MultiBitTitledPanel.getIndentPanel(1);
    appearancePanel.add(indent, constraints);

    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 1;
    constraints.gridy = 4;
    constraints.weightx = 0.3;
    constraints.weighty = 0.3;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    JPanel stent = MultiBitTitledPanel.createStent(stentWidth);
    appearancePanel.add(stent, constraints);

    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 2;
    constraints.gridy = 3;
    constraints.weightx = 0.05;
    constraints.weighty = 0.3;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.CENTER;
    appearancePanel.add(
            MultiBitTitledPanel.createStent(MultiBitTitledPanel.SEPARATION_BETWEEN_NAME_VALUE_PAIRS),
            constraints);

    MultiBitLabel fontNameLabel = new MultiBitLabel(
            controller.getLocaliser().getString("fontChooser.fontName"));
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 1;
    constraints.gridy = 4;
    constraints.weightx = 0.3;
    constraints.weighty = 1;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_END;
    appearancePanel.add(fontNameLabel, constraints);

    fontNameTextLabel = new MultiBitLabel("");
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 3;
    constraints.gridy = 4;
    constraints.weightx = 0.3;
    constraints.weighty = 1;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    appearancePanel.add(fontNameTextLabel, constraints);

    MultiBitLabel fontStyleLabel = new MultiBitLabel(
            controller.getLocaliser().getString("fontChooser.fontStyle"));
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 1;
    constraints.gridy = 5;
    constraints.weightx = 0.3;
    constraints.weighty = 1;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_END;
    appearancePanel.add(fontStyleLabel, constraints);

    fontStyleTextLabel = new MultiBitLabel("");
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 3;
    constraints.gridy = 5;
    constraints.weightx = 0.3;
    constraints.weighty = 1;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    appearancePanel.add(fontStyleTextLabel, constraints);

    MultiBitLabel fontSizeLabel = new MultiBitLabel(
            controller.getLocaliser().getString("fontChooser.fontSize"));
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 1;
    constraints.gridy = 6;
    constraints.weightx = 0.3;
    constraints.weighty = 1;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_END;
    appearancePanel.add(fontSizeLabel, constraints);

    fontSizeTextLabel = new MultiBitLabel("");
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 3;
    constraints.gridy = 6;
    constraints.weightx = 0.3;
    constraints.weighty = 1;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    appearancePanel.add(fontSizeTextLabel, constraints);

    ChooseFontAction chooseFontAction = new ChooseFontAction(controller, this, null);
    MultiBitButton fontChooserButton = new MultiBitButton(chooseFontAction, controller);

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 3;
    constraints.gridy = 7;
    constraints.weightx = 1;
    constraints.weighty = 1;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    appearancePanel.add(fontChooserButton, constraints);

    constraints.fill = GridBagConstraints.VERTICAL;
    constraints.gridx = 4;
    constraints.gridy = 8;
    constraints.weightx = 0.2;
    constraints.weighty = 0.3;
    constraints.gridwidth = 3;
    constraints.anchor = GridBagConstraints.LINE_START;
    appearancePanel.add(MultiBitTitledPanel.createStent(1, 30), constraints);

    MultiBitLabel lookAndFeelLabel = new MultiBitLabel(
            controller.getLocaliser().getString("showPreferencesPanel.lookAndFeel"));
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 1;
    constraints.gridy = 9;
    constraints.weightx = 0.3;
    constraints.weighty = 1;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_END;
    appearancePanel.add(lookAndFeelLabel, constraints);

    originalLookAndFeel = controller.getModel().getUserPreference(CoreModel.LOOK_AND_FEEL);
    LookAndFeelInfo[] lookAndFeels = UIManager.getInstalledLookAndFeels();

    lookAndFeelComboBox = new JComboBox();
    lookAndFeelComboBox.addItem(localisedSystemLookAndFeelName);
    if (lookAndFeels != null) {
        for (LookAndFeelInfo info : lookAndFeels) {
            lookAndFeelComboBox.addItem(info.getName());
            if (info.getName().equalsIgnoreCase(originalLookAndFeel)) {
                lookAndFeelComboBox.setSelectedItem(info.getName());
            }
        }
    }

    if (originalLookAndFeel == null || originalLookAndFeel.equals("")
            || CoreModel.SYSTEM_LOOK_AND_FEEL.equalsIgnoreCase(originalLookAndFeel)) {
        lookAndFeelComboBox.setSelectedItem(localisedSystemLookAndFeelName);
    }

    lookAndFeelComboBox.setFont(FontSizer.INSTANCE.getAdjustedDefaultFont());
    lookAndFeelComboBox.setOpaque(false);

    FontMetrics fontMetrics = getFontMetrics(FontSizer.INSTANCE.getAdjustedDefaultFont());
    int textWidth = Math.max(fontMetrics.stringWidth("CDE/Motif"), fontMetrics.stringWidth("Windows classic"));
    Dimension preferredSize = new Dimension(textWidth + TICKER_COMBO_WIDTH_DELTA,
            fontMetrics.getHeight() + EXCHANGE_COMBO_HEIGHT_DELTA);
    lookAndFeelComboBox.setPreferredSize(preferredSize);

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 3;
    constraints.gridy = 9;
    constraints.weightx = 0.8;
    constraints.weighty = 0.6;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    appearancePanel.add(lookAndFeelComboBox, constraints);

    JPanel fill1 = new JPanel();
    fill1.setOpaque(false);
    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 4;
    constraints.gridy = 10;
    constraints.weightx = 20;
    constraints.weighty = 1;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_END;
    appearancePanel.add(fill1, constraints);

    return appearancePanel;
}

From source file:com.microsoft.azure.hdinsight.spark.ui.SparkSubmissionContentPanel.java

private void addReferencedJarsLineItem() {
    JLabel commandLineArgs = new JLabel("Referenced Jars");
    commandLineArgs.setToolTipText(/* w w  w . j av  a  2  s.c om*/
            "Files to be placed on the java classpath; The path needs to be a Azure Blob Storage Path (path started with wasb://); Multiple paths should be split by semicolon (;)");

    add(commandLineArgs, new GridBagConstraints(0, ++displayLayoutCurrentRow, 1, 1, 1, 0,
            GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(margin, margin, 0, 0), 0, 0));

    referencedJarsTextField = new JTextField();
    referencedJarsTextField.setToolTipText(
            "Files to be placed on the java classpath; The path needs to be a Azure Blob Storage Path (path started with wasb://); Multiple paths should be split by semicolon (;)");
    add(referencedJarsTextField,
            new GridBagConstraints(1, displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.NORTHWEST,
                    GridBagConstraints.HORIZONTAL, new Insets(margin, margin, 0, margin), 0, 0));
}

From source file:org.openmicroscopy.shoola.agents.metadata.editor.AnnotationDataUI.java

/**
 * Lays out the other annotations./* ww  w .j  a v  a 2 s . c  o  m*/
 * 
 * @param list The collection of annotation to layout.
 */
private void layoutOthers(Collection list) {
    otherPane.removeAll();
    otherList.clear();
    DocComponent doc;

    GridBagConstraints c = new GridBagConstraints();
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(1, 2, 1, 2);
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 0;
    c.weighty = 0;
    c.fill = GridBagConstraints.NONE;

    if (!CollectionUtils.isEmpty(list)) {

        Iterator i = list.iterator();
        while (i.hasNext()) {

            c.gridx = 0;
            c.weightx = 0;
            c.fill = GridBagConstraints.NONE;

            DataObject item = (DataObject) i.next();
            if (filter == SHOW_ALL || (filter == ADDED_BY_ME && model.isLinkOwner(item))
                    || (filter == ADDED_BY_OTHERS && model.isAnnotatedByOther(item))) {
                doc = new DocComponent(item, model);
                doc.addPropertyChangeListener(controller);

                otherList.add(doc);

                otherPane.add(new JLabel(getType((AnnotationData) item) + ":"), c);

                c.gridx = 1;
                c.weightx = 1;
                c.fill = GridBagConstraints.HORIZONTAL;
                otherPane.add(doc, c);

                c.gridy++;
            }

        }
    }

    otherPane.revalidate();
    otherPane.repaint();
}

From source file:com.microsoft.azure.hdinsight.spark.ui.SparkSubmissionContentPanel.java

private void addAdvancedConfigLineItem() {
    JButton advancedConfigButton = new JButton("Advanced configuration");
    advancedConfigButton//ww  w.j  a v a  2 s .  c  om
            .setToolTipText("Specify advanced configuration, for example, enabling Spark remote debug");

    add(advancedConfigButton, new GridBagConstraints(0, ++displayLayoutCurrentRow, 0, 1, 1, 0,
            GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE, new Insets(margin, margin, 0, 0), 0, 0));

    advancedConfigButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            advancedConfigDialog = new SparkSubmissionAdvancedConfigDialog(submitModel.getAdvancedConfigModel(),
                    new CallBack() {
                        @Override
                        public void run() {
                            if (null != advancedConfigDialog) {
                                submitModel
                                        .setAdvancedConfigModel(advancedConfigDialog.getAdvancedConfigModel());
                            }
                        }
                    });
            advancedConfigDialog.setModal(true);
            advancedConfigDialog.setVisible(true);
        }
    });
}

From source file:org.revager.gui.findings_list.FindingsListFrame.java

private void createBottomOrgPanel() {
    JLabel locationLbl = new JLabel(translate("Location:"));
    locationLbl.setFont(UI.VERY_LARGE_FONT_BOLD);

    JLabel dateLbl = new JLabel(translate("Date:"));
    dateLbl.setFont(UI.VERY_LARGE_FONT_BOLD);

    JLabel beginLbl = new JLabel(translate("Period of time:"));
    beginLbl.setFont(UI.VERY_LARGE_FONT_BOLD);

    JLabel tillLabel = new JLabel(translate("to"));
    tillLabel.setFont(UI.VERY_LARGE_FONT_BOLD);

    clockLabel.setFont(UI.VERY_LARGE_FONT_BOLD);

    dateTxtFld = new ObservingTextField();
    dateTxtFld.setFont(UI.VERY_LARGE_FONT);

    dateTxtFld.setFocusable(false);//from w  w w .  j  a  v a2  s.c  o m
    dateTxtFld.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    dateTxtFld.setPreferredSize(new Dimension(190, (int) dateTxtFld.getPreferredSize().getHeight()));
    dateTxtFld.setMinimumSize(dateTxtFld.getPreferredSize());
    dateTxtFld.addMouseListener(new MouseListener() {
        @Override
        public void mouseClicked(MouseEvent e) {
            // instantiate the DatePicker
            DatePicker dp = new DatePicker(UI.getInstance().getProtocolFrame(),
                    UI.getInstance().getProtocolFrame().getDateTxtFld());

            // previously selected date
            Date selectedDate = dp.parseDate(UI.getInstance().getProtocolFrame().getDateTxtFld().getText());
            dp.setSelectedDate(selectedDate);
            dp.start(UI.getInstance().getProtocolFrame().getDateTxtFld());
        }

        @Override
        public void mouseEntered(MouseEvent e) {
        }

        @Override
        public void mouseExited(MouseEvent e) {
        }

        @Override
        public void mousePressed(MouseEvent e) {
        }

        @Override
        public void mouseReleased(MouseEvent e) {
        }
    });

    dateTxtFld.addKeyListener(updateListener);

    /*
     * creating spinner panel
     */
    beginMSpinner = new JSpinner(new RotateSpinnerNumberModel(00, 00, 59, 1));
    beginHSpinner = new JSpinner(new RotateSpinnerNumberModel(00, 00, 23, 1));

    endMSpinner = new JSpinner(new RotateSpinnerNumberModel(00, 00, 59, 1));
    endHSpinner = new JSpinner(new RotateSpinnerNumberModel(00, 00, 23, 1));

    beginMSpinner.setFont(UI.VERY_LARGE_FONT);
    beginHSpinner.setFont(UI.VERY_LARGE_FONT);
    endHSpinner.setFont(UI.VERY_LARGE_FONT);
    endMSpinner.setFont(UI.VERY_LARGE_FONT);

    beginMSpinner.addChangeListener(spinnerChangeListener);
    beginHSpinner.addChangeListener(spinnerChangeListener);
    endHSpinner.addChangeListener(spinnerChangeListener);
    endMSpinner.addChangeListener(spinnerChangeListener);

    locationTxtFld = new JTextField();
    locationTxtFld.setFont(UI.VERY_LARGE_FONT);

    /*
     * Hide border if the application runs on Mac OS X
     */
    boolean hideBorder = UI.getInstance().getPlatform() == UI.Platform.MAC;

    GUITools.formatSpinner(endHSpinner, hideBorder);
    GUITools.formatSpinner(endMSpinner, hideBorder);
    GUITools.formatSpinner(beginHSpinner, hideBorder);
    GUITools.formatSpinner(beginMSpinner, hideBorder);

    // TODO: In some cases 'currentProt.getDate()' returns null.
    dateF.setTimeZone(currentProt.getDate().getTimeZone());
    dateTxtFld.setText(dateF.format(currentProt.getDate().getTime()));

    int beginHours = currentProt.getStart().get(Calendar.HOUR_OF_DAY);
    beginMSpinner.setValue(currentProt.getStart().get(Calendar.MINUTE));
    beginHSpinner.setValue(beginHours);

    int endHours = currentProt.getEnd().get(Calendar.HOUR_OF_DAY);
    endMSpinner.setValue(currentProt.getEnd().get(Calendar.MINUTE));
    endHSpinner.setValue(endHours);

    /*
     * Correct the leading zero's
     */
    if ((Integer) beginMSpinner.getValue() == 0) {
        ((NumberEditor) beginMSpinner.getEditor()).getTextField().setText("00");
    }

    if ((Integer) beginHSpinner.getValue() == 0) {
        ((NumberEditor) beginHSpinner.getEditor()).getTextField().setText("00");
    }

    if ((Integer) endMSpinner.getValue() == 0) {
        ((NumberEditor) endMSpinner.getEditor()).getTextField().setText("00");
    }

    if ((Integer) endHSpinner.getValue() == 0) {
        ((NumberEditor) endHSpinner.getEditor()).getTextField().setText("00");
    }

    locationTxtFld.setText(currentProt.getLocation().trim());

    JPanel spinnerPanel = new JPanel(gbl);
    spinnerPanel.setOpaque(false);

    JLabel labelDoubleDot1 = new JLabel(":");
    labelDoubleDot1.setFont(UI.VERY_LARGE_FONT_BOLD);

    JLabel labelDoubleDot2 = new JLabel(":");
    labelDoubleDot2.setFont(UI.VERY_LARGE_FONT_BOLD);

    GUITools.addComponent(spinnerPanel, gbl, beginHSpinner, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
            GridBagConstraints.VERTICAL, GridBagConstraints.NORTHWEST);
    GUITools.addComponent(spinnerPanel, gbl, labelDoubleDot1, 1, 0, 1, 1, 0, 0, 0, 5, 0, 0,
            GridBagConstraints.VERTICAL, GridBagConstraints.CENTER);
    GUITools.addComponent(spinnerPanel, gbl, beginMSpinner, 2, 0, 1, 1, 0, 0, 0, 5, 0, 0,
            GridBagConstraints.VERTICAL, GridBagConstraints.NORTHWEST);
    GUITools.addComponent(spinnerPanel, gbl, tillLabel, 3, 0, 1, 1, 1.0, 0, 0, 10, 0, 10,
            GridBagConstraints.VERTICAL, GridBagConstraints.CENTER);
    GUITools.addComponent(spinnerPanel, gbl, endHSpinner, 4, 0, 1, 1, 0, 0, 0, 0, 0, 0,
            GridBagConstraints.VERTICAL, GridBagConstraints.NORTHEAST);
    GUITools.addComponent(spinnerPanel, gbl, labelDoubleDot2, 5, 0, 1, 1, 0, 0, 0, 5, 0, 0,
            GridBagConstraints.VERTICAL, GridBagConstraints.CENTER);
    GUITools.addComponent(spinnerPanel, gbl, endMSpinner, 6, 0, 1, 1, 0, 0, 0, 5, 0, 0,
            GridBagConstraints.VERTICAL, GridBagConstraints.NORTHEAST);

    /*
     * adding created components to orgpanel
     */
    GUITools.addComponent(bottomOrgPanel, gbl, dateLbl, 2, 0, 1, 1, 0.0, 1.0, 10, 20, 0, 0,
            GridBagConstraints.NONE, GridBagConstraints.WEST);
    GUITools.addComponent(bottomOrgPanel, gbl, dateTxtFld, 3, 0, 1, 1, 0.0, 1.0, 10, 5, 0, 0,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);

    GUITools.addComponent(bottomOrgPanel, gbl, locationLbl, 0, 0, 1, 1, 0.0, 1.0, 10, 20, 0, 0,
            GridBagConstraints.NONE, GridBagConstraints.WEST);
    GUITools.addComponent(bottomOrgPanel, gbl, locationTxtFld, 1, 0, 1, 1, 1.0, 1.0, 10, 5, 0, 10,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);

    GUITools.addComponent(bottomOrgPanel, gbl, beginLbl, 5, 0, 1, 1, 0.0, 1.0, 10, 30, 0, 0,
            GridBagConstraints.NONE, GridBagConstraints.EAST);
    GUITools.addComponent(bottomOrgPanel, gbl, spinnerPanel, 6, 0, 1, 1, 0.0, 1.0, 10, 5, 0, 25,
            GridBagConstraints.VERTICAL, GridBagConstraints.WEST);

    updateAttButtons();
}

From source file:org.openmicroscopy.shoola.agents.metadata.editor.UserProfile.java

/** 
 * Builds the UI component hosting the UI component used to modify 
 * the password./*  ww  w .j a v  a 2 s .com*/
 * 
 * @return See above.
 */
private JPanel buildPasswordPanel() {
    JPanel content = new JPanel();
    content.setBackground(UIUtilities.BACKGROUND_COLOR);
    Registry reg = MetadataViewerAgent.getRegistry();
    String ldap = (String) reg.lookup(LookupNames.USER_AUTHENTICATION);
    if (ldap != null && ldap.length() > 0) {
        content.setBorder(BorderFactory.createTitledBorder("LDAP Authentication"));
        content.setLayout(new FlowLayout(FlowLayout.LEFT));
        content.add(new JLabel(ldap));
        return content;
    }
    content.setBorder(BorderFactory.createTitledBorder("Change Password"));

    content.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(0, 2, 2, 0);
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last
    c.fill = GridBagConstraints.NONE;
    c.weightx = 0.0;
    if (MetadataViewerAgent.isAdministrator()) {
        content.add(UIUtilities.setTextFont(PASSWORD_NEW), c);
        c.gridx++;
        c.gridwidth = GridBagConstraints.REMAINDER;
        c.fill = GridBagConstraints.HORIZONTAL;
        c.weightx = 1.0;
        content.add(passwordNew, c);
    } else {
        content.add(UIUtilities.setTextFont(PASSWORD_OLD), c);
        c.gridx++;
        c.gridwidth = GridBagConstraints.REMAINDER;
        c.fill = GridBagConstraints.HORIZONTAL;
        c.weightx = 1.0;
        content.add(oldPassword, c);
        c.gridy++;
        c.gridx = 0;
        c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last
        c.fill = GridBagConstraints.NONE;
        c.weightx = 0.0;
        content.add(UIUtilities.setTextFont(PASSWORD_NEW), c);
        c.gridx++;
        c.gridwidth = GridBagConstraints.REMAINDER;
        c.fill = GridBagConstraints.HORIZONTAL;
        c.weightx = 1.0;
        content.add(passwordNew, c);
        c.gridy++;
        c.gridx = 0;
        c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last
        c.fill = GridBagConstraints.NONE;
        c.weightx = 0.0;
        content.add(UIUtilities.setTextFont(PASSWORD_CONFIRMATION), c);
        c.gridx++;
        c.gridwidth = GridBagConstraints.REMAINDER;
        c.fill = GridBagConstraints.HORIZONTAL;
        c.weightx = 1.0;
        content.add(passwordConfirm, c);
        c.gridy++;
        c.gridx = 0;
    }

    JPanel p = new JPanel();
    p.setBackground(UIUtilities.BACKGROUND_COLOR);
    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
    p.add(content);
    JPanel buttonPanel = UIUtilities.buildComponentPanel(passwordButton);
    buttonPanel.setBackground(UIUtilities.BACKGROUND_COLOR);
    p.add(buttonPanel);
    return p;
}

From source file:com.microsoft.azure.hdinsight.spark.ui.SparkSubmissionContentPanel.java

private void addReferencedFilesLineItem() {
    JLabel commandLineArgs = new JLabel("Referenced Files");
    commandLineArgs.setToolTipText(//  www.  jav  a 2 s .c o m
            "Files to be placed in executor working directory. The path needs to be a Azure Blob Storage Path (path started with wasb://); Multiple paths should be split by semicolon (;) ");
    add(commandLineArgs, new GridBagConstraints(0, ++displayLayoutCurrentRow, 1, 1, 1, 0,
            GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(margin, margin, 0, 0), 0, 0));

    referencedFilesTextField = new JTextField();
    referencedFilesTextField.setToolTipText(
            "Files to be placed in executor working directory. The path needs to be a Azure Blob Storage Path (path started with wasb://); Multiple paths should be split by semicolon (;) ");
    add(referencedFilesTextField,
            new GridBagConstraints(1, displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.NORTHWEST,
                    GridBagConstraints.HORIZONTAL, new Insets(margin, margin, 0, margin), 0, 0));
}

From source file:org.dwfa.ace.classifier.CNFormsLabelPanel.java

/**
 * <b>Authoring Normal Form</b><li>Most Proximate Supertypes (IS-A)</li>
 *///from  w  ww.j a va  2  s .c o m
public JPanel newFormAuthJPanel(String label, I_ConfigAceFrame config,
        Map<I_ConceptAttributeTuple, Color> conAttrColorMap, Map<I_DescriptionTuple, Color> desColorMap,
        Map<I_RelTuple, Color> relColorMap) throws IOException {
    JPanel formJPanel = newMinMaxJPanel();
    formJPanel.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.weightx = 0;
    c.weighty = 0;
    c.gridx = 0;
    c.gridy = 0;

    List<LabelForTuple> tLabelList = new ArrayList<LabelForTuple>();
    c.gridx = 0;
    c.gridwidth = 2;
    c.anchor = GridBagConstraints.NORTHWEST;

    // SHOW SELF CONCEPT
    I_ConceptAttributeTuple cTuple = findSelf(theCBean, cEditPathPos);
    I_ImplementActiveLabel tmpTLabel = TermLabelMaker.newLabelForm(cTuple, showDetailCB.isSelected(),
            showStatusCB.isSelected());
    tLabelList.add((LabelForTuple) tmpTLabel);
    Color tmpDeltaColor = conAttrColorMap.get(cTuple);
    setBorder(tmpTLabel.getLabel(), tmpDeltaColor);
    formJPanel.add(tmpTLabel.getLabel(), c);
    c.gridy++;

    // SHOW PROXIMAL ISAs -- as relationships
    SnoGrpList isaSGList = cSnoTable.getIsaProx();
    List<I_RelTuple> isaList = new ArrayList<I_RelTuple>();
    for (SnoGrp sg : isaSGList)
        for (SnoRel sr : sg)
            isaList.add(new RelVersion(sr.relNid));
    for (I_RelTuple t : isaList) {
        I_ImplementActiveLabel tLabel = TermLabelMaker.newLabel(t, showDetailCB.isSelected(),
                showStatusCB.isSelected());
        tLabelList.add((LabelForTuple) tLabel);
        Color deltaColor = relColorMap.get(t);
        setBorder(tLabel.getLabel(), deltaColor);
        formJPanel.add(tLabel.getLabel(), c);
        c.gridy++;
    }

    // FIND NON-REDUNDANT ROLES, DIFFERENTIATED FROM PROXIMATE ISA
    SnoGrpList sgl = cSnoTable.getRoleDiffFromProx();
    // SHOW ROLE SET
    if (sgl.size() > 0) {
        int i = 0;
        SnoGrp sg = sgl.get(0);
        // show each of the non-Rels
        if (sg.size() > 0 && sg.get(0).group == 0) {
            for (SnoRel sr : sg) {
                I_RelTuple rTuple = new RelVersion(sr.relNid);
                tmpTLabel = TermLabelMaker.newLabelForm(rTuple, showDetailCB.isSelected(),
                        showStatusCB.isSelected());
                tLabelList.add((LabelForTuple) tmpTLabel);
                tmpDeltaColor = relColorMap.get(rTuple);
                setBorder(tmpTLabel.getLabel(), tmpDeltaColor);
                formJPanel.add(tmpTLabel.getLabel(), c);
                c.gridy++;
            }
            i++; // skip past 0 index of the "un-grouped"
        }

        // show each of the groups
        for (; i < sgl.size(); i++) {
            sg = sgl.get(i);
            if (sg.size() == 0)
                continue; // :TODO: investigate why empty sets exist
            if (showGroupLabels) { // true shows one label per group
                List<I_RelTuple> grpTuple = new ArrayList<I_RelTuple>();
                for (SnoRel sr : sg) {
                    grpTuple.add(new RelVersion(sr.relNid));
                }
                tmpTLabel = TermLabelMaker.newLabel(grpTuple, showDetailCB.isSelected(),
                        showStatusCB.isSelected());
                tLabelList.add((LabelForTuple) tmpTLabel);
                tmpDeltaColor = relColorMap.get(grpTuple.get(0));
                setBorder(tmpTLabel.getLabel(), tmpDeltaColor);
                formJPanel.add(tmpTLabel.getLabel(), c);
                c.gridy++;
            } else { // if false, show 1 rel per label
                for (SnoRel sr : sg) {
                    I_RelTuple rTuple = new RelVersion(sr.relNid);
                    tmpTLabel = TermLabelMaker.newLabelForm(rTuple, showDetailCB.isSelected(),
                            showStatusCB.isSelected());
                    tLabelList.add((LabelForTuple) tmpTLabel);
                    tmpDeltaColor = relColorMap.get(rTuple);
                    setBorder(tmpTLabel.getLabel(), tmpDeltaColor);
                    formJPanel.add(tmpTLabel.getLabel(), c);
                    c.gridy++;
                }
                c.gridy++;
            }
        }
    }

    c.weightx = 1.0;
    c.weighty = 1.0;
    c.gridwidth = 2;
    formJPanel.add(new JPanel(), c);
    formJPanel.setBorder(BorderFactory.createTitledBorder(label));

    return formJPanel;
}

From source file:de.codesourcery.jasm16.ide.ui.views.SourceEditorView.java

protected JPanel createPanel() {
    // button panel
    final JToolBar toolbar = new JToolBar();
    toolbar.setLayout(new GridBagLayout());
    setColors(toolbar);/*from  w  w  w.j a  va2  s  .com*/

    final JButton showASTButton = new JButton("Show AST");
    setColors(showASTButton);

    showASTButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            final boolean currentlyVisible = isASTInspectorVisible();
            if (currentlyVisible) {
                showASTButton.setText("Show AST");
            } else {
                showASTButton.setText("Hide AST");
            }
            if (currentlyVisible) {
                astInspector.setVisible(false);
            } else {
                showASTInspector();
            }

        }
    });

    GridBagConstraints cnstrs = constraints(0, 0, false, true, GridBagConstraints.NONE);
    toolbar.add(showASTButton, cnstrs);

    // navigation history back button
    cnstrs = constraints(1, 0, false, true, GridBagConstraints.NONE);
    toolbar.add(navigationHistoryBack, cnstrs);
    navigationHistoryBack.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            navigationHistoryBack();
        }
    });

    navigationHistoryBack.setEnabled(false);

    // navigation history forward button
    cnstrs = constraints(2, 0, true, true, GridBagConstraints.NONE);
    toolbar.add(navigationHistoryForward, cnstrs);
    navigationHistoryForward.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            navigationHistoryForward();
        }
    });
    navigationHistoryForward.setEnabled(false);

    // create status area
    statusArea.setPreferredSize(new Dimension(400, 100));
    statusArea.setModel(statusModel);
    setColors(statusArea);

    /**
     * TOOLBAR
     * SOURCE
     * cursor position
     * status area 
     */
    final JPanel topPanel = new JPanel();
    topPanel.setLayout(new GridBagLayout());

    cnstrs = constraints(0, 0, GridBagConstraints.HORIZONTAL);
    cnstrs.gridwidth = GridBagConstraints.REMAINDER;
    cnstrs.weighty = 0;
    topPanel.add(toolbar, cnstrs);

    cnstrs = constraints(0, 1, GridBagConstraints.BOTH);
    cnstrs.gridwidth = GridBagConstraints.REMAINDER;
    cnstrs.weighty = 1.0;
    topPanel.add(super.getPanel(), cnstrs);

    final JPanel bottomPanel = new JPanel();
    bottomPanel.setLayout(new GridBagLayout());

    statusArea.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);

    statusArea.addMouseListener(new MouseAdapter() {

        public void mouseClicked(java.awt.event.MouseEvent e) {
            if (e.getButton() == MouseEvent.BUTTON1) {
                final int viewRow = statusArea.rowAtPoint(e.getPoint());
                if (viewRow != -1) {
                    final int modelRow = statusArea.convertRowIndexToModel(viewRow);
                    StatusMessage message = statusModel.getMessage(modelRow);
                    if (message.getLocation() != null) {
                        moveCursorTo(message.getLocation(), true);
                    }
                }
            }
        };
    });

    EditorContainer.addEditorCloseKeyListener(statusArea, this);

    statusArea.setFillsViewportHeight(true);
    statusArea.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    final JScrollPane statusPane = new JScrollPane(statusArea);
    setColors(statusPane);

    statusPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    statusPane.setPreferredSize(new Dimension(400, 100));
    statusPane.setMinimumSize(new Dimension(100, 20));

    cnstrs = constraints(0, 0, GridBagConstraints.BOTH);
    cnstrs.weightx = 1;
    cnstrs.weighty = 1;
    cnstrs.gridwidth = GridBagConstraints.REMAINDER;
    cnstrs.gridheight = GridBagConstraints.REMAINDER;

    bottomPanel.add(statusPane, cnstrs);

    // setup result panel
    final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topPanel, bottomPanel);
    setColors(splitPane);

    final JPanel panel = new JPanel();
    panel.setLayout(new GridBagLayout());
    setColors(panel);
    cnstrs = constraints(0, 0, true, true, GridBagConstraints.BOTH);
    panel.add(splitPane, cnstrs);

    final AncestorListener l = new AncestorListener() {

        @Override
        public void ancestorRemoved(AncestorEvent event) {
        }

        @Override
        public void ancestorMoved(AncestorEvent event) {
        }

        @Override
        public void ancestorAdded(AncestorEvent event) {
            splitPane.setDividerLocation(0.8d);
        }
    };
    panel.addAncestorListener(l);
    return panel;
}

From source file:org.revager.gui.findings_list.FindingsListFrame.java

private void createCommAndRatePanel() {

    JLabel recLbl = new JLabel(translate("Final recommendation for the product:"));
    recLbl.setFont(UI.VERY_LARGE_FONT_BOLD);

    JLabel meetCommLbl = new JLabel(translate("Comments on the meeting:"));
    meetCommLbl.setFont(UI.VERY_LARGE_FONT_BOLD);

    JLabel protCommLbl = new JLabel(translate("Comments on the list of findings:"));
    protCommLbl.setFont(UI.VERY_LARGE_FONT_BOLD);

    meetCommTxtArea = new JTextArea();
    meetCommTxtArea.setRows(4);//from w w  w  .  j  a v  a  2s  . c  o m
    meetCommTxtArea.setFont(UI.VERY_LARGE_FONT);

    protCommTxtArea = new JTextArea();
    protCommTxtArea.setRows(4);
    protCommTxtArea.setFont(UI.VERY_LARGE_FONT);

    recBx = new JComboBox<>();
    recBx.setEditable(true);
    recBx.setFont(UI.VERY_LARGE_FONT);

    /*
     * adding focus and tab listeners to TextAreas
     */

    meetCommTxtArea.addKeyListener(updateListener);
    meetCommTxtArea.addKeyListener(tabKeyListener);

    protCommTxtArea.addKeyListener(updateListener);
    protCommTxtArea.addKeyListener(tabKeyListener);

    for (String rec : Data.getDefaultRecommendations()) {
        recBx.addItem(rec);
    }
    recBx.setSelectedIndex(0);
    recBx.addItemListener(itemListener);
    recBx.setSelectedItem(revMgmt.getRecommendation().trim());

    meetCommTxtArea.setText(Application.getInstance().getMeetingMgmt().getMeetingComment(currentMeet).trim());
    protCommTxtArea.setText(protMgmt.getProtocolComment(currentProt).trim());

    JScrollPane meetCommScrllPn = GUITools.setIntoScrllPn(meetCommTxtArea);
    meetCommScrllPn.setMinimumSize(meetCommScrllPn.getPreferredSize());
    GUITools.scrollToTop(meetCommScrllPn);

    protCommScrllPn = GUITools.setIntoScrllPn(protCommTxtArea);
    protCommScrllPn.setMinimumSize(protCommScrllPn.getPreferredSize());
    GUITools.scrollToTop(protCommScrllPn);

    GUITools.addComponent(tabPanelCommAndRec, gbl, recLbl, 0, 3, 2, 1, 0.0, 0.0, 20, 10, 0, 10,
            GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);
    GUITools.addComponent(tabPanelCommAndRec, gbl, recBx, 0, 4, 2, 1, 1.0, 0.0, 5, 10, 0, 10,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTHWEST);
    GUITools.addComponent(tabPanelCommAndRec, gbl, meetCommLbl, 0, 5, 1, 1, 1.0, 0.0, 25, 10, 0, 10,
            GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);
    GUITools.addComponent(tabPanelCommAndRec, gbl, meetCommScrllPn, 0, 6, 1, 1, 1.0, 1.0, 5, 10, 0, 10,
            GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);
    GUITools.addComponent(tabPanelCommAndRec, gbl, protCommLbl, 1, 5, 1, 1, 1.0, 0.0, 25, 10, 0, 10,
            GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);
    GUITools.addComponent(tabPanelCommAndRec, gbl, protCommScrllPn, 1, 6, 1, 1, 1.0, 1.0, 5, 10, 0, 10,
            GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);

    tabPanelCommAndRec.setBorder(new EmptyBorder(0, 10, 20, 10));
}