Example usage for java.awt GridBagConstraints FIRST_LINE_START

List of usage examples for java.awt GridBagConstraints FIRST_LINE_START

Introduction

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

Prototype

int FIRST_LINE_START

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

Click Source Link

Document

Place the component in the corner of its display area where the first line of text on a page would normally begin for the current ComponentOrientation .

Usage

From source file:Main.java

public static void main(String... args) {
    JPanel contentPane;/*from  w w  w  . j a  v  a 2s.  c  o m*/
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    contentPane = new JPanel();
    contentPane.setLayout(new GridBagLayout());

    JPanel centerPanel = new JPanel();
    centerPanel.setOpaque(true);
    centerPanel.setBackground(Color.CYAN);

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.FIRST_LINE_START;
    gbc.weightx = 1.0;
    gbc.weighty = 0.9;
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.gridwidth = 2;
    gbc.fill = GridBagConstraints.BOTH;

    contentPane.add(centerPanel, gbc);

    JButton leftButton = new JButton("Left");
    JButton rightButton = new JButton("Right");
    gbc.gridwidth = 1;
    gbc.gridy = 1;
    gbc.weightx = 0.3;
    gbc.weighty = 0.1;

    contentPane.add(leftButton, gbc);

    gbc.gridx = 1;
    gbc.weightx = 0.7;
    gbc.weighty = 0.1;

    contentPane.add(rightButton, gbc);

    frame.setContentPane(contentPane);
    frame.pack();
    frame.setLocationByPlatform(true);
    frame.setVisible(true);

}

From source file:com.att.aro.ui.view.menu.file.BPVideoWarnFailPanel.java

public BPVideoWarnFailPanel() {
    JPanel mainPanel = new JPanel();
    this.add(mainPanel);
    mainPanel.setLayout(new GridBagLayout());
    GridBagConstraints constraint = new GridBagConstraints();
    mainPanel.add(getGridPanel(), constraint);
    mainPanel.add(getDefaultButton("Default", (ActionEvent arg) -> setDefault()), constraint);
    compileResultsField.setEditable(false);
    if (sError.isEmpty()) {
        compileResultsField.setBackground(mainPanel.getBackground());
        compileResultsField.setForeground(Color.red);
        compileResultsField.setFont(compileResultsField.getFont().deriveFont(Font.BOLD));
        compileResultsField.setText("");
        compileResultsField.setVisible(false);
    } else {/*from w  w  w .  ja  va2 s  .c  om*/
        compileResultsField.setVisible(true);
        compileResultsField.setForeground(Color.red);
        compileResultsField.setText(String.format("ERRORS: %s", sError));
    }
    constraint.anchor = GridBagConstraints.FIRST_LINE_START;
    constraint.gridy = 300;
    constraint.gridwidth = 2;
    mainPanel.add(compileResultsField, constraint);
}

From source file:be.ac.ua.comp.scarletnebula.gui.ServerCellRenderer.java

@Override
public Component getListCellRendererComponent(final JList list, final Object value, final int index,
        final boolean isSelected, final boolean cellHasFocus) {
    // Dirty hack: the last item in the serverlist is always a fake server
    // that when double clicked produces an "add new server" wizard.
    if (value == null) {
        return getNewServerServer(list, index, isSelected);
    }/*  w ww.  j av  a 2s .  c  o  m*/
    final Server server = (Server) value;

    final JPanel p = createServerPanel(server, list, index, isSelected);
    final Color foreground = getForegroundColor(list, index, isSelected);

    final JLabel label = getServernameComponent(server, foreground);
    final JLabel tags = getTagComponent(server, foreground);
    // final ChartPanel chartPanel = getChartPanelComponent();

    final GraphPanelCache gcp = GraphPanelCache.get();

    final Component chartOrNothing;

    if (server.getServerStatistics() == null) {
        chartOrNothing = new JLabel();
    } else {
        chartOrNothing = gcp.inBareServerCache(server) ? gcp.getBareChartPanel(server)
                : createAndStoreBareChartPanel(list, server);
    }

    p.setLayout(new GridBagLayout());
    final GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    c.gridx = 0;
    c.gridy = 0;
    c.insets = new Insets(5, 5, 1, 5);
    c.anchor = GridBagConstraints.FIRST_LINE_START;

    p.add(label, c);
    c.insets = new Insets(0, 5, 5, 5);
    c.gridy = 1;
    p.add(tags, c);

    c.fill = GridBagConstraints.BOTH;
    c.weighty = 1.0;
    c.gridy = 2;
    p.add(chartOrNothing, c);

    return p;

}

