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:edu.ku.brc.af.ui.forms.SubViewBtn.java

/**
 * @param subviewDef/*from  ww  w .j  a  v a  2 s  . c o  m*/
 * @param isCollection
 * @param props
 */
public SubViewBtn(final MultiView mvParent, final FormCellSubViewIFace subviewDef, final ViewIFace view,
        final DATA_TYPE dataType, final int options, final Properties props, final Class<?> classToCreate,
        final AltViewIFace.CreationMode mode) {
    this.mvParent = mvParent;
    this.subviewDef = subviewDef;
    this.dataType = dataType;
    this.view = view;
    this.options = options;
    this.classToCreate = classToCreate;

    isEditing = mode == AltViewIFace.CreationMode.EDIT;

    // 02/12/08 - rods - Removing the "IS_NEW_OBJECT" of the parent object because it doesn't
    // matter to the popup form it creates. The form takes care of everything.
    this.options &= ~MultiView.IS_NEW_OBJECT;

    //log.debug("Editing "+MultiView.isOptionOn(options, MultiView.IS_EDITTING));
    //log.debug("IsNew "+MultiView.isOptionOn(options, MultiView.IS_NEW_OBJECT));

    cellName = subviewDef.getName();
    frameTitle = props.getProperty("title");
    String align = props.getProperty("align", "left");
    String iconName = props.getProperty("icon", null);

    icon = null;
    baseLabel = props.getProperty("label");
    if (baseLabel == null) {
        DBTableInfo tableInfo = DBTableIdMgr.getInstance()
                .getByClassName(classToCreate != null ? classToCreate.getName() : view.getClassName());
        if (tableInfo != null) {
            baseLabel = tableInfo.getTitle();

            String icNam = StringUtils.isNotEmpty(iconName) ? iconName : tableInfo.getName();
            IconEntry entry = IconManager.getIconEntryByName(icNam);
            if (entry != null) {
                icon = IconManager.getIcon(icNam,
                        entry.getSize() == IconSize.NonStd ? IconSize.NonStd : IconSize.Std24);
            }

            if (frameTitle == null) {
                frameTitle = baseLabel;
            }
        }
    }

    if (frameTitle == null) {
        DBTableInfo tableInfo = DBTableIdMgr.getInstance()
                .getByClassName(classToCreate != null ? classToCreate.getName() : view.getClassName());
        if (tableInfo != null) {
            frameTitle = tableInfo.getTitle();
        }
    }

    int x = 2;
    String colDef;
    if (align.equals("center")) {
        colDef = "f:p:g,p,2px,p,f:p:g";

    } else if (align.equals("right")) {
        colDef = "f:p:g, p,2px,p";

    } else // defaults to left
    {
        colDef = "p,2px,p,f:p:g";
        x = 1;
    }

    subViewBtn = icon != null ? createButton(icon) : createButton(baseLabel);
    subViewBtn.addActionListener(new ActionListener() {
        //@Override
        public void actionPerformed(ActionEvent e) {
            showForm();
        }
    });
    //subViewBtn.setEnabled(false);

    label = createLabel("  ");
    label.setHorizontalAlignment(SwingConstants.CENTER);
    label.setOpaque(true);
    label.setBackground(Color.WHITE);
    label.setBorder(BorderFactory.createLineBorder(Color.GRAY));

    PanelBuilder pb = new PanelBuilder(new FormLayout(colDef, "p"), this);
    CellConstraints cc = new CellConstraints();
    pb.add(subViewBtn, cc.xy(x, 1));
    pb.add(label, cc.xy(x + 2, 1));

    try {
        classObj = Class.forName(view.getClassName());

    } catch (ClassNotFoundException ex) {
        log.error(ex);
        FormDevHelper.showFormDevError(ex);
    }

    setOpaque(false);
}

From source file:gda.gui.BatonPanel.java

/**
 * Constructor/*from   w ww .j  a  v a 2  s . co m*/
 */
public BatonPanel() {
    super();

    if (LocalProperties.isBatonManagementEnabled()) {
        initGUI();
    } else {
        JPanel jPanel1 = new JPanel();
        jPanel1.setLayout(new FlowLayout());
        jPanel1.setPreferredSize(new java.awt.Dimension(500, 200));
        lblUser = new JLabel();
        lblUser.setBounds(15, 36, 422, 14);
        lblUser.setHorizontalAlignment(SwingConstants.CENTER);
        lblUser.setHorizontalTextPosition(SwingConstants.CENTER);
        lblUser.setText("Please close this panel: it is for baton control and this is not currently in use.");
        this.add(jPanel1);
        jPanel1.add(lblUser);
    }
    setLabel("Baton Panel");
}

From source file:edu.harvard.i2b2.patientMapping.ui.PatientMappingJPanel.java

/** Creates new form PatientMappingJPanel */
public PatientMappingJPanel(java.awt.Container oAwtContainer) {
    columns = new ArrayList<SiteColumnData>();

    initComponents();// www. j a  va  2  s.com
    DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
    //model.addColumn("addedColumn1");
    //model.addColumn("addedColumn2");

    String[] columns = new String[3];
    columns[0] = new String("HIVE");
    columns[1] = new String("");
    columns[2] = new String("");
    //columns[3] = new String("");
    DefaultTableModel model1 = new DefaultTableModel(columns, 100);
    jTable1.setModel(model1);
    jTable1.setCellSelectionEnabled(true);
    TableColumn col = jTable1.getColumnModel().getColumn(0);
    DefaultTableCellRenderer dtcr = new DefaultTableCellRenderer();
    dtcr.setHorizontalAlignment(SwingConstants.CENTER);
    col.setCellRenderer(dtcr);
    //jTable1.setCellSelectionEnabled(false);
    //model.setRowCount(100);
    //model.setValueAt(235600004, 0, 4);
    //model.setValueAt(235600005, 1, 5);
    //model.setValueAt(235600006, 5, 4);
    //model.setValueAt(235600007, 5, 5);
    //model.setValueAt(235600008, 6, 5);

    thisPanel = this;
    parent = oAwtContainer;

    //this.jLeftButton.setEnabled(false);
    this.jRightButton.setEnabled(false);
    this.jStartTextField.setEditable(false);
    this.jIncrementTextField.setEditable(false);
    //jAutoSaveCheckBox.setSelected(true);
}

From source file:edu.ku.brc.specify.tasks.subpane.wb.ImageFrame.java

/**
 * Constructor. // w w  w.  j a  v  a 2  s  . co m
 */
