Example usage for java.awt Insets Insets

List of usage examples for java.awt Insets Insets

Introduction

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

Prototype

public Insets(int top, int left, int bottom, int right) 

Source Link

Document

Creates and initializes a new Insets object with the specified top, left, bottom, and right insets.

Usage

From source file:gdt.jgui.entity.query.JQueryPanel.java

/**
 * The default constructor.//w  ww. j a  v a 2  s  .  c o  m
 */
public JQueryPanel() {
    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[] { 100, 0, 0 };
    gridBagLayout.rowHeights = new int[] { 0, 0, 0, 0 };
    gridBagLayout.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
    gridBagLayout.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0 };
    setLayout(gridBagLayout);
    JLabel lblElement = new JLabel("Element");

    GridBagConstraints gbc_lblElement = new GridBagConstraints();
    gbc_lblElement.insets = new Insets(5, 5, 5, 5);
    gbc_lblElement.gridx = 0;
    gbc_lblElement.gridy = 0;
    gbc_lblElement.anchor = GridBagConstraints.FIRST_LINE_START;
    add(lblElement, gbc_lblElement);

    elementComboBox = new JComboBox<String>();
    GridBagConstraints gbc_elementComboBox = new GridBagConstraints();
    gbc_elementComboBox.fill = GridBagConstraints.HORIZONTAL;
    gbc_elementComboBox.insets = new Insets(0, 0, 5, 0);
    gbc_elementComboBox.gridx = 1;
    gbc_elementComboBox.gridy = 0;
    gbc_elementComboBox.anchor = GridBagConstraints.FIRST_LINE_START;
    add(elementComboBox, gbc_elementComboBox);
    elementComboBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            try {
                initItemNameSelector();
            } catch (Exception ee) {
                LOGGER.severe(ee.toString());
            }
        }
    });
    JLabel lblItemNameField = new JLabel("Item field");
    GridBagConstraints gbc_lblItemField = new GridBagConstraints();
    gbc_lblItemField.insets = new Insets(5, 5, 5, 5);
    gbc_lblItemField.gridx = 0;
    gbc_lblItemField.gridy = 1;
    gbc_lblItemField.anchor = GridBagConstraints.FIRST_LINE_START;

    add(lblItemNameField, gbc_lblItemField);

    itemNameFieldComboBox = new JComboBox<String>();
    GridBagConstraints gbc_itemNameFieldComboBox = new GridBagConstraints();
    gbc_itemNameFieldComboBox.insets = new Insets(0, 0, 5, 0);
    gbc_itemNameFieldComboBox.fill = GridBagConstraints.HORIZONTAL;
    gbc_itemNameFieldComboBox.gridx = 1;
    gbc_itemNameFieldComboBox.gridy = 1;
    gbc_itemNameFieldComboBox.anchor = GridBagConstraints.FIRST_LINE_START;
    add(itemNameFieldComboBox, gbc_itemNameFieldComboBox);
    itemNameFieldComboBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            try {
                initItemNameSelector();
                initItemValueSelector();
            } catch (Exception ee) {
                LOGGER.severe(ee.toString());
            }
        }
    });
    JLabel itemTitle = new JLabel("Item title");
    GridBagConstraints gbc_lblItemtitle = new GridBagConstraints();
    gbc_lblItemtitle.insets = new Insets(5, 5, 5, 5);
    gbc_lblItemtitle.gridx = 0;
    gbc_lblItemtitle.gridy = 2;
    gbc_lblItemtitle.anchor = GridBagConstraints.FIRST_LINE_START;
    add(itemTitle, gbc_lblItemtitle);

    itemNameComboBox = new JComboBox<String>();
    GridBagConstraints gbc_itemComboBox = new GridBagConstraints();
    gbc_itemComboBox.insets = new Insets(0, 0, 5, 0);
    gbc_itemComboBox.fill = GridBagConstraints.HORIZONTAL;
    gbc_itemComboBox.gridx = 1;
    gbc_itemComboBox.gridy = 2;
    gbc_itemComboBox.anchor = GridBagConstraints.FIRST_LINE_START;
    add(itemNameComboBox, gbc_itemComboBox);
    itemNameComboBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            try {
                initItemValueSelector();
            } catch (Exception ee) {
                LOGGER.severe(ee.toString());
            }
        }
    });

    JLabel itemValue = new JLabel("Item value");
    GridBagConstraints gbc_lblItemValue = new GridBagConstraints();
    gbc_lblItemValue.insets = new Insets(5, 5, 5, 5);
    gbc_lblItemValue.weighty = 0.0;
    gbc_lblItemValue.gridx = 0;
    gbc_lblItemValue.gridy = 3;
    gbc_lblItemValue.anchor = GridBagConstraints.FIRST_LINE_START;
    add(itemValue, gbc_lblItemValue);

    itemValueComboBox = new JComboBox<String>();
    GridBagConstraints gbc_itemValueComboBox = new GridBagConstraints();
    gbc_itemValueComboBox.insets = new Insets(0, 0, 5, 0);
    gbc_itemValueComboBox.fill = GridBagConstraints.HORIZONTAL;
    gbc_itemValueComboBox.gridx = 1;
    gbc_itemValueComboBox.gridy = 3;
    gbc_itemValueComboBox.anchor = GridBagConstraints.FIRST_LINE_START;
    add(itemValueComboBox, gbc_itemValueComboBox);
    table = new JTable();
    JScrollPane scrollPane = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

    table.addMouseListener(new java.awt.event.MouseAdapter() {
        @Override
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            int row = table.rowAtPoint(evt.getPoint());
            int col = table.columnAtPoint(evt.getPoint());
            System.out.println("JQueryPanel:cell click:row=" + row + " column=" + col);
            if (col == 1) {
                String label$ = (String) table.getValueAt(row, 1);
                System.out.println("JQueryPanel:cell click:label=" + label$);
                Entigrator entigrator = console.getEntigrator(entihome$);
                String entity$ = entigrator.indx_keyAtLabel(label$);
                JEntityFacetPanel efp = new JEntityFacetPanel();
                String efpLocator$ = efp.getLocator();
                efpLocator$ = Locator.append(efpLocator$, Entigrator.ENTIHOME, entihome$);
                efpLocator$ = Locator.append(efpLocator$, EntityHandler.ENTITY_KEY, entity$);
                JConsoleHandler.execute(console, efpLocator$);
            }
        }
    });
    GridBagConstraints gbc_scroll_panel = new GridBagConstraints();
    gbc_scroll_panel.anchor = GridBagConstraints.NORTH;
    gbc_scroll_panel.gridwidth = 2;
    gbc_scroll_panel.weighty = 1.0;
    gbc_scroll_panel.fill = GridBagConstraints.HORIZONTAL;
    gbc_scroll_panel.gridx = 0;
    gbc_scroll_panel.gridy = 4;
    add(scrollPane, gbc_scroll_panel);
    scrollPane.setMinimumSize(scrollPane.getPreferredSize());
}