From source file:com.github.boogey.progressview.swing.JProgressPanel.java

/**
 * This protected method set the location of the components ({@link JLabel} and {@link JProgressBar}) on the
 * {@link JPanel}. The layout is set in the {@link #initObjects()}-method. This {@link JPanel} will use an
 * {@link GridBagLayout}./*  www  .  ja  va 2s  . c  om*/
 */
protected void positionElements() {
    GridBagConstraints constraints = new GridBagConstraints();

    constraints.insets = new Insets(5, 5, 5, 5);
    constraints.anchor = GridBagConstraints.FIRST_LINE_START;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.weightx = 1.0;
    constraints.weighty = 0.0;

    constraints.gridx = 0;
    constraints.gridy = 0;
    positionMessage(constraints);

    constraints.anchor = GridBagConstraints.FIRST_LINE_START;
    constraints.weightx = 1.0;
    constraints.weighty = 1.0;
    constraints.gridy = 1;
    positionProgressBar(constraints);
}

From source file:com.game.ui.views.MapEditor.java

public void generateGUI() throws IOException {
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    //        setResizable(false);
    JMenuBar menubar = new JMenuBar();
    ImageIcon icon = null;/*from w  w w .j  a v a2  s .c  o  m*/
    try {
        icon = GameUtils.shrinkImage("save.png", 20, 20);
    } catch (IOException e) {
        System.out.println("Dialog : showDialogForMap(): Exception occured :" + e);
        e.printStackTrace();
    }
    JMenu file = new JMenu("File");
    JMenuItem save = new JMenuItem("Save", icon);
    save.setToolTipText("Save Map Information");
    save.setActionCommand("Save Map");
    save.addActionListener(this);
    file.add(save);
    menubar.add(file);
    setJMenuBar(menubar);
    JPanel topPanel = new JPanel();
    topPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    topPanel.setLayout(new GridBagLayout());
    JLabel headerLbl = new JLabel("Legend : ");
    headerLbl.setFont(new Font("Times New Roman", Font.BOLD, 15));
    JLabel lbl1 = new JLabel();
    lbl1.setPreferredSize(new Dimension(50, 20));
    lbl1.setBackground(Configuration.pathColor);
    lbl1.setOpaque(true);
    JLabel lbl2 = new JLabel("- Represents the path.");
    JLabel lbl3 = new JLabel();
    lbl3.setPreferredSize(new Dimension(50, 20));
    lbl3.setBackground(Configuration.enemyColor);
    lbl3.setOpaque(true);
    JLabel lbl4 = new JLabel("- Represents the path with monsters");
    JLabel lbl5 = new JLabel();
    lbl5.setPreferredSize(new Dimension(50, 20));
    lbl5.setBackground(Configuration.startPointColor);
    lbl5.setOpaque(true);
    JLabel lbl6 = new JLabel("- Represents the starting point in the path");
    JLabel lbl7 = new JLabel();
    lbl7.setBackground(Configuration.endPointColor);
    lbl7.setOpaque(true);
    lbl7.setPreferredSize(new Dimension(50, 20));
    JLabel lbl8 = new JLabel("- Ending point in the path");
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 0;
    c.weightx = 1;
    c.weighty = 0;
    c.insets = new Insets(5, 5, 5, 5);
    c.gridwidth = 2;
    topPanel.add(headerLbl, c);
    c.fill = GridBagConstraints.NONE;
    c.gridx = 0;
    c.gridy = 1;
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.ipadx = 5;
    c.ipady = 5;
    topPanel.add(lbl1, c);
    c.gridx = 1;
    c.anchor = GridBagConstraints.FIRST_LINE_START;
    topPanel.add(lbl2, c);
    c.gridx = 0;
    c.gridy = 2;
    topPanel.add(lbl3, c);
    c.gridx = 1;
    topPanel.add(lbl4, c);
    c.gridx = 0;
    c.gridy = 3;
    topPanel.add(lbl5, c);
    c.gridx = 1;
    topPanel.add(lbl6, c);
    c.gridx = 0;
    c.gridy = 4;
    topPanel.add(lbl7, c);
    c.gridx = 1;
    topPanel.add(lbl8, c);
    add(topPanel, BorderLayout.NORTH);
    bottomPanel = new JPanel();
    add(bottomPanel, BorderLayout.CENTER);
    bottomPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    //        bottomPanel.add(new JButton("kaushik"));
    pack();
    setExtendedState(JFrame.MAXIMIZED_BOTH);
    GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
    setMaximizedBounds(env.getMaximumWindowBounds());
    setVisible(true);
    callDialogForUsersInput();
}

