Example usage for javax.swing SwingConstants CENTER

List of usage examples for javax.swing SwingConstants CENTER

Introduction

In this page you can find the example usage for javax.swing SwingConstants CENTER.

Prototype

int CENTER

To view the source code for javax.swing SwingConstants CENTER.

Click Source Link

Document

The central position in an area.

Usage

From source file:gda.gui.BatonPanel.java

private void initGUI() {
    try {//  www.j  a  v  a  2s  . co  m
        {
            BorderLayout thisLayout = new BorderLayout();
            this.setLayout(thisLayout);
            this.setPreferredSize(new java.awt.Dimension(902, 431));
        }
        {
            JPanel jPanel1 = new JPanel();
            this.add(jPanel1, BorderLayout.WEST);
            this.add(getPnlMessages(), BorderLayout.CENTER);
            jPanel1.setLayout(null);
            jPanel1.setPreferredSize(new java.awt.Dimension(480, 419));
            {
                sudoPanel = new JPanel();
                BorderLayout sudoPanelLayout = new BorderLayout();
                sudoPanel.setLayout(sudoPanelLayout);
                jPanel1.add(sudoPanel);
                sudoPanel.add(getPnlSudoButtons(), BorderLayout.CENTER);
                sudoPanel.add(getPnlSUMessage(), BorderLayout.NORTH);
                sudoPanel.setBorder(BorderFactory.createTitledBorder("Switch User"));
                sudoPanel.setBounds(12, 340, 456, 80);
            }
            {
                otherClientPanel = new JPanel();
                jPanel1.add(otherClientPanel);
                otherClientPanel.setBorder(BorderFactory.createTitledBorder("Clients on this beamline"));
                otherClientPanel.setBounds(12, 15, 456, 215);
                otherClientPanel.setLayout(null);
                {
                    lblUser = new JLabel();
                    otherClientPanel.add(lblUser);
                    lblUser.setText("You are logged in as: abc123");
                    lblUser.setBounds(15, 36, 422, 14);
                    lblUser.setHorizontalAlignment(SwingConstants.CENTER);
                    lblUser.setHorizontalTextPosition(SwingConstants.CENTER);
                }
                {
                    lblBaton = new JLabel();
                    otherClientPanel.add(lblBaton);
                    lblBaton.setText("You hold the baton and have control of the beamline");
                    lblBaton.setBounds(15, 66, 422, 14);
                    lblBaton.setHorizontalTextPosition(SwingConstants.CENTER);
                    lblBaton.setInheritsPopupMenu(false);
                    lblBaton.setHorizontalAlignment(SwingConstants.CENTER);
                }
                {
                    JScrollPane jScrollPane1 = new JScrollPane();
                    otherClientPanel.add(jScrollPane1);
                    jScrollPane1.setBounds(73, 96, 306, 97);
                    {
                        userClients = new JTable();
                        jScrollPane1.setViewportView(userClients);
                        userClients.setModel(this.new BatonTableModel());
                        userClients.setAutoCreateRowSorter(true);
                        userClients.setPreferredSize(new java.awt.Dimension(213, 97));
                        userClients.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
                        userClients.setColumnSelectionAllowed(false);
                        userClients.getSelectionModel().addListSelectionListener(this);

                        DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
                        renderer.setHorizontalAlignment(SwingConstants.CENTER);
                        userClients.getColumnModel().getColumn(0).setCellRenderer(renderer);
                        userClients.getColumnModel().getColumn(1).setCellRenderer(renderer);
                        userClients.getColumnModel().getColumn(2).setCellRenderer(renderer);

                        JTableHeader th = userClients.getTableHeader();
                        th.addMouseListener(this);

                    }
                }
            }
            {
                buttonsPanel = new JPanel();
                BorderLayout buttonsPanelLayout = new BorderLayout();
                buttonsPanel.setLayout(buttonsPanelLayout);
                jPanel1.add(buttonsPanel);
                buttonsPanel.setBorder(BorderFactory.createTitledBorder("Baton control"));
                buttonsPanel.setBounds(12, 242, 456, 92);
                buttonsPanel.add(getPnlControlButton(), BorderLayout.CENTER);
                buttonsPanel.add(getPnlTickBox(), BorderLayout.SOUTH);
            }
        }
    } catch (Exception e) {
        logger.error(e.getMessage(), e);
    }
}

From source file:de.cismet.cids.custom.objecteditors.wunda_blau.WebDavPicturePanel.java

/**
 * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The
 * content of this method is always regenerated by the Form Editor.
 *//* w w  w .j a va 2  s  .  c  om*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    GridBagConstraints gridBagConstraints;
    bindingGroup = new BindingGroup();

    final RoundedPanel pnlFotos = new RoundedPanel();
    final SemiRoundedPanel pnlHeaderFotos = new SemiRoundedPanel();
    final JLabel lblHeaderFotos = new JLabel();
    final JPanel jPanel2 = new JPanel();
    final JPanel jPanel1 = new JPanel();
    final JScrollPane jspFotoList = new JScrollPane();
    lstFotos = new JList();
    final JPanel pnlCtrlButtons = new JPanel();
    btnAddImg = new JButton();
    btnRemoveImg = new JButton();
    final JPanel pnlMap = new JPanel();
    final RoundedPanel pnlVorschau = new RoundedPanel();
    final SemiRoundedPanel semiRoundedPanel2 = new SemiRoundedPanel();
    final JLabel lblVorschau = new JLabel();
    final JPanel jPanel3 = new JPanel();
    pnlFoto = new JPanel();
    lblPicture = new JLabel();
    lblBusy = new JXBusyLabel(new Dimension(75, 75));
    final JPanel pnlCtrlBtn = new JPanel();
    btnPrevImg = new JButton();
    btnNextImg = new JButton();

    final FormListener formListener = new FormListener();

    setName("Form"); // NOI18N
    setOpaque(false);
    setLayout(new GridBagLayout());

    pnlFotos.setMinimumSize(new Dimension(400, 200));
    pnlFotos.setName("pnlFotos"); // NOI18N
    pnlFotos.setPreferredSize(new Dimension(400, 200));
    pnlFotos.setLayout(new GridBagLayout());

    pnlHeaderFotos.setBackground(new Color(51, 51, 51));
    pnlHeaderFotos.setForeground(new Color(51, 51, 51));
    pnlHeaderFotos.setName("pnlHeaderFotos"); // NOI18N
    pnlHeaderFotos.setLayout(new FlowLayout());

    lblHeaderFotos.setForeground(new Color(255, 255, 255));
    Mnemonics.setLocalizedText(lblHeaderFotos,
            NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.lblHeaderFotos.text")); // NOI18N
    lblHeaderFotos.setName("lblHeaderFotos"); // NOI18N
    pnlHeaderFotos.add(lblHeaderFotos);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    pnlFotos.add(pnlHeaderFotos, gridBagConstraints);

    jPanel2.setName("jPanel2"); // NOI18N
    jPanel2.setOpaque(false);
    jPanel2.setLayout(new GridBagLayout());

    jPanel1.setName("jPanel1"); // NOI18N
    jPanel1.setOpaque(false);
    jPanel1.setLayout(new GridBagLayout());

    jspFotoList.setMinimumSize(new Dimension(250, 130));
    jspFotoList.setName("jspFotoList"); // NOI18N

    lstFotos.setMinimumSize(new Dimension(250, 130));
    lstFotos.setName("lstFotos"); // NOI18N
    lstFotos.setPreferredSize(new Dimension(250, 130));

    final ELProperty eLProperty = ELProperty.create("${cidsBean." + beanCollProp + "}");
    final JListBinding jListBinding = SwingBindings.createJListBinding(AutoBinding.UpdateStrategy.READ_WRITE,
            this, eLProperty, lstFotos);
    bindingGroup.addBinding(jListBinding);

    lstFotos.addListSelectionListener(formListener);
    jspFotoList.setViewportView(lstFotos);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel1.add(jspFotoList, gridBagConstraints);

    pnlCtrlButtons.setName("pnlCtrlButtons"); // NOI18N
    pnlCtrlButtons.setOpaque(false);
    pnlCtrlButtons.setLayout(new GridBagLayout());

    btnAddImg.setIcon(new ImageIcon(
            getClass().getResource("/de/cismet/cids/custom/objecteditors/wunda_blau/edit_add_mini.png"))); // NOI18N
    Mnemonics.setLocalizedText(btnAddImg,
            NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.btnAddImg.text")); // NOI18N
    btnAddImg.setBorderPainted(false);
    btnAddImg.setContentAreaFilled(false);
    btnAddImg.setName("btnAddImg"); // NOI18N
    btnAddImg.addActionListener(formListener);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.insets = new Insets(0, 0, 5, 0);
    pnlCtrlButtons.add(btnAddImg, gridBagConstraints);

    btnRemoveImg.setIcon(new ImageIcon(
            getClass().getResource("/de/cismet/cids/custom/objecteditors/wunda_blau/edit_remove_mini.png"))); // NOI18N
    Mnemonics.setLocalizedText(btnRemoveImg,
            NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.btnRemoveImg.text")); // NOI18N
    btnRemoveImg.setBorderPainted(false);
    btnRemoveImg.setContentAreaFilled(false);
    btnRemoveImg.setName("btnRemoveImg"); // NOI18N
    btnRemoveImg.addActionListener(formListener);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridy = 1;
    gridBagConstraints.insets = new Insets(5, 0, 0, 0);
    pnlCtrlButtons.add(btnRemoveImg, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.anchor = GridBagConstraints.NORTH;
    gridBagConstraints.insets = new Insets(0, 5, 0, 0);
    jPanel1.add(pnlCtrlButtons, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new Insets(10, 10, 10, 0);
    jPanel2.add(jPanel1, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new Insets(0, 0, 2, 0);
    pnlFotos.add(jPanel2, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.anchor = GridBagConstraints.NORTH;
    gridBagConstraints.insets = new Insets(0, 0, 5, 5);
    add(pnlFotos, gridBagConstraints);

    pnlMap.setBorder(BorderFactory.createEtchedBorder());
    pnlMap.setMinimumSize(new Dimension(400, 200));
    pnlMap.setName("pnlMap"); // NOI18N
    pnlMap.setPreferredSize(new Dimension(400, 200));
    pnlMap.setLayout(new BorderLayout());
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = GridBagConstraints.VERTICAL;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new Insets(5, 0, 0, 5);
    add(pnlMap, gridBagConstraints);
    pnlMap.add(map, BorderLayout.CENTER);

    pnlVorschau.setName("pnlVorschau"); // NOI18N
    pnlVorschau.setLayout(new GridBagLayout());

    semiRoundedPanel2.setBackground(new Color(51, 51, 51));
    semiRoundedPanel2.setName("semiRoundedPanel2"); // NOI18N
    semiRoundedPanel2.setLayout(new FlowLayout());

    lblVorschau.setForeground(new Color(255, 255, 255));
    Mnemonics.setLocalizedText(lblVorschau,
            NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.lblVorschau.text")); // NOI18N
    lblVorschau.setName("lblVorschau"); // NOI18N
    semiRoundedPanel2.add(lblVorschau);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    pnlVorschau.add(semiRoundedPanel2, gridBagConstraints);

    jPanel3.setName("jPanel3"); // NOI18N
    jPanel3.setOpaque(false);
    jPanel3.setLayout(new GridBagLayout());

    pnlFoto.setName("pnlFoto"); // NOI18N
    pnlFoto.setOpaque(false);
    pnlFoto.setLayout(new GridBagLayout());

    lblPicture.setHorizontalAlignment(SwingConstants.CENTER);
    Mnemonics.setLocalizedText(lblPicture,
            NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.lblPicture.text")); // NOI18N
    lblPicture.setName("lblPicture"); // NOI18N
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    pnlFoto.add(lblPicture, gridBagConstraints);

    lblBusy.setHorizontalAlignment(SwingConstants.CENTER);
    lblBusy.setMaximumSize(new Dimension(140, 40));
    lblBusy.setMinimumSize(new Dimension(140, 60));
    lblBusy.setName("lblBusy"); // NOI18N
    lblBusy.setPreferredSize(new Dimension(140, 60));
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    pnlFoto.add(lblBusy, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new Insets(10, 10, 0, 10);
    jPanel3.add(pnlFoto, gridBagConstraints);

    pnlCtrlBtn.setName("pnlCtrlBtn"); // NOI18N
    pnlCtrlBtn.setOpaque(false);
    pnlCtrlBtn.setPreferredSize(new Dimension(100, 50));
    pnlCtrlBtn.setLayout(new GridBagLayout());

    btnPrevImg.setIcon(new ImageIcon(getClass().getResource("/res/arrow-left.png"))); // NOI18N
    Mnemonics.setLocalizedText(btnPrevImg,
            NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.btnPrevImg.text")); // NOI18N
    btnPrevImg.setBorderPainted(false);
    btnPrevImg.setFocusPainted(false);
    btnPrevImg.setName("btnPrevImg"); // NOI18N
    btnPrevImg.addActionListener(formListener);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    pnlCtrlBtn.add(btnPrevImg, gridBagConstraints);

    btnNextImg.setIcon(new ImageIcon(getClass().getResource("/res/arrow-right.png"))); // NOI18N
    Mnemonics.setLocalizedText(btnNextImg,
            NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.btnNextImg.text")); // NOI18N
    btnNextImg.setBorderPainted(false);
    btnNextImg.setFocusPainted(false);
    btnNextImg.setName("btnNextImg"); // NOI18N
    btnNextImg.addActionListener(formListener);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    pnlCtrlBtn.add(btnNextImg, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.insets = new Insets(0, 10, 10, 10);
    jPanel3.add(pnlCtrlBtn, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    pnlVorschau.add(jPanel3, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new Insets(0, 5, 0, 0);
    add(pnlVorschau, gridBagConstraints);

    bindingGroup.bind();
}

From source file:net.sourceforge.processdash.ui.lib.chart.StandardDiscItemRenderer.java

protected void drawDiscLabel(Graphics2D g2, Ellipse2D shape, Paint labelPaint, Font labelFont, String label) {
    g2.setFont(labelFont);/*from  w w w.java 2 s  . c  om*/
    g2.setPaint(labelPaint);
    FontMetrics m = g2.getFontMetrics();
    int height = m.getAscent();
    double halfHeight = height / 2.0;

    double radius = shape.getWidth() / 2;
    double availableRadius = radius - getLabelPadding();
    double halfWidth = Math.sqrt(availableRadius * availableRadius - halfHeight * halfHeight);

    int width = (int) Math.floor(halfWidth * 2 + 0.99);

    Rectangle viewR = new Rectangle(width, height);
    Rectangle iconR = new Rectangle();
    Rectangle textR = new Rectangle();
    String text = SwingUtilities.layoutCompoundLabel(m, label, null, SwingConstants.CENTER,
            SwingConstants.CENTER, SwingConstants.CENTER, SwingConstants.TRAILING, viewR, iconR, textR, 0);
    if (text.equals(label) || text.length() >= 3 + minLabelChars) {
        double x = shape.getCenterX() - halfWidth + textR.x;
        double y = shape.getCenterY() + halfHeight + textR.y;
        g2.drawString(text, (float) x, (float) y);
    }
}