From source file:org.eevolution.form.VCRPDetail.java

private void jbInit() {

    dateFrom = new VDate("DateFrom", true, false, true, DisplayType.Date, "DateFrom");
    dateTo = new VDate("DateTo", true, false, true, DisplayType.Date, "DateTo");

    CPanel northPanel = new CPanel();
    northPanel.setLayout(new java.awt.GridBagLayout());

    northPanel.add(new CLabel(Msg.translate(Env.getCtx(), "S_Resource_ID")), new GridBagConstraints(0, 1, 1, 1,
            0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    northPanel.add(resource, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));

    northPanel.add(new CLabel(Msg.translate(Env.getCtx(), "DateFrom")), new GridBagConstraints(2, 1, 1, 1, 0.0,
            0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    northPanel.add(dateFrom, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));

    northPanel.add(new CLabel(Msg.translate(Env.getCtx(), "DateTo")), new GridBagConstraints(4, 1, 1, 1, 0.0,
            0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    northPanel.add(dateTo, new GridBagConstraints(5, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));

    ConfirmPanel confirmPanel = new ConfirmPanel(true);
    confirmPanel.addActionListener(new ActionHandler());

    contentPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    contentPanel.setPreferredSize(new Dimension(800, 600));

    m_form.getWindow().getContentPane().add(northPanel, BorderLayout.NORTH);
    m_form.getWindow().getContentPane().add(contentPanel, BorderLayout.CENTER);
    m_form.getWindow().getContentPane().add(confirmPanel, BorderLayout.SOUTH);
}

From source file:it.cnr.icar.eric.client.ui.swing.BusinessQueryPanel.java

/**
 * Class Constructor./*from  w  w w .  j  a v a 2s. c  o m*/
 */
public BusinessQueryPanel(final FindParamsPanel findParamsPanel, ConfigurationType uiConfigurationType)
        throws JAXRException {
    super(findParamsPanel, uiConfigurationType);

    GridBagLayout gbl = new GridBagLayout();
    setLayout(gbl);

    objectTypeLabel = new JLabel(resourceBundle.getString("title.objectType"), SwingConstants.LEADING);

    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 0.0;
    c.weighty = 0.0;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(4, 4, 0, 4);
    gbl.setConstraints(objectTypeLabel, c);
    add(objectTypeLabel);

    //TODO: SwingBoost: Localize this
    TreeNode tempTreeNode = new DefaultMutableTreeNode("loading object types...");
    objectTypeCombo = new it.cnr.icar.eric.client.ui.swing.TreeCombo(new DefaultTreeModel(tempTreeNode));

    c.gridx = 0;
    c.gridy = 1;
    c.gridwidth = 2;
    c.gridheight = 1;
    c.weightx = 0.5;
    c.weighty = 0.0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(4, 4, 4, 4);
    gbl.setConstraints(objectTypeCombo, c);
    add(objectTypeCombo);
    objectTypeCombo.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent ev) {
            if (ev.getStateChange() == ItemEvent.DESELECTED) {
                return;
            }

            @SuppressWarnings("unused")
            String objectType = getObjectType().toString();
        }
    });

    //The caseSensitive CheckBox
    caseSensitiveCheckBox = new JCheckBox(resourceBundle.getString("title.caseSensitiveSearch"));
    caseSensitiveCheckBox.setSelected(false);
    caseSensitiveCheckBox.setEnabled(true);
    c.gridx = 0;
    c.gridy = 2;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 0.0;
    c.weighty = 0.0;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(4, 4, 0, 4);
    gbl.setConstraints(caseSensitiveCheckBox, c);
    add(caseSensitiveCheckBox);

    //The name Text
    nameLabel = new JLabel(resourceBundle.getString("title.name"), SwingConstants.LEADING);
    c.gridx = 0;
    c.gridy = 3;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 0.5;
    c.weighty = 0.0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(4, 4, 0, 4);
    gbl.setConstraints(nameLabel, c);
    add(nameLabel);

    nameText = new JTextField();
    c.gridx = 0;
    c.gridy = 4;
    c.gridwidth = 2;
    c.gridheight = 1;
    c.weightx = 0.5;
    c.weighty = 0.0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(4, 4, 4, 4);
    gbl.setConstraints(nameText, c);
    add(nameText);

    nameText.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            findParamsPanel.find();
        }
    });

    //The description text
    descLabel = new JLabel(resourceBundle.getString("title.description"), SwingConstants.LEADING);
    c.gridx = 0;
    c.gridy = 5;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 0.0;
    c.weighty = 0.0;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(4, 4, 0, 4);
    gbl.setConstraints(descLabel, c);
    add(descLabel);

    descText = new JTextField();
    c.gridx = 0;
    c.gridy = 6;
    c.gridwidth = 2;
    c.gridheight = 1;
    c.weightx = 0.5;
    c.weighty = 0.0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(4, 4, 4, 4);
    gbl.setConstraints(descText, c);
    add(descText);

    descText.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            findParamsPanel.find();
        }
    });

    //Classifications
    classificationsLabel = new JLabel(resourceBundle.getString("title.classifications"),
            SwingConstants.LEADING);
    c.gridx = 0;
    c.gridy = 7;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 0.0;
    c.weighty = 0.0;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(4, 4, 0, 4);
    gbl.setConstraints(classificationsLabel, c);
    add(classificationsLabel);

    classificationsList = new ClassificationsList();
    classificationsList.setEditable(true);
    classificationsList.setVisibleRowCount(3);

    JScrollPane classificationsListScrollPane = new JScrollPane(classificationsList);

    //Workaround for bug 740746 where very wide item resulted in too short a height
    classificationsListScrollPane.setMinimumSize(new Dimension(-1, 50));

    c.gridx = 0;
    c.gridy = 8;
    c.gridwidth = 2;
    c.gridheight = 1;
    c.weightx = 0.5;
    c.weighty = 0.5;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(4, 4, 4, 4);
    gbl.setConstraints(classificationsListScrollPane, c);
    add(classificationsListScrollPane);

    //Identifiers
    identifiersLabel = new JLabel(resourceBundle.getString("title.externalIdentifiers"),
            SwingConstants.LEADING);
    c.gridx = 0;
    c.gridy = 9;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 0.0;
    c.weighty = 0.0;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(4, 4, 0, 4);
    gbl.setConstraints(identifiersLabel, c);
    add(identifiersLabel);

    extIdsList = new ExternalIdentifiersList();
    extIdsList.setEditable(true);
    extIdsList.setVisibleRowCount(3);

    JScrollPane extIdsListScrollPane = new JScrollPane(extIdsList);

    //Workaround for bug 740746 where very wide item resulted in too short a height
    extIdsListScrollPane.setMinimumSize(new Dimension(-1, 50));

    c.gridx = 0;
    c.gridy = 10;
    c.gridwidth = 2;
    c.gridheight = 1;
    c.weightx = 0.5;
    c.weighty = 0.5;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(4, 4, 4, 4);
    gbl.setConstraints(extIdsListScrollPane, c);
    add(extIdsListScrollPane);

    //External Links
    linksLabel = new JLabel(resourceBundle.getString("title.externalLinks"), SwingConstants.TRAILING);
    c.gridx = 0;
    c.gridy = 11;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 0.0;
    c.weighty = 0.0;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(4, 4, 0, 4);
    gbl.setConstraints(linksLabel, c);
    add(linksLabel);

    linksList = new ExternalLinksList();
    linksList.setEditable(true);
    linksList.setVisibleRowCount(3);

    JScrollPane linksListScrollPane = new JScrollPane(linksList);

    //Workaround for bug 740746 where very wide item resulted in too short a height
    linksListScrollPane.setMinimumSize(new Dimension(-1, 50));

    c.gridx = 0;
    c.gridy = 12;
    c.gridwidth = 2;
    c.gridheight = 1;
    c.weightx = 0.5;
    c.weighty = 0.5;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(4, 4, 4, 4);
    gbl.setConstraints(linksListScrollPane, c);
    add(linksListScrollPane);

    //add listener for 'locale' bound property
    RegistryBrowser.getInstance().addPropertyChangeListener(RegistryBrowser.PROPERTY_LOCALE, this);
}