public ImageFrame(final int mapSize, final WorkbenchPaneSS wbPane, final Workbench workbench,
        final Taskable task, final boolean isReadOnly) {
    this.wbPane = wbPane;
    this.workbench = workbench;

    try {
        this.workbenchTask = (WorkbenchTask) task;
    } catch (ClassCastException e) {
        this.workbenchTask = null;
    }

    this.allowCloseWindow = true;
    this.defaultThumbIcon = IconManager.getIcon("image", IconSize.Std32);

    setIconImage(IconManager.getImage("AppIcon").getImage());

    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            if (allowCloseWindow) {
                wbPane.toggleImageFrameVisible();
            }
        }
    });

    Dimension minSize = new Dimension(mapSize, mapSize);
    cardImageLabel.setHorizontalTextPosition(SwingConstants.CENTER);

    PanelBuilder builder = new PanelBuilder(new FormLayout("f:p:g,c:p,f:p:g", "f:p:g,p,5px,p,f:p:g"));
    CellConstraints cc = new CellConstraints();

    loadImgBtn = createButton(getResourceString("WB_LOAD_NEW_IMAGE"));

    builder.add(createLabel(getResourceString("WB_NO_IMAGE_ROW"), SwingConstants.CENTER), cc.xy(2, 2));
    builder.add(loadImgBtn, cc.xy(2, 4));
    loadImgBtn.setVisible(!isReadOnly);

    noCardImageMessagePanel = builder.getPanel();
    noCardImageMessagePanel.setPreferredSize(minSize);
    noCardImageMessagePanel.setSize(minSize);

    builder = new PanelBuilder(new FormLayout("f:p:g,c:p,f:p:g", "f:p:g,c:p,f:p:g"));
    builder.add(createLabel(getResourceString("WB_NO_ROW_SELECTED"), SwingConstants.CENTER), cc.xy(2, 2));

    noRowSelectedMessagePanel = builder.getPanel();
    noRowSelectedMessagePanel.setPreferredSize(minSize);
    noRowSelectedMessagePanel.setSize(minSize);

    mainPane = new JPanel(new BorderLayout());
    mainPane.setSize(minSize);
    mainPane.setPreferredSize(minSize);
    mainPane.setMinimumSize(minSize);

    mainPane.add(cardImageLabel, BorderLayout.CENTER);
    scrollPane = new JScrollPane(mainPane, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    statusBar = new JStatusBar();

    thumbnailer = new ImageThumbnailGenerator();
    thumbnailer.setMaxSize(256, 256);
    thumbnailer.setQuality(1);

    tray = new ThumbnailTray();
    tray.getModel().removeAllElements();
    tray.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting()) {
                return;
            }

            setImageIndex(tray.getSelectedIndex());
        }
    });

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

    //southPanel.add(indexSlider,BorderLayout.NORTH);
    southPanel.add(tray, BorderLayout.CENTER);
    southPanel.add(statusBar, BorderLayout.SOUTH);

    JPanel basePanel = new JPanel();
    basePanel.setLayout(new BorderLayout());
    basePanel.add(scrollPane, BorderLayout.CENTER);
    basePanel.add(southPanel, BorderLayout.SOUTH);

    setContentPane(basePanel);

    JMenuBar menuBar = new JMenuBar();

    String title = "FileMenu";
    String mneu = "FileMneu";
    JMenu fileMenu = UIHelper.createLocalizedMenu(menuBar, title, mneu);
    title = "WB_IMPORT_CARDS_TO_DATASET";
    mneu = "WB_IMPORT_CARDS_MNEU";

    if (!isReadOnly) {
        JMenuItem importImagesMI = UIHelper.createLocalizedMenuItem(fileMenu, title, mneu, "", true, null);
        importImagesMI.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ae) {

                importImages();
            }
        });
    }

    /*        title = "ImageFrame.CLOSE";
            mneu = "ImageFrame.CloseMneu";
            closeMI = UIHelper.createLocalizedMenuItem(fileMenu, title, mneu,  "", true, null);
            closeMI.addActionListener(new ActionListener()
            {
    public void actionPerformed(ActionEvent ae)
    {
        ImageFrame.this.setVisible(false);
    }
            });*/

    title = "ImageFrame.View";
    mneu = "ImageFrame.ViewMneu";
    viewMenu = UIHelper.createLocalizedMenu(menuBar, title, mneu);
    reduceMI = UIHelper.createRadioButtonMenuItem(viewMenu, "WB_REDUCED_SIZE", "ImageFrame.ReducedSizeMneu", "",
            true, null);
    reduceMI.setSelected(true);
    reduceMI.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (row == null) {
                return;
            }

            // simply 'remember' that we want to show reduced images for this row
            rowToImageSizeHash.put(row.hashCode(), REDUCED_SIZE);
            // then 'reshow' the current image
            showImage();
        }
    });

    origMI = UIHelper.createRadioButtonMenuItem(viewMenu, "WB_ORIG_SIZE", "ImageFrame.OrigMneu", "", true,
            null);
    origMI.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (row == null) {
                return;
            }

            // simply 'remember' that we want to show fill size images for this row
            rowToImageSizeHash.put(row.hashCode(), FULL_SIZE);
            // then 'reshow' the current image
            showImage();
        }
    });

    ButtonGroup btnGrp = new ButtonGroup();
    btnGrp.add(reduceMI);
    btnGrp.add(origMI);

    viewMenu.addSeparator();

    alwaysOnTopMI = UIHelper.createCheckBoxMenuItem(viewMenu, "WB_ALWAYS_ON_TOP", null, "", true, null);
    alwaysOnTopMI.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            ImageFrame.this.setAlwaysOnTop(alwaysOnTopMI.isSelected());
        }
    });

    addPropertyChangeListener("alwaysOnTop", this);

    if (!isReadOnly) {
        ActionListener deleteImg = new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                deleteImage();
            }
        };

        ActionListener replaceImg = new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                replaceImage();
            }
        };

        ActionListener addImg = new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                addImages();
            }
        };

        title = "ImageFrame.Image";
        mneu = "ImageFrame.ImageMneu";
        imageMenu = UIHelper.createLocalizedMenu(menuBar, title, mneu);

        title = "WB_ADD_IMG";
        mneu = "WB_ADD_IMG_MNEM";
        addMI = UIHelper.createLocalizedMenuItem(imageMenu, title, mneu, "", true, addImg);

        title = "WB_REPLACE_IMG";
        mneu = "WB_REPLACE_IMG_MNEU";
        replaceMI = UIHelper.createLocalizedMenuItem(imageMenu, title, mneu, "", true, replaceImg);

        title = "WB_DEL_IMG_LINK";
        mneu = "WB_DEL_IMG_LINK_MNEU";
        deleteMI = UIHelper.createLocalizedMenuItem(imageMenu, title, mneu, "", true, deleteImg);

        loadImgBtn.addActionListener(addImg);
    }

    JMenu helpMenu = new JMenu(getResourceString("HELP"));
    menuBar.add(HelpMgr.createHelpMenuItem(helpMenu, getResourceString("WB_IMAGE_WINDOW")));

    enableMenus(false);

    setJMenuBar(menuBar);

    pack();

    HelpMgr.setHelpID(this, "WorkbenchWorkingWithImages");
}

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.doctype.ferramentaDoctype.java