From source file:frames.consulta.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.//w w  w. j  av a2s  .  co m
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    grupoconsulta = new javax.swing.ButtonGroup();
    jPopupMenu1 = new javax.swing.JPopupMenu();
    mnModificar = new javax.swing.JMenuItem();
    mnVer = new javax.swing.JMenuItem();
    jPanel1 = new javax.swing.JPanel();
    jPanel2 = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    txtbuscar = new javax.swing.JTextField();
    btnbuscar = new javax.swing.JButton();
    jPanel3 = new javax.swing.JPanel();
    jScrollPane2 = new javax.swing.JScrollPane();
    tblconsulta = new javax.swing.JTable();
    cedula = new javax.swing.JRadioButton();
    apellido = new javax.swing.JRadioButton();
    jButton1 = new javax.swing.JButton();
    jLabel3 = new javax.swing.JLabel();
    jPanel4 = new javax.swing.JPanel();
    btnModificar = new javax.swing.JButton();
    btnver = new javax.swing.JButton();
    jLabel2 = new javax.swing.JLabel();
    jButton3 = new javax.swing.JButton();
    btneliminar = new javax.swing.JButton();
    jMenuBar1 = new javax.swing.JMenuBar();
    jMenu1 = new javax.swing.JMenu();
    jMenuItem1 = new javax.swing.JMenuItem();

    mnModificar.setText("Modificar");
    mnModificar.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnModificarActionPerformed(evt);
        }
    });
    jPopupMenu1.add(mnModificar);

    mnVer.setText("ver");
    mnVer.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnVerActionPerformed(evt);
        }
    });
    jPopupMenu1.add(mnVer);

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

    jPanel1.setBackground(new java.awt.Color(30, 51, 125));

    jPanel2.setBackground(new java.awt.Color(78, 131, 173));
    jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Consulta",
            javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
            javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11),
            new java.awt.Color(247, 237, 237))); // NOI18N
    jPanel2.setForeground(new java.awt.Color(245, 231, 231));

    jLabel1.setFont(new java.awt.Font("DejaVu Sans", 1, 14)); // NOI18N
    jLabel1.setForeground(new java.awt.Color(254, 238, 238));
    jLabel1.setText("Buscar");

    btnbuscar.setForeground(new java.awt.Color(254, 254, 254));
    btnbuscar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Search2.png"))); // NOI18N
    btnbuscar.setText("Buscar");
    btnbuscar.setContentAreaFilled(false);
    btnbuscar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
    btnbuscar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnbuscar.setIconTextGap(-5);
    btnbuscar.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
    btnbuscar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    btnbuscar.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnbuscarActionPerformed(evt);
        }
    });

    jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Lista de Pacientes"));

    tblconsulta
            .setModel(new javax.swing.table.DefaultTableModel(new Object[][] { {}, {}, {}, {} }, new String[] {

    }));
    tblconsulta.setComponentPopupMenu(jPopupMenu1);
    jScrollPane2.setViewportView(tblconsulta);

    javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
    jPanel3.setLayout(jPanel3Layout);
    jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel3Layout
                    .createSequentialGroup().addContainerGap().addComponent(jScrollPane2).addContainerGap()));
    jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                    jPanel3Layout
                            .createSequentialGroup().addComponent(jScrollPane2,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, 530, Short.MAX_VALUE)
                            .addContainerGap()));

    cedula.setBackground(new java.awt.Color(254, 254, 254));
    grupoconsulta.add(cedula);
    cedula.setFont(new java.awt.Font("DejaVu Sans", 1, 14)); // NOI18N
    cedula.setForeground(new java.awt.Color(244, 236, 236));
    cedula.setText("Cdula");

    grupoconsulta.add(apellido);
    apellido.setFont(new java.awt.Font("DejaVu Sans", 1, 13)); // NOI18N
    apellido.setForeground(new java.awt.Color(248, 236, 236));
    apellido.setText("Apellido");

    jButton1.setForeground(new java.awt.Color(253, 251, 251));
    jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/consulgene.png"))); // NOI18N
    jButton1.setText("General");
    jButton1.setContentAreaFilled(false);
    jButton1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
    jButton1.setDoubleBuffered(true);
    jButton1.setFocusCycleRoot(true);
    jButton1.setFocusable(false);
    jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    jButton1.setIconTextGap(-5);
    jButton1.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
    jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    jButton1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton1ActionPerformed(evt);
        }
    });

    jLabel3.setFont(new java.awt.Font("DejaVu Sans", 0, 18)); // NOI18N
    jLabel3.setForeground(new java.awt.Color(254, 254, 254));
    jLabel3.setText("Tipo de Bsqueda");

    javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout.setHorizontalGroup(jPanel2Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap().addGroup(jPanel2Layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                            Short.MAX_VALUE)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                            .addGroup(jPanel2Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(jPanel2Layout.createSequentialGroup()
                                            .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 54,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(txtbuscar, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    437, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(jPanel2Layout.createSequentialGroup()
                                            .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addGap(40, 40, 40).addComponent(cedula).addGap(58, 58, 58)
                                            .addComponent(apellido).addGap(133, 133, 133)))
                            .addComponent(btnbuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 103,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 103,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(0, 0, Short.MAX_VALUE)))
                    .addContainerGap()));
    jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup().addGroup(jPanel2Layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap()
                            .addGroup(jPanel2Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addGroup(jPanel2Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(apellido).addComponent(cedula)))
                            .addGap(37, 37, 37)
                            .addGroup(jPanel2Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(txtbuscar, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 36,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(38, 38, 38))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                            jPanel2Layout.createSequentialGroup().addGap(32, 32, 32).addGroup(jPanel2Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 94,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(btnbuscar)).addGap(18, 18, 18)))
                    .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(62, 62, 62)));

    jPanel4.setBackground(new java.awt.Color(234, 239, 242));

    btnModificar
            .setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/1466449409_Application.png"))); // NOI18N
    btnModificar.setText("Modificar ");
    btnModificar.setContentAreaFilled(false);
    btnModificar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
    btnModificar.setDoubleBuffered(true);
    btnModificar.setFocusCycleRoot(true);
    btnModificar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnModificar.setIconTextGap(-1);
    btnModificar.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
    btnModificar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    btnModificar.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnModificarActionPerformed(evt);
        }
    });

    btnver.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/1466449365_PatientData.png"))); // NOI18N
    btnver.setText("Ver Historia");
    btnver.setContentAreaFilled(false);
    btnver.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
    btnver.setDoubleBuffered(true);
    btnver.setFocusCycleRoot(true);
    btnver.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnver.setIconTextGap(-10);
    btnver.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
    btnver.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    btnver.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnverActionPerformed(evt);
        }
    });

    jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/cropped-happy_tooth3.jpg"))); // NOI18N

    jButton3.setIcon(new javax.swing.ImageIcon(
            getClass().getResource("/images/1466451542_delete_unapprove_discard_remove_x_red.png"))); // NOI18N
    jButton3.setText("Salir");
    jButton3.setContentAreaFilled(false);
    jButton3.setDoubleBuffered(true);
    jButton3.setFocusCycleRoot(true);
    jButton3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    jButton3.setIconTextGap(5);
    jButton3.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
    jButton3.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    jButton3.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton3ActionPerformed(evt);
        }
    });

    btneliminar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/1466454184_free-27.png"))); // NOI18N
    btneliminar.setText("Eliminar");
    btneliminar.setContentAreaFilled(false);
    btneliminar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
    btneliminar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btneliminar.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
    btneliminar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    btneliminar.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btneliminarActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
    jPanel4.setLayout(jPanel4Layout);
    jPanel4Layout.setHorizontalGroup(jPanel4Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup().addGroup(jPanel4Layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnver, javax.swing.GroupLayout.Alignment.TRAILING,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                            Short.MAX_VALUE)
                    .addGroup(jPanel4Layout.createSequentialGroup().addContainerGap().addGroup(jPanel4Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jButton3, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                            .addGroup(jPanel4Layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE)
                                    .addGroup(jPanel4Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                                    false)
                                            .addComponent(btnModificar,
                                                    javax.swing.GroupLayout.Alignment.TRAILING,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 172,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(btneliminar, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                    .addContainerGap()));
    jPanel4Layout
            .setVerticalGroup(
                    jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                    jPanel4Layout.createSequentialGroup()
                                            .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 199,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(29, 29, 29)
                                            .addComponent(btnModificar, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    139, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(18, 18, 18)
                                            .addComponent(btnver, javax.swing.GroupLayout.PREFERRED_SIZE, 125,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(18, 18, 18).addComponent(btneliminar).addGap(18, 18, 18)
                                            .addComponent(jButton3).addContainerGap(59, Short.MAX_VALUE)));

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(jPanel1Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup().addGap(30, 30, 30)
                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    jPanel1Layout
            .setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap()
                            .addGroup(jPanel1Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addContainerGap(24, Short.MAX_VALUE)));

    jMenu1.setText("Reportes");

    jMenuItem1.setText("Reportes de Pacientes");
    jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem1ActionPerformed(evt);
        }
    });
    jMenu1.add(jMenuItem1);

    jMenuBar1.add(jMenu1);

    setJMenuBar(jMenuBar1);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                    javax.swing.GroupLayout.PREFERRED_SIZE));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(
            jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
            javax.swing.GroupLayout.PREFERRED_SIZE));

    pack();
}