From source file:com.sec.ose.osi.ui.dialog.setting.JPanReportProperty.java

/**
 * This method initializes jPanelValue   
 *    //from w  w w .  ja v  a2 s  .  com
 * @return javax.swing.JPanel   
 */
private JPanel getJPanelValue() {
    if (jPanelValue == null) {

        jPanelValue = new JPanel();
        jPanelValue.setLayout(new GridBagLayout());
        jPanelValue.setBorder(BorderFactory.createTitledBorder(null, "", TitledBorder.DEFAULT_JUSTIFICATION,
                TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));
        jPanelValue.setPreferredSize(new Dimension(400, 200));

        // Default Report Location

        jLabelDefaultReportLocation = new JLabel();
        jLabelDefaultReportLocation.setText("Default Report Location:");
        jLabelDefaultReportLocation.setHorizontalAlignment(SwingConstants.RIGHT);

        GridBagConstraints gridBagConstraintsjLabelDefaultReportLocation = new GridBagConstraints();
        gridBagConstraintsjLabelDefaultReportLocation.gridx = 0;
        gridBagConstraintsjLabelDefaultReportLocation.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraintsjLabelDefaultReportLocation.insets = new Insets(5, 0, 0, 0);
        gridBagConstraintsjLabelDefaultReportLocation.gridy = 1;

        GridBagConstraints gridBagConstraintsjpanelDefaultReportLocation = new GridBagConstraints();
        gridBagConstraintsjpanelDefaultReportLocation.fill = GridBagConstraints.BOTH;
        gridBagConstraintsjpanelDefaultReportLocation.gridy = 1;
        gridBagConstraintsjpanelDefaultReportLocation.weightx = 1.0;
        gridBagConstraintsjpanelDefaultReportLocation.insets = new Insets(10, 5, 5, 15);
        gridBagConstraintsjpanelDefaultReportLocation.gridx = 1;

        // reciprocal license

        jLabelReciprocalLicense = new JLabel();
        jLabelReciprocalLicense.setText("Reciprocal License (RED):");
        jLabelReciprocalLicense.setHorizontalAlignment(SwingConstants.RIGHT);

        GridBagConstraints gridBagConstraintsjLabelReciprocalLicense = new GridBagConstraints();
        gridBagConstraintsjLabelReciprocalLicense.gridx = 0;
        gridBagConstraintsjLabelReciprocalLicense.insets = new Insets(0, 15, 0, 0);
        gridBagConstraintsjLabelReciprocalLicense.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraintsjLabelReciprocalLicense.gridy = 2;
        jPanelValue.add(jLabelDefaultReportLocation, gridBagConstraintsjLabelDefaultReportLocation);
        jPanelValue.add(getJPanelDefaultReportLocation(), gridBagConstraintsjpanelDefaultReportLocation);
        jPanelValue.add(jLabelReciprocalLicense, gridBagConstraintsjLabelReciprocalLicense);

        GridBagConstraints gridBagConstraintsgetJTextFieldReciprocalLicense = new GridBagConstraints();
        gridBagConstraintsgetJTextFieldReciprocalLicense.gridx = 1;
        gridBagConstraintsgetJTextFieldReciprocalLicense.weightx = 1.0;
        gridBagConstraintsgetJTextFieldReciprocalLicense.fill = GridBagConstraints.BOTH;
        gridBagConstraintsgetJTextFieldReciprocalLicense.insets = new Insets(5, 5, 5, 15);
        gridBagConstraintsgetJTextFieldReciprocalLicense.gridy = 2;
        jPanelValue.add(getJTextFieldReciprocalLicense(), gridBagConstraintsgetJTextFieldReciprocalLicense);

        // major license

        jLabelMajorLicense = new JLabel();
        jLabelMajorLicense.setText("Major License (ORANGE):");
        jLabelMajorLicense.setHorizontalAlignment(SwingConstants.RIGHT);

        GridBagConstraints gridBagConstraintsjLabelMajorLicense = new GridBagConstraints();
        gridBagConstraintsjLabelMajorLicense.gridx = 0;
        gridBagConstraintsjLabelMajorLicense.insets = new Insets(0, 15, 0, 0);
        gridBagConstraintsjLabelMajorLicense.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraintsjLabelMajorLicense.gridy = 3;
        jPanelValue.add(jLabelMajorLicense, gridBagConstraintsjLabelMajorLicense);

        GridBagConstraints gridBagConstraintsgetJTextFieldMajorLicense = new GridBagConstraints();
        gridBagConstraintsgetJTextFieldMajorLicense.gridx = 1;
        gridBagConstraintsgetJTextFieldMajorLicense.weightx = 1.0;
        gridBagConstraintsgetJTextFieldMajorLicense.fill = GridBagConstraints.BOTH;
        gridBagConstraintsgetJTextFieldMajorLicense.insets = new Insets(5, 5, 5, 15);
        gridBagConstraintsgetJTextFieldMajorLicense.gridy = 3;
        jPanelValue.add(getJTextFieldMajorLicense(), gridBagConstraintsgetJTextFieldMajorLicense);

        GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
        gridBagConstraints3.gridx = 1;
        gridBagConstraints3.weighty = 1.0;
        gridBagConstraints3.weightx = 0.0;
        gridBagConstraints3.gridy = 4;
        JLabel jLabelEmpty = new JLabel();
        jLabelEmpty.setText("");
        jPanelValue.add(jLabelEmpty, gridBagConstraints3);
    }
    return jPanelValue;
}