/**
 * Mtodo chamado pelos construtores//from w  w w .j  a  v  a  2s . c  o m
 * 
 * @param conteudo
 */
private void initComponents(String conteudo) {
    textAreaSourceCode = new G_TextAreaSourceCode();
    tabelaDoctypes = new TabelaDescricao();
    aplicar = new JButton();

    abrir = new JButton();
    cancelar = new JButton();
    JPanel regraFonteBtn = new JPanel();
    regraFonteBtn.setLayout(new BorderLayout());

    textAreaSourceCode.setTipoHTML();
    new OnChange(textAreaSourceCode, this);
    tabelaDoctypes = new TabelaDescricao();

    salvar = new JButton();
    abrir = new JButton();
    cancelar = new JButton();
    strConteudoalt = new String();

    pnRegra = new JPanel();
    lbRegras1 = new JLabel();
    pnSetaDescricao = new JPanel();

    pnListaErros = new JPanel();
    scrollPanetabLinCod = new JScrollPane();

    pnBotoes = new JPanel();

    buscar = new JButton();
    salvar.setEnabled(false);
    salvaAlteracoes = TxtBuffer.getInstanciaSalvaAlteracoes(textAreaSourceCode.getTextPane(), salvar,
            new JMenuItem(), parentFrame);
    textAreaSourceCode.getTextPane().setEditable(true);
    aplicar.setEnabled(false);
    setBackground(CoresDefault.getCorPaineis());
    Container contentPane = this;// ??
    contentPane.setLayout(new GridLayout(2, 1));

    // ======== pnRegra ========
    {
        // pnRegra.setBorder(criaBorda(""));
        pnRegra.setBorder(criaBorda(LabelPanel.TITULO_REGRA));
        pnRegra.setLayout(new GridLayout(2, 1));
        pnRegra.add(lbRegras1);
        lbRegras1.setText(TradFerramentaDocType.UTILIZAR_ELEMENTOS_CABECALHO);
        lbRegras1.setHorizontalAlignment(SwingConstants.CENTER);
        pnRegra.add(lbRegras1);
        pnRegra.setPreferredSize(new Dimension(700, 60));
    }

    // ======== pnDescricao ========

    aplicar.setText(GERAL.APLICAR);
    aplicar.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            aplicarActionPerformed(e);
        }
    });

    aplicar.setToolTipText(TradFerramentaDocType.DICA_APLICA_DTD);
    aplicar.getAccessibleContext().setAccessibleDescription(TradFerramentaDocType.DICA_APLICA_DTD);
    aplicar.getAccessibleContext().setAccessibleName(TradFerramentaDocType.DICA_APLICA_DTD);
    aplicar.setBounds(10, 0, 150, 25);

    salvar.setText(GERAL.BTN_SALVAR);
    salvar.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            salvarActionPerformed(e);
        }
    });
    salvar.setToolTipText(GERAL.DICA_SALVAR);
    salvar.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SALVAR);
    salvar.getAccessibleContext().setAccessibleName(GERAL.DICA_SALVAR);

    salvar.setBounds(10, 0, 150, 25);

    abrir.setText(GERAL.BTN_ABRIR);
    abrir.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            abrirActionPerformed(e);
        }
    });

    abrir.setToolTipText(Ferramenta_Scripts.DICA_ABRIR);
    abrir.getAccessibleContext().setAccessibleDescription(Ferramenta_Scripts.DICA_ABRIR_HTML);
    abrir.getAccessibleContext().setAccessibleName(Ferramenta_Scripts.DICA_ABRIR_HTML);
    abrir.setBounds(165, 0, 150, 25);

    cancelar.setText(Ferramenta_Imagens.TELA_ANTERIOR);
    cancelar.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            cancelarActionPerformed(e);
        }
    });

    cancelar.setToolTipText(Ferramenta_Imagens.DICA_TELA_ANTERIOR);
    cancelar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_TELA_ANTERIOR);
    cancelar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_BTN_CANCELAR);
    cancelar.setBounds(320, 0, 150, 25);

    // ======== pnParticRotulo ========

    // pnSetaDescricao.setBorder(criaBorda(""));
    GridBagConstraints cons = new GridBagConstraints();
    GridBagLayout layout = new GridBagLayout();
    cons.fill = GridBagConstraints.BOTH;
    cons.weighty = 1;
    cons.weightx = 0.80;

    pnSetaDescricao.setLayout(layout);
    cons.anchor = GridBagConstraints.SOUTHEAST;
    cons.insets = new Insets(0, 0, 0, 10);
    // ======== spParticRotulo ========

    cons.weightx = 0.20;
    pnSetaDescricao.setPreferredSize(new Dimension(400, 60));

    // ======== pnListaErros ========
    {

        pnListaErros.setBorder(criaBorda(TradFerramentaDocType.ESCOLHA_DTD_CORRETO));
        pnListaErros.setLayout(new BorderLayout());
        // ======== scrollPanetabLinCod ========
        {
            scrollPanetabLinCod.setViewportView(tabelaDoctypes);
        }
        pnListaErros.add(scrollPanetabLinCod, BorderLayout.CENTER);
    }
    // ======== pnBotoes ========
    {

        // pnBotoes.setBorder(criaBorda(""));

        pnBotoes.setLayout(null);
        // ---- adicionar ----

        // ---- aplicarRotulo ----

        buscar.setText(TradSimuladorNavegacao.BUSCAR_PROXIMA);
        buscar.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                aplicarActionPerformed(e);
            }
        });

        buscar.setToolTipText(TradSimuladorNavegacao.BUSCAR_TEXTO);
        buscar.getAccessibleContext().setAccessibleDescription(TradSimuladorNavegacao.BUSCAR_TEXTO);
        buscar.getAccessibleContext().setAccessibleName(TradSimuladorNavegacao.BUSCAR_TEXTO);
        buscar.setBounds(10, 5, 150, 25);
        // pnBotoes.add(buscar);
    }

    /*
     * Colocar os controles
     */
    pnRegra.setBackground(CoresDefault.getCorPaineis());
    regraFonteBtn.add(pnRegra, BorderLayout.NORTH);
    textAreaSourceCode.setBorder(criaBorda(TradFerramentaDocType.CODIGO_FONTE));
    textAreaSourceCode.setBackground(CoresDefault.getCorPaineis());

    regraFonteBtn.add(textAreaSourceCode, BorderLayout.CENTER);
    pnBotoes.setPreferredSize(new Dimension(600, 35));
    pnBotoes.setBackground(CoresDefault.getCorPaineis());

    regraFonteBtn.setBackground(CoresDefault.getCorPaineis());
    contentPane.add(regraFonteBtn);

    JPanel textoErrosBtn = new JPanel();
    textoErrosBtn.setLayout(new BorderLayout());
    pnSetaDescricao.setBackground(CoresDefault.getCorPaineis());
    pnSetaDescricao.add(pnBotoes, cons);
    textoErrosBtn.add(pnSetaDescricao, BorderLayout.NORTH);

    textoErrosBtn.add(pnListaErros, BorderLayout.CENTER);
    pnSalvarCancelar.setLayout(null);
    pnSalvarCancelar.setPreferredSize(new Dimension(600, 35));
    pnSalvarCancelar.add(abrir);
    pnSalvarCancelar.add(salvar);
    pnSalvarCancelar.add(cancelar);

    if (!original) {
        reverter = new JButton("Reverter");
        reverter.setText(TradPainelRelatorio.REVERTER);
        reverter.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                setVisible(false);
                TxtBuffer.setContent(TxtBuffer.getContentOriginal());
                parentFrame.showPainelFerramentaDoctypePArq(TxtBuffer.getContentOriginal());
                setVisible(true);
            }
        });
        reverter.setToolTipText(TradPainelRelatorio.DICA_REVERTER);
        reverter.getAccessibleContext().setAccessibleDescription(TradPainelRelatorio.DICA_REVERTER);
        reverter.getAccessibleContext().setAccessibleName(TradPainelRelatorio.DICA_REVERTER);
        reverter.setBounds(485, 0, 150, 25);
        pnSalvarCancelar.add(reverter);
    }

    pnSalvarCancelar.setBackground(CoresDefault.getCorPaineis());
    textoErrosBtn.add(pnSalvarCancelar, BorderLayout.SOUTH);
    pnListaErros.setBackground(CoresDefault.getCorPaineis());

    contentPane.setBackground(CoresDefault.getCorPaineis());
    contentPane.add(textoErrosBtn);
    controla(conteudo);
    this.setVisible(true);

}