From source file:net.java.sip.communicator.gui.AuthenticationSplash.java

/**
 * The user has selected an option. Here we close and dispose the dialog.
 * If actionCommand is an ActionEvent, getCommandString() is called,
 * otherwise toString() is used to get the action command.
 *
 * @param actionCommand may be null// w  ww  .  jav a 2  s .  co m
 */
private void registrationComponents() {
    Container contents = getContentPane();
    contents.setLayout(new BorderLayout());

    String title = Utils.getProperty("net.java.sip.communicator.gui.REG_WIN_TITLE");

    if (title == null)
        title = "Registration Manager";

    setTitle(title);
    setResizable(false);
    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent event) {
            registrationDialogDone(CMD_CANCEL);
        }
    });

    // Accessibility -- all frames, dialogs, and applets should
    // have a description
    getAccessibleContext().setAccessibleDescription("Registration Splash");

    String authPromptLabelValue = Utils.getProperty("net.java.sip.communicator.gui.REGISTRATION_PROMPT");

    if (authPromptLabelValue == null)
        authPromptLabelValue = "Please fill in the following fields to register:";

    JLabel splashLabel = new JLabel(authPromptLabelValue);
    splashLabel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    splashLabel.setHorizontalAlignment(SwingConstants.CENTER);
    splashLabel.setHorizontalTextPosition(SwingConstants.CENTER);
    contents.add(splashLabel, BorderLayout.NORTH);

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

    /* My additions */
    nameTextField = new JTextField(); //needed below

    // name label
    nameLabel = new JLabel();
    nameLabel.setLabelFor(nameTextField);
    String nLabelStr = PropertiesDepot.getProperty("net.java.sip.communicator.gui.NAME_LABEL");

    if (nLabelStr == null)
        nLabelStr = "Name";

    nameLabel.setText(nLabelStr);

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

    centerPane.add(nameLabel, c);

    // name text
    c = new GridBagConstraints();
    c.gridx = 1;
    c.gridy = gridy++;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    c.insets = new Insets(11, 7, 0, 11);
    centerPane.add(nameTextField, c);

    lastNameTextField = new JTextField(); //needed below

    // last name label
    lastNameLabel = new JLabel();
    lastNameLabel.setLabelFor(nameTextField);
    String lnLabelStr = PropertiesDepot.getProperty("net.java.sip.communicator.gui.LAST_NAME_LABEL");

    if (lnLabelStr == null)
        lnLabelStr = "Last Name";

    lastNameLabel.setText(lnLabelStr);

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

    centerPane.add(lastNameLabel, c);

    // last name text
    c = new GridBagConstraints();
    c.gridx = 1;
    c.gridy = gridy++;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    c.insets = new Insets(11, 7, 0, 11);
    centerPane.add(lastNameTextField, c);

    mailTextField = new JTextField(); //needed below

    // mail label
    mailLabel = new JLabel();
    mailLabel.setLabelFor(mailTextField);
    String mLabelStr = PropertiesDepot.getProperty("net.java.sip.communicator.gui.MAIL_LABEL");

    if (mLabelStr == null)
        mLabelStr = "Email";

    mailLabel.setText(mLabelStr);

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

    centerPane.add(mailLabel, c);

    // mail text
    c = new GridBagConstraints();
    c.gridx = 1;
    c.gridy = gridy++;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    c.insets = new Insets(11, 7, 0, 11);
    centerPane.add(mailTextField, c);
    /* END: MY additions */

    userNameTextField = new JTextField(); // needed below

    // user name label
    userNameLabel = new JLabel();
    userNameLabel.setLabelFor(userNameTextField);
    String userNameLabelValue = Utils.getProperty("net.java.sip.communicator.gui.USER_NAME_LABEL");

    if (userNameLabelValue == null)
        userNameLabelValue = "Username";

    userNameLabel.setText(userNameLabelValue);
    c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = gridy;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(12, 12, 0, 0);
    centerPane.add(userNameLabel, c);

    // user name text
    c = new GridBagConstraints();
    c.gridx = 1;
    c.gridy = gridy++;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    c.insets = new Insets(12, 7, 0, 11);
    centerPane.add(userNameTextField, c);

    passwordTextField = new JPasswordField(); //needed below

    // password label
    passwordLabel = new JLabel();
    passwordLabel.setLabelFor(passwordTextField);
    String pLabelStr = PropertiesDepot.getProperty("net.java.sip.communicator.gui.PASSWORD_LABEL");

    if (pLabelStr == null)
        pLabelStr = "Password";

    passwordLabel.setText(pLabelStr);
    c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = gridy;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(11, 12, 0, 0);

    centerPane.add(passwordLabel, c);

    // password text
    passwordTextField.setEchoChar('\u2022');
    c = new GridBagConstraints();
    c.gridx = 1;
    c.gridy = gridy++;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    c.insets = new Insets(11, 7, 0, 11);
    centerPane.add(passwordTextField, c);

    policyDropDown = new JComboBox();
    policyDropDown.addItem("Basic");
    policyDropDown.addItem("Pro");
    policyDropDown.addItem("Enterprise");

    // policy label
    policyLabel = new JLabel();
    policyLabel.setLabelFor(policyDropDown);
    String plcLabelStr = PropertiesDepot.getProperty("net.java.sip.communicator.gui.POLICY_LABEL");

    if (plcLabelStr == null)
        plcLabelStr = "Policy";

    policyLabel.setText(plcLabelStr);
    c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = gridy;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(11, 12, 0, 0);
    centerPane.add(policyLabel, c);

    // policy menu
    c = new GridBagConstraints();
    c.gridx = 1;
    c.gridy = gridy++;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    c.insets = new Insets(11, 7, 0, 11);
    centerPane.add(policyDropDown, c);

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, 0));

    registerButton = new JButton();
    registerButton.setMnemonic('G');
    registerButton.setText("Register");
    registerButton.setActionCommand(CMD_REGISTER);
    registerButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            registrationDialogDone(event);
        }
    });
    buttonPanel.add(registerButton);

    buttonPanel.add(Box.createRigidArea(new Dimension(5, 0)));

    cancelButton = new JButton();
    cancelButton.setText("Cancel");
    cancelButton.setActionCommand(CMD_CANCEL);
    cancelButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            registrationDialogDone(event);
        }
    });
    buttonPanel.add(cancelButton);

    c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 6;
    c.gridwidth = 2;
    c.insets = new Insets(11, 12, 11, 11);

    centerPane.add(buttonPanel, c);

    contents.add(centerPane, BorderLayout.CENTER);
    getRootPane().setDefaultButton(registerButton);
    registrationEqualizeButtonSizes();

    setFocusTraversalPolicy(new FocusTraversalPol());

}