From source file:dk.dma.epd.common.prototype.gui.notification.ChatServicePanel.java

/**
 * Constructor// w w  w .j a v a2  s. c  o m
 * 
 * @param compactLayout
 *            if false, there will be message type selectors in the panel
 */
public ChatServicePanel(boolean compactLayout) {
    super(new BorderLayout());

    // Prepare the title header
    titleHeader.setBackground(getBackground().darker());
    titleHeader.setOpaque(true);
    titleHeader.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    titleHeader.setHorizontalAlignment(SwingConstants.CENTER);
    add(titleHeader, BorderLayout.NORTH);

    // Add messages panel
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    messagesPanel.setBackground(UIManager.getColor("List.background"));
    messagesPanel.setOpaque(false);
    messagesPanel.setLayout(new GridBagLayout());
    messagesPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    add(scrollPane, BorderLayout.CENTER);

    JPanel sendPanel = new JPanel(new GridBagLayout());
    add(sendPanel, BorderLayout.SOUTH);
    Insets insets = new Insets(2, 2, 2, 2);

    // Add text area
    if (compactLayout) {
        messageText = new JTextField();
        ((JTextField) messageText).addActionListener(this);
        sendPanel.add(messageText, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, NORTH, BOTH, insets, 0, 0));

    } else {
        messageText = new JTextArea();
        JScrollPane scrollPane2 = new JScrollPane(messageText);
        scrollPane2.setPreferredSize(new Dimension(100, 50));
        scrollPane2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        scrollPane2.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
        sendPanel.add(scrollPane2, new GridBagConstraints(0, 0, 1, 2, 1.0, 1.0, NORTH, BOTH, insets, 0, 0));
    }

    // Add buttons
    ButtonGroup group = new ButtonGroup();
    messageTypeBtn = createMessageTypeButton("Send messages", ICON_MESSAGE, true, group);
    warningTypeBtn = createMessageTypeButton("Send warnings", ICON_WARNING, false, group);
    alertTypeBtn = createMessageTypeButton("Send alerts", ICON_ALERT, false, group);

    if (!compactLayout) {
        JToolBar msgTypePanel = new JToolBar();
        msgTypePanel.setBorderPainted(false);
        msgTypePanel.setOpaque(true);
        msgTypePanel.setFloatable(false);
        sendPanel.add(msgTypePanel, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0));
        msgTypePanel.add(messageTypeBtn);
        msgTypePanel.add(warningTypeBtn);
        msgTypePanel.add(alertTypeBtn);
    }

    if (compactLayout) {
        sendBtn = new JButton("Send");
        sendPanel.add(sendBtn, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0));
    } else {
        sendBtn = new JButton("Send", ICON_MESSAGE);
        sendBtn.setPreferredSize(new Dimension(100, sendBtn.getPreferredSize().height));
        sendPanel.add(sendBtn, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0));
    }
    sendBtn.setEnabled(false);
    messageText.setEditable(false);
    sendBtn.addActionListener(this);
}