From source file:be.fedict.eid.tsl.tool.TslInternalFrame.java

private void addSignatureTab(JTabbedPane tabbedPane) {
    GridBagLayout gridBagLayout = new GridBagLayout();
    JPanel dataPanel = new JPanel(gridBagLayout);
    JPanel signaturePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    tabbedPane.add("Signature", new JScrollPane(signaturePanel));
    signaturePanel.add(dataPanel);/*  w  w  w.ja v a 2s  .  c  o m*/

    GridBagConstraints constraints = new GridBagConstraints();

    JLabel signerLabel = new JLabel("Signer");
    constraints.anchor = GridBagConstraints.FIRST_LINE_START;
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.ipadx = 10;
    dataPanel.add(signerLabel, constraints);
    this.signer = new JLabel();
    constraints.gridx++;
    dataPanel.add(this.signer, constraints);

    JLabel signerSha1FingerprintLabel = new JLabel("Public key SHA1 fingerprint:");
    constraints.gridx = 0;
    constraints.gridy++;
    dataPanel.add(signerSha1FingerprintLabel, constraints);
    this.signerSha1Fingerprint = new JLabel();
    constraints.gridx++;
    dataPanel.add(this.signerSha1Fingerprint, constraints);

    JLabel signerSha256FingerprintLabel = new JLabel("Public key SHA256 fingerprint:");
    constraints.gridx = 0;
    constraints.gridy++;
    dataPanel.add(signerSha256FingerprintLabel, constraints);
    this.signerSha256Fingerprint = new JLabel();
    constraints.gridx++;
    dataPanel.add(this.signerSha256Fingerprint, constraints);

    this.saveSignerCertificateButton = new JButton("Save Certificate...");
    constraints.gridx = 0;
    constraints.gridy++;
    dataPanel.add(this.saveSignerCertificateButton, constraints);
    this.saveSignerCertificateButton.addActionListener(this);
    this.saveSignerCertificateButton.setEnabled(false);

    updateView();
}

From source file:gdt.jgui.entity.webset.JWeblinkEditor.java

/**
 * The default constructor./*  w  w w  .  j  a  v a  2  s.  c om*/
 */