From source file:gui.MainGUI.java

private void initComponents() {

    panelExploration = new javax.swing.JPanel();
    scrollPaneImage = new javax.swing.JScrollPane();
    labelImageHolder = new javax.swing.JLabel();
    buttonStart = new javax.swing.JButton();
    toggleHierarchy = new javax.swing.JToggleButton();
    toggleEnv = new javax.swing.JToggleButton();
    buttonStep = new javax.swing.JButton();
    buttonStop = new javax.swing.JButton();
    labelCycleUpdate = new javax.swing.JLabel();
    labelCycle = new javax.swing.JLabel();
    labelExploredUpdate = new javax.swing.JLabel();
    labelExplored = new javax.swing.JLabel();
    buttonData = new javax.swing.JButton();
    labelSpeed = new javax.swing.JLabel();
    sliderSpeed = new javax.swing.JSlider();
    scrollPaneRobots = new javax.swing.JScrollPane();
    panelRobotInfo = new javax.swing.JPanel();
    labelAvgCycle = new javax.swing.JLabel();
    labelAvgCycleUpdate = new javax.swing.JLabel();
    MainMenu1 = new javax.swing.JMenuBar();
    menuExploration1 = new javax.swing.JMenu();
    menuCommunication1 = new javax.swing.JMenu();
    menuEnvironment1 = new javax.swing.JMenu();
    menuRobots1 = new javax.swing.JMenu();
    menuLogs1 = new javax.swing.JMenu();

    setTitle("Multi-robot Exploration Simulator (MRESim) v2.0");
    setName("OuterFrame"); // NOI18N
    setResizable(false);//from w w w .ja va  2 s.c  o m

    panelExploration.setMaximumSize(new java.awt.Dimension(800, 600));
    panelExploration.setMinimumSize(new java.awt.Dimension(800, 600));
    panelExploration.setRequestFocusEnabled(false);

    labelImageHolder.setBackground(new java.awt.Color(255, 255, 102));
    labelImageHolder.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    labelImageHolder.setMaximumSize(new java.awt.Dimension(800, 600));
    labelImageHolder.setMinimumSize(new java.awt.Dimension(800, 600));
    labelImageHolder.setPreferredSize(new java.awt.Dimension(800, 600));
    scrollPaneImage.setViewportView(labelImageHolder);

    javax.swing.GroupLayout panelExplorationLayout = new javax.swing.GroupLayout(panelExploration);
    panelExploration.setLayout(panelExplorationLayout);
    panelExplorationLayout.setHorizontalGroup(
            panelExplorationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(
                    scrollPaneImage, javax.swing.GroupLayout.PREFERRED_SIZE,
                    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE));
    panelExplorationLayout.setVerticalGroup(
            panelExplorationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(
                    scrollPaneImage, javax.swing.GroupLayout.PREFERRED_SIZE,
                    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE));

    buttonStart.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    buttonStart.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/buttonPlay.png"))); // NOI18N
    buttonStart.setToolTipText("Start simulation");
    buttonStart.setBorderPainted(false);
    buttonStart.setContentAreaFilled(false);
    buttonStart.setIconTextGap(0);
    buttonStart.setMaximumSize(new java.awt.Dimension(36, 36));
    buttonStart.setMinimumSize(new java.awt.Dimension(36, 36));
    buttonStart.setPreferredSize(new java.awt.Dimension(36, 36));
    buttonStart.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonStartActionPerformed(evt);
        }
    });

    toggleHierarchy
            .setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/buttonHierarchy.png"))); // NOI18N
    toggleHierarchy.setSelected(true);
    toggleHierarchy.setToolTipText("Toggle hierarchy");
    toggleHierarchy.setBorderPainted(false);
    toggleHierarchy.setContentAreaFilled(false);
    toggleHierarchy.setMaximumSize(new java.awt.Dimension(36, 36));
    toggleHierarchy.setMinimumSize(new java.awt.Dimension(36, 36));
    toggleHierarchy.setPreferredSize(new java.awt.Dimension(36, 36));
    toggleHierarchy.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            toggleHierarchyActionPerformed(evt);
        }
    });

    toggleEnv.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/buttonEnvironment.png"))); // NOI18N
    toggleEnv.setSelected(true);
    toggleEnv.setToolTipText("Toggle environment");
    toggleEnv.setBorderPainted(false);
    toggleEnv.setContentAreaFilled(false);
    toggleEnv.setMaximumSize(new java.awt.Dimension(36, 36));
    toggleEnv.setMinimumSize(new java.awt.Dimension(36, 36));
    toggleEnv.setPreferredSize(new java.awt.Dimension(36, 36));
    toggleEnv.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            toggleEnvActionPerformed(evt);
        }
    });

    buttonStep.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    buttonStep.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/buttonStep.png"))); // NOI18N
    buttonStep.setToolTipText("Take one step");
    buttonStep.setBorderPainted(false);
    buttonStep.setContentAreaFilled(false);
    buttonStep.setMaximumSize(new java.awt.Dimension(36, 36));
    buttonStep.setMinimumSize(new java.awt.Dimension(36, 36));
    buttonStep.setPreferredSize(new java.awt.Dimension(36, 36));
    buttonStep.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonStepActionPerformed(evt);
        }
    });

    buttonStop.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    buttonStop.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/buttonStop.png"))); // NOI18N
    buttonStop.setToolTipText("Reset simulation");
    buttonStop.setBorderPainted(false);
    buttonStop.setContentAreaFilled(false);
    buttonStop.setMaximumSize(new java.awt.Dimension(36, 36));
    buttonStop.setMinimumSize(new java.awt.Dimension(36, 36));
    buttonStop.setPreferredSize(new java.awt.Dimension(36, 36));
    buttonStop.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonStopActionPerformed(evt);
        }
    });

    labelCycleUpdate.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    labelCycleUpdate.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    labelCycleUpdate.setText("0");

    labelCycle.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    labelCycle.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    labelCycle.setText("Cycle:");

    labelExploredUpdate.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    labelExploredUpdate.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    labelExploredUpdate.setText("0");

    labelExplored.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    labelExplored.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    labelExplored.setText("% Explored:");

    buttonData.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/buttonData.png"))); // NOI18N
    buttonData.setBorderPainted(false);
    buttonData.setContentAreaFilled(false);
    buttonData.setMaximumSize(new java.awt.Dimension(36, 36));
    buttonData.setMinimumSize(new java.awt.Dimension(36, 36));
    buttonData.setPreferredSize(new java.awt.Dimension(36, 36));
    buttonData.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonDataActionPerformed(evt);
        }
    });

    labelSpeed.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    labelSpeed.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    labelSpeed.setText("Speed:");

    sliderSpeed.setMajorTickSpacing(1);
    sliderSpeed.setMaximum(10);
    sliderSpeed.setSnapToTicks(true);
    sliderSpeed.setToolTipText("Simulation speed");
    sliderSpeed.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            sliderSpeedStateChanged(evt);
        }
    });

    scrollPaneRobots.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPaneRobots.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPaneRobots.setMinimumSize(new java.awt.Dimension(21, 22));
    scrollPaneRobots.setPreferredSize(new java.awt.Dimension(0, 0));

    panelRobotInfo.setPreferredSize(new java.awt.Dimension(273, 600));

    javax.swing.GroupLayout panelRobotInfoLayout = new javax.swing.GroupLayout(panelRobotInfo);
    panelRobotInfo.setLayout(panelRobotInfoLayout);
    panelRobotInfoLayout.setHorizontalGroup(panelRobotInfoLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 273, Short.MAX_VALUE));
    panelRobotInfoLayout.setVerticalGroup(panelRobotInfoLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 600, Short.MAX_VALUE));

    scrollPaneRobots.setViewportView(panelRobotInfo);

    labelAvgCycle.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    labelAvgCycle.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    labelAvgCycle.setText("Avg Cycle:");

    labelAvgCycleUpdate.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    labelAvgCycleUpdate.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    labelAvgCycleUpdate.setText("0");

    MainMenu1.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N

    menuExploration1.setText("Exploration");
    menuExploration1.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    menuExploration1.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            menuExplorationMouseClicked(evt);
        }

        public void mouseReleased(java.awt.event.MouseEvent evt) {
            menuExplorationMouseReleased(evt);
        }
    });
    menuExploration1.addMenuDragMouseListener(new javax.swing.event.MenuDragMouseListener() {
        public void menuDragMouseDragged(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseEntered(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseExited(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseReleased(javax.swing.event.MenuDragMouseEvent evt) {
            menuExplorationMenuDragMouseReleased(evt);
        }
    });
    MainMenu1.add(menuExploration1);

    menuCommunication1.setText("Communication");
    menuCommunication1.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    menuCommunication1.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            menuCommunicationMouseClicked(evt);
        }

        public void mouseReleased(java.awt.event.MouseEvent evt) {
            menuCommunicationMouseReleased(evt);
        }
    });
    menuCommunication1.addMenuDragMouseListener(new javax.swing.event.MenuDragMouseListener() {
        public void menuDragMouseDragged(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseEntered(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseExited(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseReleased(javax.swing.event.MenuDragMouseEvent evt) {
            menuCommunicationMenuDragMouseReleased(evt);
        }
    });
    MainMenu1.add(menuCommunication1);

    menuEnvironment1.setText("Environment");
    menuEnvironment1.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    menuEnvironment1.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            menuEnvironmentMouseClicked(evt);
        }

        public void mouseReleased(java.awt.event.MouseEvent evt) {
            menuEnvironmentMouseReleased(evt);
        }
    });
    menuEnvironment1.addMenuDragMouseListener(new javax.swing.event.MenuDragMouseListener() {
        public void menuDragMouseDragged(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseEntered(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseExited(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseReleased(javax.swing.event.MenuDragMouseEvent evt) {
            menuEnvironmentMenuDragMouseReleased(evt);
        }
    });
    MainMenu1.add(menuEnvironment1);

    menuRobots1.setText("Robots");
    menuRobots1.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    menuRobots1.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            menuRobotsMouseClicked(evt);
        }

        public void mouseReleased(java.awt.event.MouseEvent evt) {
            menuRobotsMouseReleased(evt);
        }
    });
    menuRobots1.addMenuDragMouseListener(new javax.swing.event.MenuDragMouseListener() {
        public void menuDragMouseDragged(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseEntered(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseExited(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseReleased(javax.swing.event.MenuDragMouseEvent evt) {
            menuRobotsMenuDragMouseReleased(evt);
        }
    });
    MainMenu1.add(menuRobots1);

    menuLogs1.setText("Logs");
    menuLogs1.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    menuLogs1.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            menuLogsMouseClicked(evt);
        }

        public void mouseReleased(java.awt.event.MouseEvent evt) {
            menuLogsMouseReleased(evt);
        }
    });
    menuLogs1.addMenuDragMouseListener(new javax.swing.event.MenuDragMouseListener() {
        public void menuDragMouseDragged(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseEntered(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseExited(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseReleased(javax.swing.event.MenuDragMouseEvent evt) {
            menuLogsMenuDragMouseReleased(evt);
        }
    });
    MainMenu1.add(menuLogs1);

    setJMenuBar(MainMenu1);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                            .addComponent(panelExploration, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(scrollPaneRobots, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                            .addComponent(labelSpeed, javax.swing.GroupLayout.PREFERRED_SIZE, 44,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(sliderSpeed, javax.swing.GroupLayout.PREFERRED_SIZE, 89,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(164, 164, 164)
                            .addComponent(buttonStart, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(buttonStep, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(buttonStop, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(231, 231, 231)
                            .addGroup(layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(layout.createSequentialGroup().addGroup(layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(labelCycle).addComponent(labelExplored,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 70,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addGroup(layout
                                                    .createParallelGroup(
                                                            javax.swing.GroupLayout.Alignment.TRAILING, false)
                                                    .addComponent(labelExploredUpdate,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE, 36,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(labelCycleUpdate,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE, 36,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE)))
                                    .addGroup(layout.createSequentialGroup()
                                            .addComponent(labelAvgCycle, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    70, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(labelAvgCycleUpdate,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 36,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGap(65, 65, 65)
                            .addComponent(toggleEnv, javax.swing.GroupLayout.PREFERRED_SIZE, 36,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(toggleHierarchy, javax.swing.GroupLayout.PREFERRED_SIZE, 36,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(buttonData, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(46, 89, Short.MAX_VALUE)))
                    .addContainerGap()));
    layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout
                    .createSequentialGroup().addContainerGap().addGroup(layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false).addComponent(
                                    panelExploration, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(scrollPaneRobots, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(
                            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup().addGroup(layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(labelCycleUpdate).addComponent(labelCycle))
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addGroup(layout
                                                    .createParallelGroup(
                                                            javax.swing.GroupLayout.Alignment.BASELINE)
                                                    .addComponent(labelExploredUpdate)
                                                    .addComponent(labelExplored))
                                            .addPreferredGap(
                                                    javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addGroup(layout
                                                    .createParallelGroup(
                                                            javax.swing.GroupLayout.Alignment.BASELINE)
                                                    .addComponent(labelAvgCycleUpdate)
                                                    .addComponent(labelAvgCycle)))
                                    .addGroup(layout.createSequentialGroup().addGroup(layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(layout
                                                    .createParallelGroup(
                                                            javax.swing.GroupLayout.Alignment.TRAILING)
                                                    .addComponent(buttonStop,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(
                                                            buttonStep, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(buttonStart,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addComponent(labelSpeed)
                                            .addComponent(sliderSpeed, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(buttonData, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(toggleHierarchy,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 36,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(toggleEnv, javax.swing.GroupLayout.PREFERRED_SIZE, 36,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addGap(0, 0, Short.MAX_VALUE)))
                    .addContainerGap()));

    pack();
}

From source file:com.titan.mainframe.MainFrame.java

public MainFrame() {
    String osName = System.getProperty("os.name").toLowerCase();
    if (osName.toLowerCase().contains("mac")) {
        com.apple.eawt.Application macApp = com.apple.eawt.Application.getApplication();
        macApp.addApplicationListener(this);
    }/*from w w w. j  a  v  a 2  s .c  o m*/
    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            handleQuit();
        }

        @Override
        public void windowOpened(WindowEvent e) {
            windowOpened = true;
        }
    });
    setTitle("Titan " + Global.version);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    if (TitanSetting.getInstance().width == 0 || TitanSetting.getInstance().height == 0) {
        setBounds(TitanSetting.getInstance().x, TitanSetting.getInstance().y, 1200, 700);
    } else {
        setBounds(TitanSetting.getInstance().x, TitanSetting.getInstance().y, TitanSetting.getInstance().width,
                TitanSetting.getInstance().height);
    }

    setIconImage(new ImageIcon(getClass().getClassLoader().getResource("com/titan/image/titan_icon.png"))
            .getImage());

    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(new BorderLayout(0, 0));
    splitPane.setDividerLocation(TitanSetting.getInstance().mainframeDivX);
    contentPane.add(splitPane, BorderLayout.CENTER);

    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout(0, 0));

    JLabel logoLabel = new JLabel();
    logoLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            mainContentPanel.removeAll();
            mainContentPanel.add(welcomePanel, BorderLayout.CENTER);
            mainContentPanel.updateUI();
        }
    });

    //      try {
    //         BufferedImage b = ImageIO.read(MainFrame.class.getResource("/com/titan/image/titanLogo.png"));
    //         Image i = b.getScaledInstance((int) (b.getWidth() * 0.6), (int) (b.getHeight() * 0.6), Image.SCALE_SMOOTH);
    logoLabel.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/titanLogo.png")));
    //      } catch (IOException e1) {
    //         e1.printStackTrace();
    //      }
    //      logoLabel.setMaximumSize(new Dimension(150, 150));

    JPanel controlPanel = new JPanel();
    controlPanel.setBackground(new Color(239, 249, 255));
    controlPanel.setOpaque(true);
    panel.add(controlPanel, BorderLayout.CENTER);
    controlPanel.setLayout(new BorderLayout());

    JScrollPane computeScrollPane = new JScrollPane();
    tabbedPane.addTab("Compute", computeScrollPane);
    controlPanel.add(tabbedPane, BorderLayout.CENTER);

    serverTree = new JTree();
    serverTree.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            //            Object obj = mainContentPanel.getComponent(0);
            //            if (obj instanceof VMMainPanel) {
            //               ((MainPanel) obj).refresh();
            //            }
        }
    });
    serverTree.setModel(computeTreeModel);
    serverTree.setCellRenderer(new ZoneTreeRenderer());
    serverTree.setRootVisible(false);
    computeScrollPane.setViewportView(serverTree);
    updateComputeTree();

    JScrollPane zoneScrollPane = new JScrollPane();
    tabbedPane.addTab("Zone", zoneScrollPane);

    zoneTree = new JTree();
    zoneTree.setModel(zoneTreeModel);
    zoneTree.setCellRenderer(new ZoneTreeRenderer());
    zoneScrollPane.setViewportView(zoneTree);
    updateZoneTree();
    splitPane.setLeftComponent(panel);

    splitPane.setRightComponent(mainContentPanel);
    mainContentPanel.setLayout(new BorderLayout(0, 0));

    welcomePanel = new WelcomePanel();
    mainContentPanel.add(welcomePanel, BorderLayout.CENTER);
    welcomePanel.setLayout(new BorderLayout(0, 0));
    welcomePanel.add(mainScreenLabel, BorderLayout.CENTER);
    mainScreenLabel.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/mainscreen.png")));

    JPanel panel_1 = new JPanel();
    welcomePanel.add(panel_1, BorderLayout.SOUTH);

    JButton licenseButton = new JButton("License");
    licenseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            InputStream in = MainFrame.class.getResourceAsStream("/com/titan/license.txt");
            try {
                LicenseDialog dialog = new LicenseDialog(MainFrame.this, IOUtils.toString(in));
                CommonLib.centerDialog(dialog);
                dialog.setVisible(true);
            } catch (IOException e1) {
                e1.printStackTrace();
            } finally {
                IOUtils.closeQuietly(in);
            }
        }
    });
    panel_1.add(licenseButton);

    ribbonPanel = new JPanel();
    contentPane.add(ribbonPanel, BorderLayout.NORTH);
    ribbonPanel.setLayout(new BorderLayout(0, 0));

    ribbonTabbedPane = new JTabbedPane(JTabbedPane.TOP);
    ribbonTabbedPane.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            //            if (!windowOpened) {
            //               return;
            //            }
            String tab = ribbonTabbedPane.getTitleAt(ribbonTabbedPane.getSelectedIndex());
            if (tab.equals("Server")) {
                if (mainServerPanel == null || !mainServerPanel.serverPanel.jprogressBarDialog.isActive()) {
                    SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                            mainContentPanel.removeAll();
                            mainServerPanel = new MainServerPanel(MainFrame.this);
                            mainContentPanel.add(mainServerPanel, BorderLayout.CENTER);
                            mainContentPanel.updateUI();
                        }
                    });
                }
            } else if (tab.equals("VM")) {
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        mainContentPanel.removeAll();
                        mainContentPanel.add(new VMMainPanel(MainFrame.this), BorderLayout.CENTER);
                        mainContentPanel.updateUI();
                    }
                });
            } else if (tab.equals("Keystone")) {
                mainContentPanel.removeAll();
                mainContentPanel.add(new KeystonePanel(MainFrame.this), BorderLayout.CENTER);
                mainContentPanel.updateUI();
            } else if (tab.equals("Flavor")) {
                mainContentPanel.removeAll();
                mainContentPanel.add(new FlavorPanel(MainFrame.this), BorderLayout.CENTER);
                mainContentPanel.updateUI();
            } else if (tab.equals("Storage")) {
                mainContentPanel.removeAll();
                mainContentPanel.add(new StoragePanel(MainFrame.this), BorderLayout.CENTER);
                mainContentPanel.updateUI();
            } else if (tab.equals("Network")) {
                mainContentPanel.removeAll();
                mainContentPanel.add(new SDNPanel(MainFrame.this), BorderLayout.CENTER);
                mainContentPanel.updateUI();
            } else if (tab.equals("Setting")) {
                mainContentPanel.removeAll();
                mainContentPanel.add(new SettingPanel(MainFrame.this), BorderLayout.CENTER);
                mainContentPanel.updateUI();
            }
        }
    });
    ribbonTabbedPane.putClientProperty("type", "ribbonType");
    ribbonTabbedPane.setPreferredSize(new Dimension(1000, 140));
    ribbonPanel.add(ribbonTabbedPane, BorderLayout.CENTER);

    serverPanel = new JRibbonPanel();
    serverPanel.setLayout(new MigLayout("", "[][][][][][][][][][][][][][grow][]", "[grow][grow][]"));
    ribbonTabbedPane.addTab("Server", null, serverPanel, null);

    logoutButton = new JRibbonBigButton("Logout");
    logoutButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            logout();
        }
    });

    rbnbgbtnAddServer = new JRibbonBigButton();
    rbnbgbtnAddServer.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/add.png")));
    rbnbgbtnAddServer.setText("Add Server");
    serverPanel.add(rbnbgbtnAddServer, "cell 0 0 1 3,growy");

    rbnbgbtnDeleteServer = new JRibbonBigButton();
    rbnbgbtnDeleteServer
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/delete.png")));
    rbnbgbtnDeleteServer.setText("Delete Server");
    serverPanel.add(rbnbgbtnDeleteServer, "cell 1 0 1 3,growy");
    logoutButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/logout.png")));
    logoutButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    logoutButton.setHorizontalTextPosition(SwingConstants.CENTER);
    serverPanel.add(logoutButton, "cell 14 0 1 3,growy");

    vmPanel = new JRibbonPanel();
    ribbonTabbedPane.addTab("VM", null, vmPanel, null);
    vmPanel.setLayout(new MigLayout("", "[][][][][][][][][][][][][][][grow][]", "[grow][grow][]"));

    launchButton = new JRibbonBigButton("Launch");
    launchButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            new LaunchInstanceDialog(MainFrame.this).setVisible(true);
        }
    });
    launchButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/launch.png")));
    launchButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    launchButton.setHorizontalTextPosition(SwingConstants.CENTER);
    vmPanel.add(launchButton, "cell 0 0 1 3,growy");

    pauseButton = new JRibbonButton("Pause");
    pauseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.action("from titan: nova pause");
        }
    });
    pauseButton.setHorizontalAlignment(SwingConstants.LEFT);
    pauseButton.setIcon(
            new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/control_pause.png")));
    vmPanel.add(pauseButton, "cell 2 0,growx");

    stopButton = new JRibbonButton("Stop");
    stopButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.action("from titan: nova stop");
        }
    });
    stopButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/stop.png")));
    stopButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    stopButton.setHorizontalTextPosition(SwingConstants.CENTER);
    vmPanel.add(stopButton, "cell 1 0 1 3,growy");

    unpauseButton = new JRibbonButton("Unpause");
    unpauseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.action("from titan: nova unpause");
        }
    });
    unpauseButton.setHorizontalAlignment(SwingConstants.LEFT);
    unpauseButton
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/control_play.png")));

    suspendButton = new JRibbonButton("Suspend");
    suspendButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.action("from titan: nova suspend");
        }
    });
    suspendButton.setHorizontalAlignment(SwingConstants.LEFT);
    suspendButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/disk.png")));
    vmPanel.add(suspendButton, "cell 3 0,growx");

    softRebootButton = new JRibbonButton("Soft reboot");
    softRebootButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.action("from titan: nova soft-reboot");
        }
    });
    softRebootButton.setHorizontalAlignment(SwingConstants.LEFT);
    softRebootButton.setIcon(new ImageIcon(
            MainFrame.class.getResource("/com/titan/image/famfamfam/arrow_rotate_clockwise.png")));

    selectAllVMButton = new JRibbonButton("Select all");
    selectAllVMButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.selectAll();
        }
    });
    vmPanel.add(selectAllVMButton, "cell 4 0,growx");
    vmPanel.add(softRebootButton, "cell 9 0,growx");

    createMacroButton = new JRibbonButton("Create macro");
    createMacroButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/add.png")));
    createMacroButton.setHorizontalAlignment(SwingConstants.LEFT);

    setGroupNameButton = new JRibbonButton("Set group name");
    setGroupNameButton.setHorizontalAlignment(SwingConstants.LEFT);
    setGroupNameButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.setGroupName();
        }
    });
    vmPanel.add(setGroupNameButton, "cell 10 0");
    vmPanel.add(createMacroButton, "cell 13 0,growx");

    ribbonSeparator_3 = new JRibbonSeparator();
    vmPanel.add(ribbonSeparator_3, "cell 14 0 1 3,growy");
    vmPanel.add(unpauseButton, "cell 2 1,growx");

    remoteButton = new JRibbonButton("Remote");
    remoteButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.remote();
        }
    });
    remoteButton.setHorizontalAlignment(SwingConstants.LEFT);
    remoteButton.setIcon(new ImageIcon(
            MainFrame.class.getResource("/com/titan/image/famfamfam/application_osx_terminal.png")));

    unselectAllButton = new JRibbonButton("Unselect all");
    unselectAllButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.unselectAll();
        }
    });
    vmPanel.add(unselectAllButton, "cell 4 1,growx");
    vmPanel.add(remoteButton, "cell 2 2,growx");

    performanceMeterButton = new JRibbonButton("Performance meter");
    performanceMeterButton
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/chart_curve.png")));
    performanceMeterButton.setHorizontalAlignment(SwingConstants.LEFT);
    vmPanel.add(performanceMeterButton, "cell 13 1,growx");

    resumeButton = new JRibbonButton("Resume");
    resumeButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.action("from titan: nova resume");
        }
    });
    resumeButton.setHorizontalAlignment(SwingConstants.LEFT);
    resumeButton
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/drive_disk.png")));
    vmPanel.add(resumeButton, "cell 3 1,growx");

    deleteButton = new JRibbonBigButton("Delete");
    deleteButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.action("from titan: nova delete");
        }
    });
    vmPanel.add(deleteButton, "cell 7 0 1 3,alignx center,growy");
    deleteButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/delete.png")));
    deleteButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    deleteButton.setHorizontalTextPosition(SwingConstants.CENTER);

    logButton = new JRibbonBigButton("Log");
    logButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.log();
        }
    });
    vmPanel.add(logButton, "cell 6 0 1 3,alignx center,growy");
    logButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/log.png")));
    logButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    logButton.setHorizontalTextPosition(SwingConstants.CENTER);

    hardRebootButton = new JRibbonButton("Hard reboot");
    hardRebootButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.action("from titan: nova hard-reboot");
        }
    });
    hardRebootButton.setHorizontalAlignment(SwingConstants.LEFT);
    hardRebootButton
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/arrow_undo.png")));

    ribbonSeparator = new JRibbonSeparator();
    vmPanel.add(ribbonSeparator, "cell 5 0 1 3,alignx center,growy");

    ribbonSeparator_1 = new JRibbonSeparator();
    vmPanel.add(ribbonSeparator_1, "cell 8 0 1 3,alignx center,growy");
    vmPanel.add(hardRebootButton, "cell 9 1,growx");

    ribbonSeparator_2 = new JRibbonSeparator();
    vmPanel.add(ribbonSeparator_2, "cell 11 0 1 3,grow");

    macroButton = new JRibbonBigButton("Macro");
    macroButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/code.png")));
    macroButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    macroButton.setHorizontalTextPosition(SwingConstants.CENTER);
    vmPanel.add(macroButton, "cell 12 0 1 3,growy");

    snapshotButton = new JRibbonButton("Snapshot");
    snapshotButton.setHorizontalAlignment(SwingConstants.LEFT);
    snapshotButton.setIcon(
            new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/application_cascade.png")));
    vmPanel.add(snapshotButton, "cell 3 2,growx");

    advanceButton = new JRibbonButton("Advance");
    advanceButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
        }
    });
    advanceButton.setHorizontalAlignment(SwingConstants.LEFT);
    advanceButton.setIcon(new ImageIcon(
            MainFrame.class.getResource("/com/titan/image/famfamfam/application_view_detail.png")));
    vmPanel.add(advanceButton, "cell 9 2,growx");

    executionMapButton = new JRibbonButton("Execution map");
    executionMapButton.setIcon(
            new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/chart_organisation.png")));
    executionMapButton.setHorizontalAlignment(SwingConstants.LEFT);
    vmPanel.add(executionMapButton, "cell 13 2,growx");

    keystonePanel = new JRibbonPanel();
    ribbonTabbedPane.addTab("Keystone", null, keystonePanel, null);
    keystonePanel.setLayout(new MigLayout("", "[][][][][][][][][][]", "[grow][][][][]"));

    addUserButton = new JRibbonBigButton("Add user");
    addUserButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0);
            keystonePanel.addUser();
        }
    });
    addUserButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    addUserButton.setHorizontalTextPosition(SwingConstants.CENTER);
    addUserButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/addUser.png")));
    keystonePanel.add(addUserButton, "cell 0 0 1 3,growy");

    editUserButton = new JRibbonButton("Edit user");
    editUserButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
        }
    });
    editUserButton.setHorizontalAlignment(SwingConstants.LEFT);
    editUserButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/pencil.png")));
    keystonePanel.add(editUserButton, "cell 1 0,growx");

    changePasswordButton = new JRibbonButton("Change password");
    keystonePanel.add(changePasswordButton, "cell 2 0");

    ribbonSeparator_4 = new JRibbonSeparator();
    keystonePanel.add(ribbonSeparator_4, "cell 3 0 1 3,growy");

    addRoleButton = new JRibbonBigButton("Add role");
    addRoleButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0);
            keystonePanel.addRole();
        }
    });
    addRoleButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    addRoleButton.setHorizontalTextPosition(SwingConstants.CENTER);
    addRoleButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/addRole.png")));
    keystonePanel.add(addRoleButton, "cell 4 0 1 3,growy");

    deleteUserButton = new JRibbonButton("Delete user");
    deleteUserButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
        }
    });
    deleteUserButton.setHorizontalAlignment(SwingConstants.LEFT);
    deleteUserButton
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png")));

    editRoleButton = new JRibbonButton("Edit role");
    editRoleButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
        }
    });
    editRoleButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/pencil.png")));
    editRoleButton.setHorizontalAlignment(SwingConstants.LEFT);
    keystonePanel.add(editRoleButton, "cell 5 0,growx");

    ribbonSeparator_5 = new JRibbonSeparator();
    keystonePanel.add(ribbonSeparator_5, "cell 6 0 1 3,growy");

    createTenantButton = new JRibbonBigButton("Create tenant");
    createTenantButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0);
            keystonePanel.createTenant();
        }
    });
    createTenantButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/add.png")));
    createTenantButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    createTenantButton.setHorizontalTextPosition(SwingConstants.CENTER);
    keystonePanel.add(createTenantButton, "cell 7 0 1 3,growy");

    deleteTenantButton = new JRibbonBigButton("Delete tenant");
    deleteTenantButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0);
            keystonePanel.deleteTenant();
        }
    });
    deleteTenantButton
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/delete.png")));
    deleteTenantButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    deleteTenantButton.setHorizontalTextPosition(SwingConstants.CENTER);
    keystonePanel.add(deleteTenantButton, "cell 8 0 1 3,growy");
    keystonePanel.add(deleteUserButton, "cell 1 1,growx");

    detailUserButton = new JRibbonButton("Detail user");
    detailUserButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0);
            keystonePanel.showUserDetail();
        }
    });
    detailUserButton.setHorizontalAlignment(SwingConstants.LEFT);
    detailUserButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/zoom.png")));
    keystonePanel.add(detailUserButton, "cell 1 2,growx");

    btnDeleteRole = new JRibbonButton("Delete role");
    btnDeleteRole.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0);
            keystonePanel.deleteRole();
        }
    });
    btnDeleteRole.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png")));
    keystonePanel.add(btnDeleteRole, "cell 5 1,growx");

    assignRoleButton = new JRibbonButton("Assign role");
    assignRoleButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0);
            keystonePanel.assignRole();
        }
    });
    assignRoleButton.setSelectedIcon(
            new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/user_add.png")));
    keystonePanel.add(assignRoleButton, "cell 5 2,growx");

    lblUser = new JRibbonLabel("user");
    keystonePanel.add(lblUser, "cell 0 3 2 1,growx");

    rbnlblRole = new JRibbonLabel("role");
    keystonePanel.add(rbnlblRole, "cell 4 3 2 1,growx");

    rbnlblTenant = new JRibbonLabel();
    rbnlblTenant.setText("tenant");
    keystonePanel.add(rbnlblTenant, "cell 7 3 2 1,growx");

    flavorPanel = new JRibbonPanel();
    ribbonTabbedPane.addTab("Flavor", null, flavorPanel, null);
    flavorPanel.setLayout(new MigLayout("", "[][]", "[grow][][][]"));

    rbnbgbtnCreateFlavor = new JRibbonBigButton();
    rbnbgbtnCreateFlavor.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/add.png")));
    rbnbgbtnCreateFlavor.setText("Create Flavor");
    flavorPanel.add(rbnbgbtnCreateFlavor, "cell 0 0 1 3,growy");

    btnDeleteFlavor = new JRibbonBigButton("Delete Flavor");
    btnDeleteFlavor.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/delete.png")));
    flavorPanel.add(btnDeleteFlavor, "cell 1 0 1 3,growy");

    storagePanel = new JRibbonPanel();
    ribbonTabbedPane.addTab("Storage", null, storagePanel, null);
    storagePanel.setLayout(new MigLayout("", "[][][][][][]", "[grow][][][]"));

    uploadImageButton = new JRibbonBigButton("Upload");
    uploadImageButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/add.png")));
    uploadImageButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    uploadImageButton.setHorizontalTextPosition(SwingConstants.CENTER);
    storagePanel.add(uploadImageButton, "cell 0 0 1 3, growy");

    btnDelete = new JRibbonButton("Delete");
    btnDelete.setHorizontalAlignment(SwingConstants.LEFT);
    btnDelete.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png")));
    storagePanel.add(btnDelete, "cell 1 0,growx");

    ribbonSeparator_6 = new JRibbonSeparator();
    storagePanel.add(ribbonSeparator_6, "cell 2 0 1 3,grow");

    btnCreateVolume = new JRibbonBigButton("Create volume");
    btnCreateVolume.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/add.png")));
    btnCreateVolume.setVerticalTextPosition(SwingConstants.BOTTOM);
    btnCreateVolume.setHorizontalTextPosition(SwingConstants.CENTER);
    storagePanel.add(btnCreateVolume, "cell 3 0 1 3,growy");

    btnDelete_1 = new JRibbonButton("Delete");
    btnDelete_1.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png")));
    btnDelete_1.setHorizontalAlignment(SwingConstants.LEFT);
    storagePanel.add(btnDelete_1, "cell 4 0,growx");

    btnAttach = new JRibbonButton("Attach to vm");
    btnAttach.setHorizontalAlignment(SwingConstants.LEFT);
    btnAttach.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/attach.png")));
    storagePanel.add(btnAttach, "cell 5 0,growx");

    btnChangeName = new JRibbonButton("Change name");
    btnChangeName.setHorizontalAlignment(SwingConstants.LEFT);
    btnChangeName.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/pencil.png")));
    storagePanel.add(btnChangeName, "cell 1 1,growx");

    btnDetail = new JRibbonButton("Detail");
    btnDetail.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/zoom.png")));
    btnDetail.setHorizontalAlignment(SwingConstants.LEFT);
    storagePanel.add(btnDetail, "cell 4 1,growx");

    btnDetachToVm = new JRibbonButton("Detach to vm");
    btnDetachToVm.setHorizontalAlignment(SwingConstants.LEFT);
    btnDetachToVm.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/delete.png")));
    storagePanel.add(btnDetachToVm, "cell 5 1,growx");

    btnPublicprivate = new JRibbonButton("public/private");
    btnPublicprivate.setHorizontalAlignment(SwingConstants.LEFT);
    btnPublicprivate.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/tick.png")));
    storagePanel.add(btnPublicprivate, "cell 1 2,growx");

    btnAddVolumeType = new JRibbonButton("Add volume type");
    btnAddVolumeType.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/add.png")));
    btnAddVolumeType.setHorizontalAlignment(SwingConstants.LEFT);
    storagePanel.add(btnAddVolumeType, "cell 4 2");

    btnDeleteVolumeType = new JRibbonButton("Delete volume type");
    btnDeleteVolumeType
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png")));
    btnDeleteVolumeType.setHorizontalAlignment(SwingConstants.LEFT);
    storagePanel.add(btnDeleteVolumeType, "cell 5 2");

    rbnlblImage = new JRibbonLabel();
    rbnlblImage.setText("Image");
    storagePanel.add(rbnlblImage, "cell 0 3 2 1,growx");

    rbnlblVolume = new JRibbonLabel();
    rbnlblVolume.setText("Volume");
    storagePanel.add(rbnlblVolume, "cell 3 3 3 1,growx");

    networkPanel = new JRibbonPanel();
    ribbonTabbedPane.addTab("Network", null, networkPanel, null);

    settingPanel = new JRibbonPanel();
    ribbonTabbedPane.addTab("Setting", null, settingPanel, null);
    settingPanel.setLayout(new MigLayout("", "[][][]", "[grow][grow][]"));

    rbnbgbtnSystemSetting = new JRibbonBigButton();
    rbnbgbtnSystemSetting
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/systemSetting.png")));
    rbnbgbtnSystemSetting.setText("System Setting");
    settingPanel.add(rbnbgbtnSystemSetting, "cell 0 0 1 3,growy");

    rbnbgbtnDatabase = new JRibbonBigButton();
    rbnbgbtnDatabase
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/database.png")));
    rbnbgbtnDatabase.setText("Database");
    settingPanel.add(rbnbgbtnDatabase, "cell 1 0 1 3,growy");

    rbnbtnAddGroup = new JRibbonButton();
    rbnbtnAddGroup.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/add.png")));
    rbnbtnAddGroup.setText("Add Group");
    settingPanel.add(rbnbtnAddGroup, "cell 2 0");

    rbnbtnEditGroup = new JRibbonButton();
    rbnbtnEditGroup
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/pencil.png")));
    rbnbtnEditGroup.setText("Edit Group");
    settingPanel.add(rbnbtnEditGroup, "cell 2 1");

    rbnbtnDeleteGroup = new JRibbonButton();
    rbnbtnDeleteGroup
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png")));
    rbnbtnDeleteGroup.setText("Delete Group");
    settingPanel.add(rbnbtnDeleteGroup, "cell 2 2");

    logoPanel = new JRibbonPanel();
    ribbonPanel.add(logoPanel, BorderLayout.WEST);
    logoPanel.setLayout(new BorderLayout(0, 0));
    logoPanel.add(logoLabel, BorderLayout.CENTER);

    setLocationRelativeTo(null);

    new Thread(new TitanServerUpdateThread()).start();
}