From source file:com.att.aro.ui.view.videotab.VideoTab.java

public void addGraphPanel() {
    if (mainPanel != null) {
        mainPanel.add(buildGraphPanel(), new GridBagConstraints(0, graphPanelIndex, 1, 1, 1.0, 0.0,
                GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(10, 0, 0, 0), 0, 0));
    }//ww  w  . j a  v a 2  s . c o  m
    aroView.getDiagnosticTab().getGraphPanel().setChartOptions(ChartPlotOptions.getVideoDefaultView());
}

From source file:com.xmage.launcher.XMageLauncher.java

private XMageLauncher() {
    locale = Locale.getDefault();
    //locale = new Locale("it", "IT");
    messages = ResourceBundle.getBundle("MessagesBundle", locale);
    localize();//from  w  w w .  j  a  v  a  2 s.c  o m

    serverConsole = new XMageConsole("XMage Server console");
    clientConsole = new XMageConsole("XMage Client console");

    frame = new JFrame(messages.getString("frameTitle") + " " + Config.getVersion());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setPreferredSize(new Dimension(800, 500));
    frame.setResizable(false);

    createToolbar();

    ImageIcon icon = new ImageIcon(XMageLauncher.class.getResource("/icon-mage-flashed.png"));
    frame.setIconImage(icon.getImage());

    Random r = new Random();
    int imageNum = 1 + r.nextInt(17);
    ImageIcon background = new ImageIcon(new ImageIcon(
            XMageLauncher.class.getResource("/backgrounds/" + Integer.toString(imageNum) + ".jpg")).getImage()
                    .getScaledInstance(800, 480, Image.SCALE_SMOOTH));
    mainPanel = new JLabel(background) {
        @Override
        public Dimension getPreferredSize() {
            Dimension size = super.getPreferredSize();
            Dimension lmPrefSize = getLayout().preferredLayoutSize(this);
            size.width = Math.max(size.width, lmPrefSize.width);
            size.height = Math.max(size.height, lmPrefSize.height);
            return size;
        }
    };
    mainPanel.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            grabPoint = e.getPoint();
            mainPanel.getComponentAt(grabPoint);
        }
    });
    mainPanel.addMouseMotionListener(new MouseMotionAdapter() {
        @Override
        public void mouseDragged(MouseEvent e) {

            // get location of Window
            int thisX = frame.getLocation().x;
            int thisY = frame.getLocation().y;

            // Determine how much the mouse moved since the initial click
            int xMoved = (thisX + e.getX()) - (thisX + grabPoint.x);
            int yMoved = (thisY + e.getY()) - (thisY + grabPoint.y);

            // Move window to this position
            int X = thisX + xMoved;
            int Y = thisY + yMoved;
            frame.setLocation(X, Y);
        }
    });
    mainPanel.setLayout(new GridBagLayout());

    GridBagConstraints constraints = new GridBagConstraints();
    constraints.insets = new Insets(10, 10, 10, 10);

    Font font16 = new Font("Arial", Font.BOLD, 16);
    Font font12 = new Font("Arial", Font.PLAIN, 12);
    Font font12b = new Font("Arial", Font.BOLD, 12);

    mainPanel.add(Box.createRigidArea(new Dimension(250, 50)));

    ImageIcon logo = new ImageIcon(new ImageIcon(XMageLauncher.class.getResource("/label-xmage.png")).getImage()
            .getScaledInstance(150, 75, Image.SCALE_SMOOTH));
    xmageLogo = new JLabel(logo);
    constraints.gridx = 3;
    constraints.gridy = 0;
    constraints.gridheight = 1;
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    constraints.anchor = GridBagConstraints.EAST;
    mainPanel.add(xmageLogo, constraints);

    textArea = new JTextArea(5, 40);
    textArea.setEditable(false);
    textArea.setForeground(Color.WHITE);
    textArea.setBackground(Color.BLACK);
    DefaultCaret caret = (DefaultCaret) textArea.getCaret();
    caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
    scrollPane = new JScrollPane(textArea);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    constraints.gridx = 2;
    constraints.gridy = 1;
    constraints.weightx = 1.0;
    constraints.weighty = 1.0;
    constraints.fill = GridBagConstraints.BOTH;
    mainPanel.add(scrollPane, constraints);

    labelProgress = new JLabel(messages.getString("progress"));
    labelProgress.setFont(font12);
    labelProgress.setForeground(Color.WHITE);
    constraints.gridy = 2;
    constraints.weightx = 0.0;
    constraints.weighty = 0.0;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.WEST;
    mainPanel.add(labelProgress, constraints);

    progressBar = new JProgressBar(0, 100);
    constraints.gridx = 3;
    constraints.weightx = 1.0;
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(progressBar, constraints);

    JPanel pnlButtons = new JPanel();
    pnlButtons.setLayout(new GridBagLayout());
    pnlButtons.setOpaque(false);
    constraints.gridx = 0;
    constraints.gridy = 3;
    constraints.gridheight = GridBagConstraints.REMAINDER;
    constraints.fill = GridBagConstraints.BOTH;
    mainPanel.add(pnlButtons, constraints);

    btnLaunchClient = new JButton(messages.getString("launchClient"));
    btnLaunchClient.setToolTipText(messages.getString("launchClient.tooltip"));
    btnLaunchClient.setFont(font16);
    btnLaunchClient.setForeground(Color.GRAY);
    btnLaunchClient.setEnabled(false);
    btnLaunchClient.setPreferredSize(new Dimension(180, 60));
    btnLaunchClient.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            handleClient();
        }
    });

    constraints.gridx = GridBagConstraints.RELATIVE;
    constraints.gridy = 0;
    constraints.gridwidth = 1;
    constraints.fill = GridBagConstraints.BOTH;
    pnlButtons.add(btnLaunchClient, constraints);

    btnLaunchClientServer = new JButton(messages.getString("launchClientServer"));
    btnLaunchClientServer.setToolTipText(messages.getString("launchClientServer.tooltip"));
    btnLaunchClientServer.setFont(font12b);
    btnLaunchClientServer.setEnabled(false);
    btnLaunchClientServer.setForeground(Color.GRAY);
    btnLaunchClientServer.setPreferredSize(new Dimension(80, 40));
    btnLaunchClientServer.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            handleServer();
            handleClient();
        }
    });

    constraints.fill = GridBagConstraints.HORIZONTAL;
    pnlButtons.add(btnLaunchClientServer, constraints);

    btnLaunchServer = new JButton(messages.getString("launchServer"));
    btnLaunchServer.setToolTipText(messages.getString("launchServer.tooltip"));
    btnLaunchServer.setFont(font12b);
    btnLaunchServer.setEnabled(false);
    btnLaunchServer.setForeground(Color.GRAY);
    btnLaunchServer.setPreferredSize(new Dimension(80, 40));
    btnLaunchServer.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            handleServer();
        }
    });

    pnlButtons.add(btnLaunchServer, constraints);

    btnUpdate = new JButton(messages.getString("update.xmage"));
    btnUpdate.setToolTipText(messages.getString("update.xmage.tooltip"));
    btnUpdate.setFont(font12b);
    btnUpdate.setForeground(Color.BLACK);
    btnUpdate.setPreferredSize(new Dimension(80, 40));
    btnUpdate.setEnabled(true);

    btnUpdate.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            handleUpdate();
        }
    });

    pnlButtons.add(btnUpdate, constraints);

    btnCheck = new JButton(messages.getString("check.xmage"));
    btnCheck.setToolTipText(messages.getString("check.xmage.tooltip"));
    btnCheck.setFont(font12b);
    btnCheck.setForeground(Color.BLACK);
    btnCheck.setPreferredSize(new Dimension(80, 40));
    btnCheck.setEnabled(true);

    btnCheck.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            handleCheckUpdates();
        }
    });

    pnlButtons.add(btnCheck, constraints);

    frame.add(mainPanel);
    frame.pack();
    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
    frame.setLocation(dim.width / 2 - frame.getSize().width / 2, dim.height / 2 - frame.getSize().height / 2);
}