public JWeblinkEditor() {
    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.rowHeights = new int[] { 0, 0, 0, 0, 0 };
    gridBagLayout.columnWeights = new double[] { 0.0, 1.0 };
    gridBagLayout.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0 };
    setLayout(gridBagLayout);

    String icon$ = Support.readHandlerIcon(null, JEntitiesPanel.class, "globe.png");
    byte[] ba = Base64.decodeBase64(icon$);
    ImageIcon icon = new ImageIcon(ba);
    Image image = icon.getImage().getScaledInstance(24, 24, 0);
    icon.setImage(image);
    JLabel iconLabel = new JLabel("Icon");
    c = new GridBagConstraints();
    c.insets = new Insets(5, 5, 5, 5);
    c.anchor = GridBagConstraints.FIRST_LINE_START;
    c.weighty = 0;
    c.gridx = 0;
    c.gridy = 0;
    add(iconLabel, c);
    iconLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            showIconMenu(e);
        }
    });
    iconIcon = new JLabel();
    iconIcon.setIcon(icon);
    c_0 = new GridBagConstraints();
    c_0.anchor = GridBagConstraints.WEST;
    c_0.insets = new Insets(0, 5, 5, 0);
    c.anchor = GridBagConstraints.WEST;
    c_0.gridx = 1;
    c_0.gridy = 0;
    add(iconIcon, c_0);
    iconIcon.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            showIconMenu(e);
        }
    });
    JLabel lblName = new JLabel("Name");
    c_1 = new GridBagConstraints();
    c_1.insets = new Insets(5, 5, 5, 5);
    c_1.fill = GridBagConstraints.HORIZONTAL;
    c_1.gridx = 0;
    c_1.gridy = 1;
    add(lblName, c_1);

    nameField = new JTextField();
    c_2 = new GridBagConstraints();
    c_2.insets = new Insets(0, 5, 5, 0);
    c_2.fill = GridBagConstraints.HORIZONTAL;
    c_2.gridx = 1;
    c_2.gridy = 1;
    add(nameField, c_2);

    JLabel lblUrl = new JLabel("Address");
    c_3 = new GridBagConstraints();
    c_3.insets = new Insets(5, 5, 5, 5);
    c_3.fill = GridBagConstraints.HORIZONTAL;
    c_3.gridx = 0;
    c_3.gridy = 2;
    add(lblUrl, c_3);

    addressField = new JTextField();
    c_4 = new GridBagConstraints();
    c_4.insets = new Insets(0, 5, 5, 0);
    c_4.fill = GridBagConstraints.HORIZONTAL;
    c_4.gridx = 1;
    c_4.gridy = 2;
    add(addressField, c_4);

    JLabel lblLogin = new JLabel("Login");
    c_5 = new GridBagConstraints();
    c_5.insets = new Insets(5, 5, 5, 5);
    c_5.fill = GridBagConstraints.HORIZONTAL;
    c_5.gridx = 0;
    c_5.gridy = 3;
    add(lblLogin, c_5);
    lblLogin.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            showLoginMenu(e);
        }
    });
    loginField = new JTextField();
    c_6 = new GridBagConstraints();
    c_6.insets = new Insets(0, 5, 5, 0);
    c_6.fill = GridBagConstraints.HORIZONTAL;
    c_6.gridx = 1;
    c_6.gridy = 3;
    add(loginField, c_6);

    JLabel lblPassword = new JLabel("Password");
    c_7 = new GridBagConstraints();
    c_7.insets = new Insets(5, 5, 5, 5);
    c_7.fill = GridBagConstraints.HORIZONTAL;
    c_7.gridx = 0;
    c_7.gridy = 4;
    add(lblPassword, c_7);
    lblPassword.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            showPasswordMenu(e);
        }
    });

    passwordField = new JTextField();
    c_8 = new GridBagConstraints();
    c_8.insets = new Insets(0, 5, 5, 0);
    c_8.fill = GridBagConstraints.HORIZONTAL;
    c_8.gridx = 1;
    c_8.gridy = 4;
    add(passwordField, c_8);

    JPanel bottom = new JPanel();
    c_9 = new GridBagConstraints();
    c_9.weighty = 1;
    c_9.fill = GridBagConstraints.VERTICAL;
    c_9.gridx = 0;
    c_9.gridy = 5;
    add(bottom, c_9);
}

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

/**
 * The default constructor./*from   ww  w.j  ava  2  s . com*/
 */
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:be.fedict.eid.tsl.tool.TslInternalFrame.java

private void initDetailsPanel(JPanel detailsPanel) {
    detailsPanel.setBorder(new TitledBorder("Details"));
    detailsPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    GridBagLayout gridBagLayout = new GridBagLayout();
    JPanel dataPanel = new JPanel(gridBagLayout);
    detailsPanel.add(dataPanel);/*from   w ww.j  ava2  s.c o  m*/

    GridBagConstraints constraints = new GridBagConstraints();

    constraints.anchor = GridBagConstraints.FIRST_LINE_START;
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.ipadx = 10;
    dataPanel.add(new JLabel("Service Name"), constraints);
    this.serviceName = new JLabel();
    constraints.gridx++;
    dataPanel.add(this.serviceName, constraints);

    constraints.gridy++;
    constraints.gridx = 0;
    dataPanel.add(new JLabel("Service Type"), constraints);

    constraints.gridx++;
    this.serviceType = new JLabel();
    dataPanel.add(this.serviceType, constraints);

    constraints.gridy++;
    constraints.gridx = 0;
    dataPanel.add(new JLabel("Service Status"), constraints);

    constraints.gridx++;
    this.serviceStatus = new JLabel();
    dataPanel.add(this.serviceStatus, constraints);

    constraints.gridy++;
    constraints.gridx = 0;
    dataPanel.add(new JLabel("Service SHA1 Thumbprint"), constraints);

    constraints.gridx++;
    this.serviceSha1Thumbprint = new JLabel();
    dataPanel.add(this.serviceSha1Thumbprint, constraints);

    constraints.gridy++;
    constraints.gridx = 0;
    dataPanel.add(new JLabel("Service SHA256 Thumbprint"), constraints);

    constraints.gridx++;
    this.serviceSha256Thumbprint = new JLabel();
    dataPanel.add(this.serviceSha256Thumbprint, constraints);

    constraints.gridy++;
    constraints.gridx = 0;
    dataPanel.add(new JLabel("Validity begin"), constraints);

    constraints.gridx++;
    this.validityBegin = new JLabel();
    dataPanel.add(this.validityBegin, constraints);

    constraints.gridy++;
    constraints.gridx = 0;
    dataPanel.add(new JLabel("Validity end"), constraints);

    constraints.gridx++;
    this.validityEnd = new JLabel();
    dataPanel.add(this.validityEnd, constraints);
}