From source file:edu.ku.brc.specify.tools.l10nios.StrLocalizerAppForiOS.java

/**
 * /*from  ww  w  .  j av  a 2s  .c  o  m*/
 */
private void createUI() {
    IconManager.setApplicationClass(Specify.class);
    IconManager.loadIcons(XMLHelper.getConfigDir("icons_datamodel.xml")); //$NON-NLS-1$
    IconManager.loadIcons(XMLHelper.getConfigDir("icons_plugins.xml")); //$NON-NLS-1$
    IconManager.loadIcons(XMLHelper.getConfigDir("icons_disciplines.xml")); //$NON-NLS-1$

    System.setProperty("edu.ku.brc.ui.db.PickListDBAdapterFactory", //$NON-NLS-1$
            "edu.ku.brc.specify.tools.StrLocPickListFactory"); // Needed By the Auto Cosmplete UI  //$NON-NLS-1$

    CellConstraints cc = new CellConstraints();

    fileList = new JList(fileModel = new DefaultListModel());
    termList = new JList(model = new ItemModel(null));

    srcLbl = setTAReadOnly(UIHelper.createTextArea(3, 40));
    //srcLbl.setBorder(new LineBorder(srcLbl.getForeground()));
    textField = UIHelper.createTextField(40);

    comment = setTAReadOnly(UIHelper.createTextArea(3, 40));

    /*textField.getDocument().addDocumentListener(new DocumentAdaptor() {
    @Override
    protected void changed(DocumentEvent e)
    {
        hasChanged = true;
    }
    });*/

    statusBar = new JStatusBar();
    statusBar.setSectionText(1, "     "); //$NON-NLS-1$ //$NON-NLS-2$
    UIRegistry.setStatusBar(statusBar);

    srcLbl.setEditable(false);

    rsController = new ResultSetController(null, false, false, false, "", 1, true);

    transBtn = UIHelper.createButton(getResourceString("StrLocalizerApp.Translate"));
    transBtn.setVisible(false);

    PanelBuilder pbr = new PanelBuilder(new FormLayout("p,2px,f:p:g", "p,4px,p,4px,p,4px,p,4px,p,4px,p"));

    //pbr.add(UIHelper.createLabel(getResourceString("StrLocalizerApp.FileLbl")), cc.xy(1, 1));
    //fileLbl = UIHelper.createLabel("   ");
    //pbr.add(fileLbl, cc.xy(3, 1));

    int y = 1;
    pbr.addSeparator("Item", cc.xyw(1, y, 3));
    y += 2;

    pbr.add(UIHelper.createLabel("English:", SwingConstants.RIGHT), cc.xy(1, y));
    pbr.add(srcLbl, cc.xy(3, y));
    y += 2;

    pbr.add(UIHelper.createFormLabel("Comment", SwingConstants.RIGHT), cc.xy(1, y));
    pbr.add(comment, cc.xy(3, y));
    y += 2;

    destLbl = UIHelper.createFormLabel("", SwingConstants.RIGHT);//destLanguage.getDisplayName());
    pbr.add(destLbl, cc.xy(1, y));
    pbr.add(textField, cc.xy(3, y));
    y += 2;

    pbr.add(rsController.getPanel(), cc.xyw(1, y, 3));
    y += 2;
    pbr.add(transBtn, cc.xy(1, y));

    JScrollPane sp = UIHelper.createScrollPane(termList);

    PanelBuilder pb = new PanelBuilder(new FormLayout("f:p:g", "p,4px,f:p:g,10px,p"));
    pb.addSeparator("Localize", cc.xy(1, 1));
    pb.add(sp, cc.xy(1, 3));
    pb.add(pbr.getPanel(), cc.xy(1, 5));
    pb.setDefaultDialogBorder();

    ResultSetController.setBackStopRS(rsController);

    PanelBuilder fpb = new PanelBuilder(new FormLayout("8px,f:p:g", "p,4px,f:p:g"));
    JScrollPane filesp = UIHelper.createScrollPane(fileList);
    fpb.add(UIHelper.createLabel("Files", SwingConstants.CENTER), cc.xy(2, 1));
    fpb.add(filesp, cc.xy(2, 3));

    setLayout(new BorderLayout());
    add(fpb.getPanel(), BorderLayout.WEST);
    add(pb.getPanel(), BorderLayout.CENTER);
    add(statusBar, BorderLayout.SOUTH);

    mainPane = this;

    textField.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            checkForChange();
        }
    });

    termList.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                itemSelected();
            }
        }
    });

    fileList.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                fileSelected();
            }
        }
    });

    transBtn.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            String txt = srcLbl.getText();
            String newText = translate(txt);
            if (StringUtils.isNotEmpty(newText)) {
                newText = newText.replace("&#039;", "'");
                textField.setText(newText);
                L10NItem entry = (L10NItem) termList.getSelectedValue();
                entry.setValue(textField.getText());
            }
        }
    });

    rscListener = new ResultSetControllerListener() {
        @Override
        public void newRecordAdded() {
        }

        @Override
        public void indexChanged(int newIndex) {
            termList.setSelectedIndex(newIndex);
        }

        @Override
        public boolean indexAboutToChange(int oldIndex, int newIndex) {
            return true;
        }
    };

    rsController.addListener(rscListener);
}