From source file:edu.ku.brc.specify.utilapps.ERDTable.java

/**
 * @param font//from  w  ww  .  j  av  a2  s . co  m
 */
public void build(final Font font) {
    int numRows = 7;
    switch (displayType) {
    case All:
        numRows = 7;
        break;
    case MainFields:
        numRows = 7;
        break;
    case Title:
        numRows = 1;
        break;
    case TitleAndRel:
        numRows = 4;
        break;

    }
    Font bold = new Font(font.getFamily(), Font.BOLD, font.getSize());
    Font italic = new Font(font.getFamily(), Font.ITALIC, font.getSize());
    PanelBuilder pb = new PanelBuilder(
            new FormLayout("f:p:g", UIHelper.createDuplicateJGoodiesDef("p", "2px", numRows)));
    CellConstraints cc = new CellConstraints();

    String className = StringUtils.substringAfterLast(table.getClassName(), ".");
    DBTableInfo tblInfo = DBTableIdMgr.getInstance().getByShortClassName(className);
    if (tblInfo == null) {
        throw new RuntimeException("Couldn't find table for className[" + className + "]");
    }
    String tblName = tblInfo.getTitle();
    int y = 1;
    pb.add(ERDVisualizer.mkLabel(bold, tblName, SwingConstants.CENTER), cc.xy(1, y));
    y += 2;

    boolean doingAll = displayType == DisplayType.All;
    if (displayType == DisplayType.All || displayType == DisplayType.MainFields) {
        pb.addSeparator("", cc.xy(1, y));
        y += 2;

        pb.add(ERDVisualizer.mkLabel(italic, getResourceString("ERD_FIELDS"), SwingConstants.CENTER),
                cc.xy(1, y));
        y += 2;

        String colsDef = "p:g,4px,p:g,4px" + (doingAll ? ",p:g,4px,p:g,4px" : "") + ",f:p:g";
        PanelBuilder fieldsPB = new PanelBuilder(new FormLayout(colsDef,
                UIHelper.createDuplicateJGoodiesDef("p", "2px", table.getFields().size() + 2)));
        int yy = 1;

        fieldsPB.add(ERDVisualizer.mkLabel(italic, getResourceString("ERD_FIELD"), SwingConstants.LEFT),
                cc.xy(1, yy));
        fieldsPB.add(ERDVisualizer.mkLabel(italic, getResourceString("ERD_TYPE"), SwingConstants.CENTER),
                cc.xy(3, yy));
        fieldsPB.add(ERDVisualizer.mkLabel(italic, getResourceString("ERD_LENGTH"), SwingConstants.CENTER),
                cc.xy(5, yy));
        if (doingAll) {
            fieldsPB.add(
                    ERDVisualizer.mkLabel(italic, getResourceString("ERD_REQUIRED"), SwingConstants.CENTER),
                    cc.xy(7, yy));
            fieldsPB.add(ERDVisualizer.mkLabel(italic, getResourceString("ERD_UNIQUE"), SwingConstants.CENTER),
                    cc.xy(9, yy));
        }
        yy += 2;

        if (StringUtils.isNotEmpty(table.getIdColumnName())) {
            build(fieldsPB, table, font, yy, doingAll); // does ID
            yy += 2;
        }

        for (DBFieldInfo f : table.getFields()) {
            build(fieldsPB, f, font, yy, doingAll);
            yy += 2;
        }
        pb.add(fieldsPB.getPanel(), cc.xy(1, y));
        y += 2;

    }

    if ((displayType == DisplayType.All || displayType == DisplayType.TitleAndRel)
            && table.getRelationships().size() > 0) {
        pb.addSeparator("", cc.xy(1, y));
        y += 2;

        pb.add(ERDVisualizer.mkLabel(italic, getResourceString("ERD_RELATIONSHIPS"), SwingConstants.CENTER),
                cc.xy(1, y));
        y += 2;

        String colsDef = "p:g,4px,p:g,4px" + (doingAll ? ",p:g,4px" : "") + ",f:p:g";
        PanelBuilder relsPB = new PanelBuilder(new FormLayout(colsDef,
                UIHelper.createDuplicateJGoodiesDef("p", "2px", table.getRelationships().size() + 1)));
        int yy = 1;

        relsPB.add(ERDVisualizer.mkLabel(italic, getResourceString("ERD_TABLE"), SwingConstants.LEFT),
                cc.xy(1, yy));
        relsPB.add(ERDVisualizer.mkLabel(italic, getResourceString("ERD_NAME"), SwingConstants.CENTER),
                cc.xy(3, yy));
        relsPB.add(ERDVisualizer.mkLabel(italic, getResourceString("ERD_TYPE"), SwingConstants.CENTER),
                cc.xy(5, yy));
        if (doingAll) {
            relsPB.add(ERDVisualizer.mkLabel(italic, getResourceString("ERD_REQUIRED"), SwingConstants.CENTER),
                    cc.xy(7, yy));
        }
        yy += 2;

        Vector<DBRelationshipInfo> orderedList = new Vector<DBRelationshipInfo>(table.getRelationships());
        Collections.sort(orderedList, new Comparator<DBRelationshipInfo>() {
            public int compare(DBRelationshipInfo o1, DBRelationshipInfo o2) {
                String name1 = ((DBRelationshipInfo) o1).getClassName();
                if (name1.startsWith("Sp")) {
                    name1 = name1.substring(2, name1.length());
                }
                String name2 = ((DBRelationshipInfo) o2).getClassName();
                if (name2.startsWith("Sp")) {
                    name2 = name2.substring(2, name2.length());
                }
                return name1.compareTo(name2);
            }
        });

        for (DBRelationshipInfo r : orderedList) {
            //System.out.println(r.getName()+" "+r.getType());
            if (!r.getName().toLowerCase().endsWith("iface")) {
                JComponent p = build(relsPB, r, font, yy, doingAll);
                relUIHash.put(r, p);
                yy += 2;
            }
        }
        pb.add(relsPB.getPanel(), cc.xy(1, y));
        y += 2;

        //fieldsPB.getPanel().setBackground(Color.GREEN);
        //relsPB.getPanel().setBackground(Color.BLUE);
    }

    inner = pb.getPanel();
    //inner.setBorder(BorderFactory.createEmptyBorder(BRD_GAP, BRD_GAP, BRD_GAP, BRD_GAP));

    inner.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.BLACK),
            BorderFactory.createEmptyBorder(BRD_GAP, BRD_GAP, BRD_GAP, BRD_GAP)));

    setBackground(Color.WHITE);
    add(inner, BorderLayout.CENTER);
}