From source file:de.rub.syssec.saaf.gui.editor.FileTree.java

public FileTree(final ApplicationInterface app, File dir, OpenAnalysis open) {
    super();/*from  w ww. ja  va2s . co m*/
    this.openAna = open;
    history = new Vector<Vector<String>>();
    linkEditorKit = new LinkEditorKit(history, app.getUnpackedDataDir(), this);

    directory = dir;
    //userful to debug layout issues
    //setBackground(Color.MAGENTA);
    setLayout(new GridBagLayout());

    this.model = new EditorModel(app);

    // we want to be notified if the file changes so we can reflect that in
    // the tree
    model.addPropertyChangeListener(this);

    // the tree that lists the files (top left)
    JTree tree = new JTree(addNodes(null, dir));
    tree.addMouseListener(ma);
    tree.addTreeSelectionListener(new SelectionListener());
    tree.setCellRenderer(new FileCellRenderer());
    fileTree = tree;

    GridBagConstraints treeConstraints = new GridBagConstraints();
    treeConstraints.fill = GridBagConstraints.BOTH;
    treeConstraints.gridheight = 1;
    treeConstraints.gridwidth = 1;
    treeConstraints.gridx = 0;
    treeConstraints.gridy = 0;
    treeConstraints.weightx = 0.20;
    treeConstraints.weighty = 1.0;
    treeConstraints.anchor = GridBagConstraints.FIRST_LINE_START;
    this.add(new JScrollPane(tree), treeConstraints);

    // the list of components (bottom left)
    EntryPointsView entrypoints = new EntryPointsView(model);
    model.addPropertyChangeListener(entrypoints);

    JScrollPane entryPointsScroller = new JScrollPane(entrypoints);
    GridBagConstraints entrypointConstraints = new GridBagConstraints();
    entrypointConstraints.anchor = GridBagConstraints.FIRST_LINE_START;
    entrypointConstraints.fill = GridBagConstraints.BOTH;
    entrypointConstraints.gridheight = 1;
    entrypointConstraints.gridwidth = 1;
    entrypointConstraints.gridx = 0;
    entrypointConstraints.gridy = 1;
    entrypointConstraints.weightx = 0.15;
    entrypointConstraints.weighty = 1.0;

    this.add(entryPointsScroller, entrypointConstraints);

    // the editor (contains the textview and the list of methods)
    this.editor = new EditorView(model, this);
    this.model.addPropertyChangeListener(this.editor);

    GridBagConstraints editorConstraints = new GridBagConstraints();
    editorConstraints.anchor = GridBagConstraints.NORTHWEST;
    editorConstraints.fill = GridBagConstraints.BOTH;
    editorConstraints.gridheight = 2;
    editorConstraints.gridwidth = 1;
    editorConstraints.gridx = 1;
    editorConstraints.gridy = 0;
    editorConstraints.weightx = 0.70;
    editorConstraints.weighty = 1.0;
    this.add(editor, editorConstraints);

    this.outlineTree = new OutlineView(this.model);
    model.addPropertyChangeListener("currentClass", outlineTree);

    GridBagConstraints outlineConstraints = new GridBagConstraints();
    outlineConstraints.anchor = GridBagConstraints.NORTHWEST;
    outlineConstraints.fill = GridBagConstraints.BOTH;
    outlineConstraints.gridwidth = 1;
    outlineConstraints.gridheight = 2;
    outlineConstraints.gridx = 2;
    outlineConstraints.gridy = 0;
    outlineConstraints.weightx = 0.15;
    outlineConstraints.weighty = 1.0;
    this.add(outlineTree, outlineConstraints);

    String shortpath = model.getCurrentFile().getAbsolutePath()
            .replace(app.getApplicationDirectory().getAbsolutePath(), "");
    this.setTitle("Editor - " + shortpath);
    searchNode(shortpath, null);
}