From source file:com.jtstand.swing.StatsPanel.java

private void showStatisticsTable() {
    StatsTableModel tm = new StatsTableModel(this, allstat, catstats);
    jTable.setModel(tm);/*from  w  w  w. j  av  a 2  s .co  m*/
    jTable.setBackground(Color.white);
    //...
    //        resizeSeries();
    //((ColumnHeaderRenderer) jTable.getTableHeader().getDefaultRenderer()).setHorizontalAlignment(SwingConstants.CENTER);
    jTable.addHighlighter(new Highlighter() {
        public Component highlight(Component c, ComponentAdapter ca) {
            if (JLabel.class.isAssignableFrom(c.getClass())) {
                ((JLabel) c).setHorizontalAlignment(SwingConstants.CENTER);
                int column = jTable.convertColumnIndexToModel(ca.column);
                if (column == StatsTableModel.StatsTableColumn.CATEGORY.ordinal()) {
                    if (jTable.getRowCount() > 1) {
                        int i = jTable.convertRowIndexToModel(ca.row);
                        if (i > 0) {
                            c.setForeground(ChartCategories.getColor(i - 1));
                        }
                    } else {
                        if (isCategorization() && !isMultipleCategorization()) {
                            c.setForeground(ChartCategories.getColor(0));
                        }
                    }
                }
            }
            return c;
        }

        public void addChangeListener(ChangeListener arg0) {
        }

        public void removeChangeListener(ChangeListener arg0) {
        }

        public ChangeListener[] getChangeListeners() {
            return new ChangeListener[0];
        }
    });
    DecimalFormat df = null;
    if (testStepInstances.getReferenceStep() != null) {
        String decFormatStr = testStepInstances.getReferenceStep()
                .getPropertyString(TestStepInstance.STR_DECIMAL_FORMAT, null);
        if (decFormatStr != null) {
            df = new DecimalFormat(decFormatStr);
        }
    }

    jTable.setDefaultRenderer(Double.class, new StatsTableRendererDouble(df));
    //this.jTableSeries.invalidate();
    Util.packColumns(jTable, 9);
    //        jTableSeries.setVisibleRowCount(Math.min(3, jTableSeries.getRowCount()));
    Util.setVisibleRowCount(jTable, Math.min(3, jTable.getRowCount()), jSplitPane);
    //        Util.getRowCount(jTable, jSplitPane);
    //        Util.setDividerLocation(jSplitPane, jTable);
    jSplitPane.setDividerLocation(-1);
    //        jScrollPaneTop.invalidate();
    //        validateTree();
}

From source file:cz.cvut.kbe.crypthelper.ui.MainPanel.java

public void setTableModel(CharacterTableModel tableModel) {
    this.tableModel = tableModel;
    charTable.setModel(tableModel);//from   w ww.j av  a2  s  .com

    DefaultTableCellRenderer dtcr = new DefaultTableCellRenderer() {

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row,
                    column);
            label.setHorizontalAlignment(SwingConstants.CENTER);
            return label;
        }

    };

    for (int i = 0; i < charTable.getColumnCount(); i++) {
        charTable.getColumnModel().getColumn(i).setCellRenderer(dtcr);
    }
}