From source file:dk.dma.epd.common.prototype.gui.voct.VOCTAdditionalInfoPanel.java

/**
 * Updates the chat message panel in the Swing event thread
 *///ww  w.ja  va  2  s  .c o  m
public void updateChatMessagePanel() {
    // Ensure that we operate in the Swing event thread
    if (!SwingUtilities.isEventDispatchThread()) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                updateChatMessagePanel();
            }
        });
        return;
    }

    // Only enable send-function when there is chat data, and hence a target
    addBtn.setEnabled(true);
    messageText.setEditable(true);

    // Remove all components from the messages panel
    messagesPanel.removeAll();

    Insets insets = new Insets(0, 2, 2, 2);
    Insets insets2 = new Insets(6, 2, 0, 2);

    // if (chatData != null && chatData.getMessageCount() > 0) {

    // First, add a filler component
    int y = 0;
    messagesPanel.add(new JLabel(""),
            new GridBagConstraints(0, y++, 1, 1, 0.0, 1.0, NORTH, VERTICAL, insets, 0, 0));

    // Add the messages
    long lastMessageTime = 0;

    long ownMMSI = MaritimeCloudUtils.toMmsi(EPD.getInstance().getMaritimeId());

    for (VOCTSARInfoMessage message : EPD.getInstance().getVoctHandler().getAdditionalInformationMsgs()) {

        boolean ownMessage = false;

        if (message.getSender() == ownMMSI) {
            ownMessage = true;
        }

        // EPD.getInstance().getIdentityHandler().getActor(mmsi)

        // Check if we need to add a time label
        if (message.getDate() - lastMessageTime > PRINT_DATE_INTERVAL) {

            JLabel dateLabel = new JLabel(String.format(ownMessage ? "Added %s" : "Received %s",
                    Formatter.formatShortDateTimeNoTz(new Date(message.getDate()))));
            dateLabel.setFont(dateLabel.getFont().deriveFont(9.0f).deriveFont(Font.PLAIN));
            dateLabel.setHorizontalAlignment(SwingConstants.CENTER);
            dateLabel.setForeground(Color.LIGHT_GRAY);
            messagesPanel.add(dateLabel,
                    new GridBagConstraints(0, y++, 1, 1, 1.0, 0.0, NORTH, HORIZONTAL, insets2, 0, 0));
        }

        // Add a chat message field
        JPanel msg = new JPanel();
        msg.setBorder(new ChatMessageBorder(message, ownMessage));
        JLabel msgLabel = new ChatMessageLabel(message.getMessage(), ownMessage);
        msg.add(msgLabel);
        messagesPanel.add(msg, new GridBagConstraints(0, y++, 1, 1, 1.0, 0.0, NORTH, HORIZONTAL, insets, 0, 0));

        lastMessageTime = message.getDate();
    }

    // Scroll to the bottom
    validate();
    scrollPane.getVerticalScrollBar().setValue(scrollPane.getVerticalScrollBar().getMaximum());
    messagesPanel.repaint();

    // } else if (chatData == null && noDataComponent != null) {
    // // The noDataComponent may e.g. be a message
    // messagesPanel.add(noDataComponent, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, NORTH, BOTH, insets, 0, 0));
    // }
}

From source file:com.sshtools.appframework.ui.SshToolsApplicationFrame.java

/**
 * @param application//from  w w  w . j  a v  a  2s. com
 * @param panel
 * 
 * @throws SshToolsApplicationException
 */