From source file:edu.ku.brc.ui.ImageDisplay.java

/**
*
*///  ww  w .ja v  a 2  s  .  c o  m
protected void createUI() {
    this.setLayout(new FormLayout("f:p:g" + (isEditMode ? ",2px,p" : ""), "p"));
    CellConstraints cc = new CellConstraints();

    if (isEditMode) {
        ImageIcon icon = IconManager.getImage("EditIcon", IconManager.IconSize.NonStd);

        editBtn = new JButton(icon);
        editBtn.setMargin(new Insets(1, 1, 1, 1));
        editBtn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                selectNewImage();
            }
        });
        add(editBtn, cc.xy(3, 1));
    }
}

From source file:com.sec.ose.osi.ui.frm.main.report.JPanBillOfMaterials.java

private JPanel getJPanelOptions() {
    if (jPanelOptions == null) {
        GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
        gridBagConstraints3.gridx = 1;/* w  w  w.  j  av a 2  s. c o m*/
        gridBagConstraints3.fill = GridBagConstraints.BOTH;
        gridBagConstraints3.insets = new Insets(0, 0, 10, 0);
        gridBagConstraints3.gridy = 1;
        jLabelSelectedComponent = new JLabel();
        jLabelSelectedComponent.setText("Display files for the selected components");
        jLabelSelectedComponent.addMouseListener(new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
                eventHandler.handleEvent(EventHandler.RADIO_SELECTED_COMPONENT);

            }
        });
        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
        gridBagConstraints2.gridx = 0;
        gridBagConstraints2.insets = new Insets(0, 10, 10, 0);
        gridBagConstraints2.gridy = 1;
        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
        gridBagConstraints1.gridx = 1;
        gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints1.insets = new Insets(10, 0, 10, 0);
        gridBagConstraints1.gridwidth = 1;
        gridBagConstraints1.gridy = 0;
        jLabelAllFiles = new JLabel();
        jLabelAllFiles.addMouseListener(new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
                eventHandler.handleEvent(EventHandler.RADIO_ALL_FILES);

            }
        });

        jLabelAllFiles.setText("Display all files for all components");
        GridBagConstraints gridBagConstraints = new GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.insets = new Insets(0, 10, 0, 0);
        gridBagConstraints.gridy = 0;
        jPanelOptions = new JPanel();
        jPanelOptions.setLayout(new GridBagLayout());
        jPanelOptions.add(getJRadioAllFilesForAll(), gridBagConstraints);
        jPanelOptions.add(jLabelAllFiles, gridBagConstraints1);
        jPanelOptions.add(getJRadioAllFilesForSelectedComponent(), gridBagConstraints2);
        jPanelOptions.add(jLabelSelectedComponent, gridBagConstraints3);
    }
    return jPanelOptions;
}

From source file:edu.harvard.mcz.imagecapture.RunnableJobReportDialog.java

/**
 * This method initializes jPanel1   // w w  w.  j  a  v  a2  s  .  co  m
 *    
 * @return javax.swing.JPanel   
 */
private JPanel getJPanel1() {
    if (jPanel1 == null) {
        jPanel1 = new JPanel();
        jPanel1.setLayout(new GridBagLayout());
        GridBagConstraints gbc_jButtonSave = new GridBagConstraints();
        gbc_jButtonSave.insets = new Insets(0, 0, 0, 5);
        gbc_jButtonSave.gridx = 0;
        gbc_jButtonSave.gridy = 0;
        jPanel1.add(getJButtonSave(), gbc_jButtonSave);
        GridBagConstraints gbc_jButton = new GridBagConstraints();
        gbc_jButton.gridx = 1;
        gbc_jButton.gridy = 0;
        jPanel1.add(getJButton(), gbc_jButton);
    }
    return jPanel1;
}