public void init(final SshToolsApplication application, SshToolsApplicationPanel panel)
        throws SshToolsApplicationException {
    log.debug("Initialising frame");
    this.panel = panel;
    this.application = application;
    if (application != null) {
        setTitle(application.getApplicationName() + " - " + application.getApplicationVersion());
    }
    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    // Register the File menu
    panel.registerActionMenu(new ActionMenu("File", "File", 'f', 0));
    // Register the Exit action
    if (showExitAction && application != null) {
        panel.registerAction(exitAction = new ExitAction(application, this));
        // Register the New Window Action
    }
    if (showNewWindowAction && application != null) {
        panel.registerAction(newWindowAction = new NewWindowAction(application));
        // Register the Help menu
    }
    panel.registerActionMenu(new ActionMenu("Help", "Help", 'h', 99));
    // Register the About box action
    if (showAboutBox && application != null) {
        panel.registerAction(aboutAction = new AboutAction(this, application));
    }

    getApplicationPanel().rebuildActionComponents();
    // JPanel p = new JPanel(new ToolBarLayout());
    JPanel p = new JPanel(new BorderLayout(0, 0));
    JPanel center = new JPanel(new BorderLayout(0, 0));
    if (panel.getJMenuBar() != null) {
        setJMenuBar(panel.getJMenuBar());
    }

    if (panel.getToolBar() != null) {
        // center.add(toolSeparator = new JSeparator(JSeparator.HORIZONTAL),
        // BorderLayout.NORTH);
        // toolSeparator.setVisible(panel.getToolBar().isVisible());
        // panel.getToolBar().addComponentListener(new ComponentAdapter() {
        // public void componentShown(ComponentEvent e) {
        // toolSeparator.setVisible(SshToolsApplicationFrame.this.panel.getToolBar().isVisible());
        // }
        //
        // public void componentHidden(ComponentEvent e) {
        // toolSeparator.setVisible(SshToolsApplicationFrame.this.panel.getToolBar().isVisible());
        // }
        //
        // });
        final SshToolsApplicationPanel pnl = panel;
        panel.getToolBar().addComponentListener(new ComponentAdapter() {

            public void componentHidden(ComponentEvent evt) {
                // toolSeparator.setVisible(pnl.getToolBar().isVisible());

            }

        });
        p.add(panel.getToolBar(), BorderLayout.NORTH);
    }
    center.add(panel, BorderLayout.CENTER);
    p.add(center, BorderLayout.CENTER);
    getContentPane().setLayout(new GridLayout(1, 1, 0, 0));
    getContentPane().add(p);
    // Watch for the frame closing
    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    addWindowListener(new WindowAdapter() {

        public void windowClosing(WindowEvent evt) {
            if (application != null) {
                application.closeContainer(SshToolsApplicationFrame.this);
            } else {
                int confirm = JOptionPane.showOptionDialog(SshToolsApplicationFrame.this,
                        "Close " + getTitle() + "?", "Close Operation", JOptionPane.YES_NO_OPTION,
                        JOptionPane.QUESTION_MESSAGE, null, null, null);
                if (confirm == 0) {
                    hide();
                }
            }

        }

    });
    // If this is the first frame, center the window on the screen
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    boolean found = false;
    if (application != null && application.getContainerCount() != 0) {
        for (int i = 0; (i < application.getContainerCount()) && !found; i++) {
            SshToolsApplicationContainer c = application.getContainerAt(i);
            if (c instanceof SshToolsApplicationFrame) {
                SshToolsApplicationFrame f = (SshToolsApplicationFrame) c;
                setSize(f.getSize());
                Point newLocation = new Point(f.getX(), f.getY());
                newLocation.x += 48;
                newLocation.y += 48;
                if (newLocation.x > (screenSize.getWidth() - 64)) {
                    newLocation.x = 0;
                }
                if (newLocation.y > (screenSize.getHeight() - 64)) {
                    newLocation.y = 0;
                }
                setLocation(newLocation);
                found = true;
            }
        }
    }
    if (!found) {
        // Is there a previous stored geometry we can use?
        if (PreferencesStore.preferenceExists(PREF_LAST_FRAME_GEOMETRY)) {
            setBounds(PreferencesStore.getRectangle(PREF_LAST_FRAME_GEOMETRY, getBounds()));
        } else {
            pack();
            setSize(800, 600);
            UIUtil.positionComponent(SwingConstants.CENTER, this);
        }
    }
    log.debug("Initialisation of frame complete");
}

From source file:com.tascape.qa.th.android.driver.App.java

/**
 * The method starts a GUI to let an user inspect element tree and take screenshot when the user is interacting
 * with the app-under-test manually. Please make sure to set timeout long enough for manual interaction.
 *
 * @param timeoutMinutes timeout in minutes to fail the manual steps
 *
 * @throws Exception if case of error/*from  w ww .ja  v a 2  s  .c  o m*/
 */
public void interactManually(int timeoutMinutes) throws Exception {
    LOG.info("Start manual UI interaction");
    long end = System.currentTimeMillis() + timeoutMinutes * 60000L;

    AtomicBoolean visible = new AtomicBoolean(true);
    AtomicBoolean pass = new AtomicBoolean(false);
    String tName = Thread.currentThread().getName() + "m";
    SwingUtilities.invokeLater(() -> {
        JDialog jd = new JDialog((JFrame) null, "Manual Device UI Interaction - " + device.getProductDetail());
        jd.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);

        JPanel jpContent = new JPanel(new BorderLayout());
        jd.setContentPane(jpContent);
        jpContent.setPreferredSize(new Dimension(1088, 828));
        jpContent.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

        JPanel jpInfo = new JPanel();
        jpContent.add(jpInfo, BorderLayout.PAGE_START);
        jpInfo.setLayout(new BorderLayout());
        {
            JButton jb = new JButton("PASS");
            jb.setForeground(Color.green.darker());
            jb.setFont(jb.getFont().deriveFont(Font.BOLD));
            jpInfo.add(jb, BorderLayout.LINE_START);
            jb.addActionListener(event -> {
                pass.set(true);
                jd.dispose();
                visible.set(false);
            });
        }
        {
            JButton jb = new JButton("FAIL");
            jb.setForeground(Color.red);
            jb.setFont(jb.getFont().deriveFont(Font.BOLD));
            jpInfo.add(jb, BorderLayout.LINE_END);
            jb.addActionListener(event -> {
                pass.set(false);
                jd.dispose();
                visible.set(false);
            });
        }

        JLabel jlTimeout = new JLabel("xxx seconds left", SwingConstants.CENTER);
        jpInfo.add(jlTimeout, BorderLayout.CENTER);
        jpInfo.add(jlTimeout, BorderLayout.CENTER);
        new SwingWorker<Long, Long>() {
            @Override
            protected Long doInBackground() throws Exception {
                while (System.currentTimeMillis() < end) {
                    Thread.sleep(1000);
                    long left = (end - System.currentTimeMillis()) / 1000;
                    this.publish(left);
                }
                return 0L;
            }

            @Override
            protected void process(List<Long> chunks) {
                Long l = chunks.get(chunks.size() - 1);
                jlTimeout.setText(l + " seconds left");
                if (l < 850) {
                    jlTimeout.setForeground(Color.red);
                }
            }
        }.execute();

        JPanel jpResponse = new JPanel(new BorderLayout());
        JPanel jpProgress = new JPanel(new BorderLayout());
        jpResponse.add(jpProgress, BorderLayout.PAGE_START);

        JTextArea jtaJson = new JTextArea();
        jtaJson.setEditable(false);
        jtaJson.setTabSize(4);
        Font font = jtaJson.getFont();
        jtaJson.setFont(new Font("Courier New", font.getStyle(), font.getSize()));

        JTree jtView = new JTree();

        JTabbedPane jtp = new JTabbedPane();
        jtp.add("tree", new JScrollPane(jtView));
        jtp.add("json", new JScrollPane(jtaJson));

        jpResponse.add(jtp, BorderLayout.CENTER);

        JPanel jpScreen = new JPanel();
        jpScreen.setMinimumSize(new Dimension(200, 200));
        jpScreen.setLayout(new BoxLayout(jpScreen, BoxLayout.PAGE_AXIS));
        JScrollPane jsp1 = new JScrollPane(jpScreen);
        jpResponse.add(jsp1, BorderLayout.LINE_START);

        JPanel jpJs = new JPanel(new BorderLayout());
        JTextArea jtaJs = new JTextArea();
        jpJs.add(new JScrollPane(jtaJs), BorderLayout.CENTER);

        JSplitPane jSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, jpResponse, jpJs);
        jSplitPane.setResizeWeight(0.88);
        jpContent.add(jSplitPane, BorderLayout.CENTER);

        JPanel jpLog = new JPanel();
        jpLog.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
        jpLog.setLayout(new BoxLayout(jpLog, BoxLayout.LINE_AXIS));

        JCheckBox jcbTap = new JCheckBox("Enable Click", null, false);
        jpLog.add(jcbTap);
        jpLog.add(Box.createHorizontalStrut(8));

        JButton jbLogUi = new JButton("Log Screen");
        jpResponse.add(jpLog, BorderLayout.PAGE_END);
        {
            jpLog.add(jbLogUi);
            jbLogUi.addActionListener((ActionEvent event) -> {
                jtaJson.setText("waiting for screenshot...");
                Thread t = new Thread(tName) {
                    @Override
                    public void run() {
                        LOG.debug("\n\n");
                        try {
                            WindowHierarchy wh = device.loadWindowHierarchy();
                            jtView.setModel(getModel(wh));

                            jtaJson.setText("");
                            jtaJson.append(wh.root.toJson().toString(2));
                            jtaJson.append("\n");

                            File png = device.takeDeviceScreenshot();
                            BufferedImage image = ImageIO.read(png);

                            int w = device.getDisplayWidth();
                            int h = device.getDisplayHeight();

                            BufferedImage resizedImg = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
                            Graphics2D g2 = resizedImg.createGraphics();
                            g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
                                    RenderingHints.VALUE_INTERPOLATION_BILINEAR);
                            g2.drawImage(image, 0, 0, w, h, null);
                            g2.dispose();

                            JLabel jLabel = new JLabel(new ImageIcon(resizedImg));
                            jpScreen.removeAll();
                            jsp1.setPreferredSize(new Dimension(w + 30, h));
                            jpScreen.add(jLabel);

                            jLabel.addMouseListener(new MouseAdapter() {
                                @Override
                                public void mouseClicked(MouseEvent e) {
                                    LOG.debug("clicked at {},{}", e.getPoint().getX(), e.getPoint().getY());
                                    if (jcbTap.isSelected()) {
                                        device.click(e.getPoint().x, e.getPoint().y);
                                        device.waitForIdle();
                                        jbLogUi.doClick();
                                    }
                                }
                            });
                        } catch (Exception ex) {
                            LOG.error("Cannot log screen", ex);
                            jtaJson.append("Cannot log screen");
                        }
                        jtaJson.append("\n\n\n");
                        LOG.debug("\n\n");

                        jd.setSize(jd.getBounds().width + 1, jd.getBounds().height + 1);
                        jd.setSize(jd.getBounds().width - 1, jd.getBounds().height - 1);
                    }
                };
                t.start();
            });
        }
        jpLog.add(Box.createHorizontalStrut(38));
        {
            JButton jbLogMsg = new JButton("Log Message");
            jpLog.add(jbLogMsg);
            JTextField jtMsg = new JTextField(10);
            jpLog.add(jtMsg);
            jtMsg.addFocusListener(new FocusListener() {
                @Override
                public void focusLost(final FocusEvent pE) {
                }

                @Override
                public void focusGained(final FocusEvent pE) {
                    jtMsg.selectAll();
                }
            });
            jtMsg.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(java.awt.event.KeyEvent e) {
                    if (e.getKeyCode() == java.awt.event.KeyEvent.VK_ENTER) {
                        jbLogMsg.doClick();
                    }
                }
            });
            jbLogMsg.addActionListener(event -> {
                Thread t = new Thread(tName) {
                    @Override
                    public void run() {
                        String msg = jtMsg.getText();
                        if (StringUtils.isNotBlank(msg)) {
                            LOG.info("{}", msg);
                            jtMsg.selectAll();
                        }
                    }
                };
                t.start();
                try {
                    t.join();
                } catch (InterruptedException ex) {
                    LOG.error("Cannot take screenshot", ex);
                }
                jtMsg.requestFocus();
            });
        }
        jpLog.add(Box.createHorizontalStrut(38));
        {
            JButton jbClear = new JButton("Clear");
            jpLog.add(jbClear);
            jbClear.addActionListener(event -> {
                jtaJson.setText("");
            });
        }

        JPanel jpAction = new JPanel();
        jpContent.add(jpAction, BorderLayout.PAGE_END);
        jpAction.setLayout(new BoxLayout(jpAction, BoxLayout.LINE_AXIS));
        jpJs.add(jpAction, BorderLayout.PAGE_END);

        jd.pack();
        jd.setVisible(true);
        jd.setLocationRelativeTo(null);

        jbLogUi.doClick();
    });

    while (visible.get()) {
        if (System.currentTimeMillis() > end) {
            LOG.error("Manual UI interaction timeout");
            break;
        }
        Thread.sleep(500);
    }

    if (pass.get()) {
        LOG.info("Manual UI Interaction returns PASS");
    } else {
        Assert.fail("Manual UI Interaction returns FAIL");
    }
}

From source file:drusy.ui.panels.InternetStatePanel.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Evaluation license - Kvin Renella
    headerPanel = new JPanel();
    label1 = new JLabel();
    mainPanel = new JPanel();
    ipv4TitleLabel = new JLabel();
    ipv4ContentLabel = new JTextField();
    connectionStateTitleLabel = new JLabel();
    connectionStateContentLabel = new JTextField();
    downloadContentLabel = new JTextField();
    downloadTitleLabel = new JLabel();
    maxUploadTitleLabel = new JLabel();
    maxUploadContentLabel = new JTextField();
    maxDownloadTitleLabel = new JLabel();
    maxDownloadContentLabel = new JTextField();
    uploadTitleLabel = new JLabel();
    uploadContentLabel = new JTextField();
    ipv6ContentLabel = new JTextField();
    ipv6TitleLabel = new JLabel();
    uptimeContentLabel = new JTextField();
    uptimeTitleLabel = new JLabel();

    //======== this ========
    setMinimumSize(new Dimension(100, 71));

    setLayout(new BorderLayout());

    //======== headerPanel ========
    {//from  w  w  w.j a va2 s.c o m
        headerPanel.setLayout(new BorderLayout());

        //---- label1 ----
        label1.setText("This panel shows you an overview of the internet connection");
        label1.setHorizontalAlignment(SwingConstants.CENTER);
        headerPanel.add(label1, BorderLayout.CENTER);
    }
    add(headerPanel, BorderLayout.NORTH);

    //======== mainPanel ========
    {
        mainPanel.setOpaque(false);
        mainPanel.setMinimumSize(new Dimension(100, 100));

        //---- ipv4TitleLabel ----
        ipv4TitleLabel.setText("IP v4 :");
        ipv4TitleLabel.setHorizontalAlignment(SwingConstants.RIGHT);

        //---- ipv4ContentLabel ----
        ipv4ContentLabel.setEditable(false);
        ipv4ContentLabel.setText("192.168.0.1");
        ipv4ContentLabel.setHorizontalAlignment(SwingConstants.CENTER);

        //---- connectionStateTitleLabel ----
        connectionStateTitleLabel.setText("Connection State :");
        connectionStateTitleLabel.setHorizontalAlignment(SwingConstants.RIGHT);

        //---- connectionStateContentLabel ----
        connectionStateContentLabel.setEditable(false);
        connectionStateContentLabel.setText("up");
        connectionStateContentLabel.setHorizontalAlignment(SwingConstants.CENTER);

        //---- downloadContentLabel ----
        downloadContentLabel.setEditable(false);
        downloadContentLabel.setText("- ko/s");
        downloadContentLabel.setHorizontalAlignment(SwingConstants.CENTER);

        //---- downloadTitleLabel ----
        downloadTitleLabel.setText("Download Bandwidth :");
        downloadTitleLabel.setHorizontalAlignment(SwingConstants.RIGHT);

        //---- maxUploadTitleLabel ----
        maxUploadTitleLabel.setText("Max Upload Bandwidth :");
        maxUploadTitleLabel.setHorizontalAlignment(SwingConstants.RIGHT);

        //---- maxUploadContentLabel ----
        maxUploadContentLabel.setEditable(false);
        maxUploadContentLabel.setText("- ko/s");
        maxUploadContentLabel.setHorizontalAlignment(SwingConstants.CENTER);

        //---- maxDownloadTitleLabel ----
        maxDownloadTitleLabel.setText("Max Download Bandwidth :");
        maxDownloadTitleLabel.setHorizontalAlignment(SwingConstants.RIGHT);

        //---- maxDownloadContentLabel ----
        maxDownloadContentLabel.setEditable(false);
        maxDownloadContentLabel.setText("- ko/s");
        maxDownloadContentLabel.setHorizontalAlignment(SwingConstants.CENTER);

        //---- uploadTitleLabel ----
        uploadTitleLabel.setText("Upload Bandwidth :");
        uploadTitleLabel.setHorizontalAlignment(SwingConstants.RIGHT);

        //---- uploadContentLabel ----
        uploadContentLabel.setEditable(false);
        uploadContentLabel.setText("- ko/s");
        uploadContentLabel.setHorizontalAlignment(SwingConstants.CENTER);

        //---- ipv6ContentLabel ----
        ipv6ContentLabel.setEditable(false);
        ipv6ContentLabel.setText("::1:");
        ipv6ContentLabel.setHorizontalAlignment(SwingConstants.CENTER);

        //---- ipv6TitleLabel ----
        ipv6TitleLabel.setText("IP v6 :");
        ipv6TitleLabel.setHorizontalAlignment(SwingConstants.RIGHT);

        //---- uptimeContentLabel ----
        uptimeContentLabel.setEditable(false);
        uptimeContentLabel.setText("0 min");
        uptimeContentLabel.setHorizontalAlignment(SwingConstants.CENTER);

        //---- uptimeTitleLabel ----
        uptimeTitleLabel.setText("Uptime :");
        uptimeTitleLabel.setHorizontalAlignment(SwingConstants.RIGHT);

        GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(mainPanelLayout.createParallelGroup()
                .addGroup(mainPanelLayout.createSequentialGroup().addContainerGap()
                        .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
                                .addComponent(connectionStateTitleLabel).addComponent(downloadTitleLabel)
                                .addComponent(ipv4TitleLabel).addComponent(maxUploadTitleLabel)
                                .addComponent(maxDownloadTitleLabel).addComponent(uploadTitleLabel)
                                .addComponent(ipv6TitleLabel).addComponent(uptimeTitleLabel))
                        .addGap(10, 10, 10)
                        .addGroup(mainPanelLayout.createParallelGroup()
                                .addComponent(ipv4ContentLabel, GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE)
                                .addComponent(connectionStateContentLabel, GroupLayout.DEFAULT_SIZE, 244,
                                        Short.MAX_VALUE)
                                .addComponent(downloadContentLabel, GroupLayout.DEFAULT_SIZE, 244,
                                        Short.MAX_VALUE)
                                .addComponent(maxUploadContentLabel, GroupLayout.DEFAULT_SIZE, 244,
                                        Short.MAX_VALUE)
                                .addComponent(maxDownloadContentLabel, GroupLayout.DEFAULT_SIZE, 244,
                                        Short.MAX_VALUE)
                                .addComponent(uploadContentLabel, GroupLayout.DEFAULT_SIZE, 244,
                                        Short.MAX_VALUE)
                                .addComponent(ipv6ContentLabel, GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE)
                                .addComponent(uptimeContentLabel, GroupLayout.DEFAULT_SIZE, 244,
                                        Short.MAX_VALUE))
                        .addContainerGap()));
        mainPanelLayout.setVerticalGroup(mainPanelLayout.createParallelGroup()
                .addGroup(mainPanelLayout.createSequentialGroup().addGap(20, 20, 20)
                        .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                .addComponent(ipv4TitleLabel, GroupLayout.PREFERRED_SIZE, 22,
                                        GroupLayout.PREFERRED_SIZE)
                                .addComponent(ipv4ContentLabel, GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                .addComponent(ipv6TitleLabel, GroupLayout.PREFERRED_SIZE, 22,
                                        GroupLayout.PREFERRED_SIZE)
                                .addComponent(ipv6ContentLabel, GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                .addComponent(connectionStateTitleLabel, GroupLayout.PREFERRED_SIZE, 22,
                                        GroupLayout.PREFERRED_SIZE)
                                .addComponent(connectionStateContentLabel, GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                .addComponent(uploadTitleLabel, GroupLayout.PREFERRED_SIZE, 22,
                                        GroupLayout.PREFERRED_SIZE)
                                .addComponent(uploadContentLabel, GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                .addComponent(maxUploadTitleLabel, GroupLayout.PREFERRED_SIZE, 22,
                                        GroupLayout.PREFERRED_SIZE)
                                .addComponent(maxUploadContentLabel, GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                .addComponent(downloadTitleLabel, GroupLayout.PREFERRED_SIZE, 22,
                                        GroupLayout.PREFERRED_SIZE)
                                .addComponent(downloadContentLabel, GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                .addComponent(maxDownloadTitleLabel, GroupLayout.PREFERRED_SIZE, 22,
                                        GroupLayout.PREFERRED_SIZE)
                                .addComponent(maxDownloadContentLabel, GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                .addComponent(uptimeTitleLabel, GroupLayout.PREFERRED_SIZE, 22,
                                        GroupLayout.PREFERRED_SIZE)
                                .addComponent(uptimeContentLabel, GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                        .addContainerGap()));
    }
    add(mainPanel, BorderLayout.CENTER);
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}