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:de.tor.tribes.ui.views.DSWorkbenchMarkerFrame.java

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

    jXMarkerPanel = new org.jdesktop.swingx.JXPanel();
    jMarkerTabPane = new javax.swing.JTabbedPane();
    jNewPlanPanel = new javax.swing.JPanel();
    jLabel3 = new javax.swing.JLabel();
    jMarkerFrameAlwaysOnTop = new javax.swing.JCheckBox();
    jMarkersPanel = new javax.swing.JPanel();
    capabilityInfoPanel1 = new de.tor.tribes.ui.components.CapabilityInfoPanel();

    jXMarkerPanel.setLayout(new java.awt.BorderLayout());
    jXMarkerPanel.add(jMarkerTabPane, java.awt.BorderLayout.CENTER);

    jNewPlanPanel.setOpaque(false);
    jNewPlanPanel.setLayout(new java.awt.BorderLayout());

    jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/ui/document_new_24x24.png"))); // NOI18N
    jLabel3.setToolTipText("Leeres Markierungsset erstellen");
    jLabel3.setEnabled(false);
    jLabel3.setMaximumSize(new java.awt.Dimension(40, 40));
    jLabel3.setMinimumSize(new java.awt.Dimension(40, 40));
    jLabel3.setPreferredSize(new java.awt.Dimension(40, 40));
    jLabel3.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseEntered(java.awt.event.MouseEvent evt) {
            fireEnterEvent(evt);
        }

        public void mouseExited(java.awt.event.MouseEvent evt) {
            fireMouseExitEvent(evt);
        }

        public void mouseReleased(java.awt.event.MouseEvent evt) {
            fireCreateMarkerSetEvent(evt);
        }
    });
    jNewPlanPanel.add(jLabel3, java.awt.BorderLayout.CENTER);

    setTitle("Markierungen");
    setMinimumSize(new java.awt.Dimension(400, 300));
    getContentPane().setLayout(new java.awt.GridBagLayout());

    jMarkerFrameAlwaysOnTop.setText("Immer im Vordergrund");
    jMarkerFrameAlwaysOnTop.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            fireMarkerFrameOnTopEvent(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    getContentPane().add(jMarkerFrameAlwaysOnTop, gridBagConstraints);

    jMarkersPanel.setBackground(new java.awt.Color(239, 235, 223));
    jMarkersPanel.setLayout(new java.awt.BorderLayout());
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    getContentPane().add(jMarkersPanel, gridBagConstraints);

    capabilityInfoPanel1.setSearchable(false);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    getContentPane().add(capabilityInfoPanel1, gridBagConstraints);

    pack();
}

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.imagem.PanelDescricaoImagens.java

private void initComponentsEscalavel(ArrayList<FerramentaDescricaoModel> erros) {
    Ferramenta_Imagens.carregaTexto(TokenLang.LANG);
    JPanel regraFonteBtn = new JPanel();
    regraFonteBtn.setLayout(new BorderLayout());

    textAreaSourceCode = new G_TextAreaSourceCode();
    textAreaSourceCode.setTipoHTML();// w w w .j a va 2  s.co  m
    new OnChange(textAreaSourceCode, this);

    // parentFrame.setTitle("Associador de rtulos");
    tableLinCod = new TabelaDescricao(this, erros);
    arTextPainelCorrecao = new ArTextPainelCorrecao(this);

    // scrollPaneCorrecaoLabel = new ConteudoCorrecaoLabel();
    analiseSistematica = new JButton();
    salvar = new JButton();
    abrir = new JButton();
    cancelar = new JButton();
    strConteudoalt = new String();
    // panelLegenda = new JPanel();
    btnSalvar = new JMenuItem(GERAL.BTN_SALVAR);

    pnRegra = new JPanel();
    lbRegras1 = new JLabel();
    lbRegras2 = new JLabel();
    pnSetaDescricao = new JPanel();
    spTextoDescricao = new JScrollPane();
    tArParticipRotulo = new TArParticipRotulo(this);
    conteudoDoAlt = new JTextArea();
    pnListaErros = new JPanel();
    scrollPanetabLinCod = new JScrollPane();
    /**
     * Mostra pro usurio a imagem que est sem descrio
     */
    imagemSemDesc = new XHTMLPanel();

    pnBotoes = new JPanel();
    salvar.setEnabled(false);
    salvaAlteracoes = TxtBuffer.getInstanciaSalvaAlteracoes(textAreaSourceCode.getTextPane(), salvar,
            new JMenuItem(), parentFrame);
    adicionar = new JButton();
    aplicar = new JButton();
    conteudoParticRotulo = new ArrayList<String>();
    analiseSistematica.setEnabled(false);
    // setJMenuBar(this.criaMenuBar());
    // ======== this ========
    // setTitle("Associe explicitamente os r\u00f3tulos aos respectivos
    // controles:");

    setBackground(CoresDefault.getCorPaineis());
    Container contentPane = this;// ??
    contentPane.setLayout(new GridLayout(2, 1));

    // ======== pnRegra ========
    {
        pnRegra.setBorder(criaBorda(Ferramenta_Imagens.TITULO_REGRA));
        pnRegra.setLayout(new GridLayout(2, 1));
        pnRegra.add(lbRegras1);
        lbRegras1.setText(Ferramenta_Imagens.REGRAP1);
        lbRegras2.setText(Ferramenta_Imagens.REGRAP2);
        lbRegras1.setHorizontalAlignment(SwingConstants.CENTER);
        lbRegras2.setHorizontalAlignment(SwingConstants.CENTER);
        pnRegra.add(lbRegras1);
        pnRegra.add(lbRegras2);
        pnRegra.setPreferredSize(new Dimension(700, 60));
    }

    // G_URLIcon.setIcon(lbTemp,
    // "http://pitecos.blogs.sapo.pt/arquivo/pai%20natal%20o5.%20jpg.jpg");
    JScrollPane sp = new JScrollPane();

    sp.setViewportView(imagemSemDesc);
    sp.setPreferredSize(new Dimension(500, 300));

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

    // ---- Salvar ----
    salvar.setText(Ferramenta_Imagens.BTN_SALVAR);
    salvar.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            salvarActionPerformed(e);
        }
    });

    salvar.setToolTipText(Ferramenta_Imagens.DICA_SALVAR);
    salvar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_SALVAR);
    salvar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_SALVAR);
    salvar.setBounds(10, 0, 150, 25);

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

    abrir.setToolTipText(Ferramenta_Imagens.DICA_ABRIR_HTML);
    abrir.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_ABRIR_HTML);
    abrir.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.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.TELA_ANTERIOR);
    cancelar.setBounds(320, 0, 150, 25);

    analiseSistematica.setText(GERAL.ANALISE_SISTEMATICA);
    analiseSistematica.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            buttonAction = e;
            Thread t = new Thread(new Runnable() {
                public void run() {
                    PainelStatusBar.showProgTarReq();
                    parentFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
                    analiseSistematicaActionPerformed(buttonAction);
                    parentFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
                    PainelStatusBar.hideProgTarReq();
                }
            });
            t.setPriority(9);
            t.start();

        }
    });

    analiseSistematica.setToolTipText(GERAL.DICA_ANALISE_SISTEMATICA);
    analiseSistematica.getAccessibleContext().setAccessibleDescription(GERAL.DICA_ANALISE_SISTEMATICA);
    analiseSistematica.getAccessibleContext().setAccessibleName(GERAL.DICA_ANALISE_SISTEMATICA);
    analiseSistematica.setBounds(480, 0, 150, 25);
    // ======== pnParticRotulo ========

    pnSetaDescricao.setBorder(criaBorda(Ferramenta_Imagens.TITULO_DIGITE_O_ALT));
    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);
    conteudoDoAlt.addKeyListener(new KeyListener() {
        public void keyPressed(KeyEvent arg0) {
        }

        public void keyTyped(KeyEvent arg0) {
        }

        public void keyReleased(KeyEvent arg0) {
            if (conteudoDoAlt.getText().length() == 0) {
                System.out.println("conteudo vazio");
                aplicar.setEnabled(false);

            } else if (tableLinCod.getSelectedRow() != -1) {
                System.out.println("com conteudo");
                aplicar.setEnabled(true);

            }
        }
    });
    // ======== spParticRotulo ========
    {
        spTextoDescricao.setViewportView(conteudoDoAlt);
    }

    // lbRegras1.setText(Reparo_Imagens.REGRAP2);
    // lbRegras1.setHorizontalAlignment(SwingConstants.CENTER);

    // pnRegra.add(lbRegras1);

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

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

        pnListaErros.setBorder(criaBorda(Ferramenta_Imagens.LISTA_ERROS));
        pnListaErros.setLayout(new BorderLayout());
        // ======== scrollPanetabLinCod ========
        {
            scrollPanetabLinCod.setViewportView(tableLinCod);
        }
        pnListaErros.add(scrollPanetabLinCod, BorderLayout.CENTER);
    }
    // ======== pnBotoes ========
    {

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

        pnBotoes.setLayout(null);
        // ---- adicionar ----
        adicionar.setText(Ferramenta_Imagens.BTN_ADICIONAR);
        adicionar.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                adicionarActionPerformed(e);
            }
        });

        adicionar.setToolTipText(Ferramenta_Imagens.DICA_ADICIONAR);
        adicionar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_ADICIONAR);
        adicionar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_ADICIONAR);
        adicionar.setBounds(10, 5, 150, 25);
        // pnBotoes.add(adicionar);

        // ---- aplicarRotulo ----
        aplicar.setEnabled(false);
        aplicar.setText(Ferramenta_Imagens.BTN_APLICAR);
        aplicar.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {

                aplicarRotuloActionPerformed(e);
            }
        });

        aplicar.setToolTipText(Ferramenta_Imagens.DICA_APLICAR);
        aplicar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_APLICAR);
        aplicar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_APLICAR);
        aplicar.setBounds(10, 5, 150, 25);
        pnBotoes.add(aplicar);
    }

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

    JSplitPane splitPane = null;

    Dimension minimumSize = new Dimension(0, 0);
    // JScrollPane ajudaScrollPane = new
    // JScrollPane(ajuda,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    sp.setMinimumSize(minimumSize);
    sp.setPreferredSize(new Dimension(150, 90));
    splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sp, textAreaSourceCode);
    splitPane.setOneTouchExpandable(true);
    // splitPane.set
    // splitPane.setDividerLocation(0.95);
    int w = parentFrame.getWidth();
    int s = w / 4;
    splitPane.setDividerLocation(s);

    // regraFonteBtn.add(scrollPaneCorrecaoLabel, BorderLayout.CENTER);
    regraFonteBtn.add(splitPane, BorderLayout.CENTER);
    pnBotoes.setPreferredSize(new Dimension(600, 35));
    pnBotoes.setBackground(CoresDefault.getCorPaineis());
    // regraFonteBtn.add(pnBotoes, BorderLayout.SOUTH);
    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);
    JPanel pnSalvarCancelar = new JPanel();
    pnSalvarCancelar.setLayout(null);
    pnSalvarCancelar.setPreferredSize(new Dimension(600, 35));
    pnSalvarCancelar.add(salvar);
    pnSalvarCancelar.add(abrir);
    pnSalvarCancelar.add(cancelar);
    if (!original) {
        reverter = new JButton("Reverter");
        reverter.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                setVisible(false);
                TxtBuffer.setContent(TxtBuffer.getContentOriginal());
                parentFrame.showPainelFerramentaImgPArq(TxtBuffer.getContentOriginal(), enderecoPagina);
                setVisible(true);
            }
        });
        //reverter.setActionCommand("Reverter");
        reverter.setText(TradPainelRelatorio.REVERTER);
        reverter.setToolTipText(TradPainelRelatorio.DICA_REVERTER);
        reverter.getAccessibleContext().setAccessibleDescription(TradPainelRelatorio.DICA_REVERTER);
        reverter.getAccessibleContext().setAccessibleName(TradPainelRelatorio.DICA_REVERTER);
        if (EstadoSilvinha.conteudoEmPainelResumo) {
            reverter.setBounds(640, 0, 150, 25);
        } else {
            reverter.setBounds(480, 0, 150, 25);
        }
        pnSalvarCancelar.add(reverter);
    }

    if (EstadoSilvinha.conteudoEmPainelResumo) {
        pnSalvarCancelar.add(analiseSistematica);
    }
    pnSalvarCancelar.setBackground(CoresDefault.getCorPaineis());
    textoErrosBtn.add(pnSalvarCancelar, BorderLayout.SOUTH);
    pnListaErros.setBackground(CoresDefault.getCorPaineis());
    textoErrosBtn.add(pnListaErros, BorderLayout.CENTER);
    if (tableLinCod.getRowCount() == 0)
        tableLinCod.addLinha(0, 0, GERAL.DOC_SEM_ERROS);
    contentPane.setBackground(CoresDefault.getCorPaineis());
    contentPane.add(textoErrosBtn);

    this.setVisible(true);

}

From source file:Classes.MainForm.java

private void initMainForm() throws IOException {//create sally form
    switch (getPrayerTimesHandler().getActualPrayerTime()) {//set background
    case 0:// w w w.jav a  2s .  co  m
        this.backgroundImage = new ImageIcon(getClass().getResource(duhrBackground)).getImage();
        break;
    case 1:
        this.backgroundImage = new ImageIcon(getClass().getResource(shorou9Background)).getImage();
        break;
    case 2:
        this.backgroundImage = new ImageIcon(getClass().getResource(fajrBackground)).getImage();
        break;
    case 3:
        this.backgroundImage = new ImageIcon(getClass().getResource(ishaaBackground)).getImage();
        break;
    case 4:
        this.backgroundImage = new ImageIcon(getClass().getResource(maghribBackground)).getImage();
        break;
    case 5:
        this.backgroundImage = new ImageIcon(getClass().getResource(asrBackground)).getImage();
        break;
    default:
        this.backgroundImage = new ImageIcon(getClass().getResource(shorou9Background)).getImage();
        break;
    }
    this.mainFrame = new JFrame();
    this.mainPanel = new MainImagePanel(getBackgroundImage(), prayerTimesHandler.getActualPrayerTime());
    this.mainPanel.setLayout(null);
    this.font = new Font("TimesRoman", Font.ITALIC, 15);
    this.locationFont = new Font("TimesRoman", Font.ITALIC, 22);
    this.digitalClockfont = new Font("TimesRoman", Font.ROMAN_BASELINE, 20);
    this.fontMiladiHijriTimes = new Font("TimesRoman", Font.ROMAN_BASELINE, 13);
    this.fontNextPrayer = new Font("TimesRoman", Font.ROMAN_BASELINE, 20);
    this.exitLabel = new JLabel();
    this.hijriTime = new JLabel("", SwingConstants.RIGHT);
    this.miladiTime = new JLabel();
    this.location = new JLabel(locationValue);
    this.location.setHorizontalAlignment(SwingConstants.CENTER);
    this.locationFromInternet = new JLabel();

    //get all translated salat names
    this.fajrName = new JLabel(PropertiesHandler.getSingleton().getValue(1020));
    this.fajrName.setHorizontalAlignment(SwingConstants.CENTER);
    this.fajrTime = new JLabel();
    this.fajrTime.setHorizontalAlignment(SwingConstants.CENTER);
    this.shorou9Name = new JLabel(PropertiesHandler.getSingleton().getValue(1021));
    this.shorou9Name.setHorizontalAlignment(SwingConstants.CENTER);
    this.shorou9Time = new JLabel();
    this.shorou9Time.setHorizontalAlignment(SwingConstants.CENTER);
    this.duhrName = new JLabel(PropertiesHandler.getSingleton().getValue(1022));
    this.duhrName.setHorizontalAlignment(SwingConstants.CENTER);
    this.duhrTime = new JLabel();
    this.duhrTime.setHorizontalAlignment(SwingConstants.CENTER);
    this.asrName = new JLabel(PropertiesHandler.getSingleton().getValue(1023));
    this.asrName.setHorizontalAlignment(SwingConstants.CENTER);
    this.asrTime = new JLabel();
    this.asrTime.setHorizontalAlignment(SwingConstants.CENTER);
    this.maghribName = new JLabel(PropertiesHandler.getSingleton().getValue(1024));
    this.maghribName.setHorizontalAlignment(SwingConstants.CENTER);
    this.maghribTime = new JLabel();
    this.maghribTime.setHorizontalAlignment(SwingConstants.CENTER);
    this.ishaaName = new JLabel(PropertiesHandler.getSingleton().getValue(1025));
    this.ishaaName.setHorizontalAlignment(SwingConstants.CENTER);
    this.ishaaTime = new JLabel();
    this.ishaaTime.setHorizontalAlignment(SwingConstants.CENTER);

    this.digitalClock = new JLabel();
    this.nextPrayer = new JLabel();

    this.settings = new JLabel();

    this.exitLabel.setIcon(exitIcon);
    this.settings.setIcon(settingsIcon);
    this.locationFromInternet.setIcon(locationfromInternetIconMain);

    this.nextDayPrayerTimes = new JLabel(new ImageIcon(getClass().getResource(nextDayPrayerTimesIcon)));
    this.previousDayPrayerTimes = new JLabel(new ImageIcon(getClass().getResource(previousDayPrayerTimesIcon)));
    this.actualDayPrayerTimes = new JLabel(new ImageIcon(getClass().getResource(actualDayPrayerTimesIcon)));

    this.previousDayPrayerTimes.setBounds(480, 275, 15, 15);
    this.actualDayPrayerTimes.setBounds(500, 275, 15, 15);
    this.nextDayPrayerTimes.setBounds(520, 275, 15, 15);

    this.nextDayPrayerTimes.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            nextPreviousDay++;
            Calendar cal = Calendar.getInstance();
            cal.add(Calendar.DATE, nextPreviousDay);
            try {
                PrayersTimes prayerTimes = new PrayersTimes(cal);
                MiladiTime miladiTime = new MiladiTime(cal);
                HijriTime hijriTime = new HijriTime(cal);
                setAllLabelsTimesHijriMiladiValues2(prayerTimes, hijriTime, miladiTime);
            } catch (IOException e1) {
            }
        }
    });
    this.previousDayPrayerTimes.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            nextPreviousDay--;
            Calendar cal = Calendar.getInstance();
            cal.add(Calendar.DATE, nextPreviousDay);
            try {
                PrayersTimes prayerTimes = new PrayersTimes(cal);
                MiladiTime miladiTime = new MiladiTime(cal);
                HijriTime hijriTime = new HijriTime(cal);
                setAllLabelsTimesHijriMiladiValues2(prayerTimes, hijriTime, miladiTime);
            } catch (IOException e1) {
            }
        }
    });
    this.actualDayPrayerTimes.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            try {
                nextPreviousDay = 0;
                setAllLabelsTimesHijriMiladiValues(prayersTimes, hijriTimeObj, miladiTimeObj);
            } catch (IOException e1) {
            } //set all values to all labels
        }
    });

    //set foreground color to all salat names and times
    this.duhrName.setForeground(Color.WHITE);
    this.shorou9Name.setForeground(Color.WHITE);
    this.fajrName.setForeground(Color.WHITE);
    this.ishaaName.setForeground(Color.WHITE);
    this.maghribName.setForeground(Color.WHITE);
    this.asrName.setForeground(Color.WHITE);

    this.duhrTime.setForeground(Color.WHITE);
    this.shorou9Time.setForeground(Color.WHITE);
    this.fajrTime.setForeground(Color.WHITE);
    this.ishaaTime.setForeground(Color.WHITE);
    this.maghribTime.setForeground(Color.WHITE);
    this.asrTime.setForeground(Color.WHITE);
    this.miladiTime.setForeground(Color.WHITE);
    this.hijriTime.setForeground(Color.WHITE);
    this.location.setForeground(Color.WHITE);
    this.digitalClock.setForeground(Color.WHITE);
    this.nextPrayer.setForeground(Color.WHITE);

    //set font to all salat names and times
    this.duhrName.setFont(font);
    this.shorou9Name.setFont(font);
    this.fajrName.setFont(font);
    this.ishaaName.setFont(font);
    this.maghribName.setFont(font);
    this.asrName.setFont(font);
    this.duhrTime.setFont(font);
    this.shorou9Time.setFont(font);
    this.fajrTime.setFont(font);
    this.ishaaTime.setFont(font);
    this.maghribTime.setFont(font);
    this.asrTime.setFont(font);
    this.digitalClock.setFont(digitalClockfont);
    this.nextPrayer.setFont(fontNextPrayer);
    this.miladiTime.setFont(fontMiladiHijriTimes);
    this.hijriTime.setFont(fontMiladiHijriTimes);
    this.location.setFont(locationFont);

    //set position color to all salat names and times
    this.exitLabel.setBounds(510, 0, 40, 40);
    if (UserConfig.getSingleton().getLanguage().equalsIgnoreCase(ar)) {
        this.hijriTime.setBounds(100, 3, 250, 20);
        this.miladiTime.setBounds(20, 3, 250, 20);
    } else {
        this.hijriTime.setBounds(150, 3, 250, 20);
        this.miladiTime.setBounds(5, 3, 250, 20);
    }
    this.location.setBounds(0, 40, 550, 30);

    this.donateLabel = new JLabel(PropertiesHandler.getSingleton().getValue(1106));
    this.donateLabel.setFont(fontMiladiHijriTimes);
    this.donateLabel.setBounds(420, 3, 50, 20);
    this.donateLabel.setForeground(Color.WHITE);
    this.donateLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            String url = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FJDAFTPKN2S2W";
            String os = System.getProperty("os.name").toLowerCase();
            Runtime rt = Runtime.getRuntime();

            try {

                if (os.indexOf("win") >= 0) {

                    // this doesn't support showing urls in the form of "page.html#nameLink" 
                    rt.exec("rundll32 url.dll,FileProtocolHandler " + url);

                } else if (os.indexOf("mac") >= 0) {

                    rt.exec("open " + url);

                } else if (os.indexOf("nix") >= 0 || os.indexOf("nux") >= 0) {

                    // Do a best guess on unix until we get a platform independent way
                    // Build a list of browsers to try, in this order.
                    String[] browsers = { "epiphany", "firefox", "mozilla", "konqueror", "netscape", "opera",
                            "links", "lynx" };

                    // Build a command string which looks like "browser1 "url" || browser2 "url" ||..."
                    StringBuffer cmd = new StringBuffer();
                    for (int i = 0; i < browsers.length; i++)
                        cmd.append((i == 0 ? "" : " || ") + browsers[i] + " \"" + url + "\" ");

                    rt.exec(new String[] { "sh", "-c", cmd.toString() });

                } else {
                }
            } catch (Exception ex) {
            }
        }
    });

    this.locationFromInternet.setBounds(260, 70, 20, 20);
    this.locationFromInternet.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(final MouseEvent e) {
            new Thread(new Runnable() {

                @Override
                public void run() {
                    if (locationFromInternet.isEnabled()) {
                        locationFromInternet.setEnabled(false);
                        locationFromInternet.setIcon(loaderMain);
                        locationFromInternetLabelMouseClicked(e);
                    }
                }
            }).start();
        }
    });

    this.fajrAthan = new JLabel();
    this.fajrAthan.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            try {
                allAthanClickHandler(0);
            } catch (Exception e1) {
            }
        }
    });
    this.shorou9Athan = new JLabel();
    this.shorou9Athan.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            try {
                allAthanClickHandler(1);
            } catch (Exception e1) {
            }
        }
    });
    this.duhrAthan = new JLabel();
    this.duhrAthan.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            try {
                allAthanClickHandler(2);
            } catch (Exception e1) {
            }
        }
    });
    this.asrAthan = new JLabel();
    this.asrAthan.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            try {
                allAthanClickHandler(3);
            } catch (Exception e1) {
            }
        }
    });
    this.maghribAthan = new JLabel();
    this.maghribAthan.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            try {
                allAthanClickHandler(4);
            } catch (Exception e1) {
            }
        }
    });
    this.ishaaAthan = new JLabel();
    this.ishaaAthan.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            try {
                allAthanClickHandler(5);
            } catch (Exception e1) {
            }
        }
    });

    this.duhrAthan.setBounds(152, 132, 28, 28);
    this.shorou9Athan.setBounds(322, 132, 28, 28);
    this.fajrAthan.setBounds(492, 132, 28, 28);
    this.ishaaAthan.setBounds(152, 212, 28, 28);
    this.maghribAthan.setBounds(322, 212, 28, 28);
    this.asrAthan.setBounds(492, 212, 28, 28);

    setAllAthanIcons();

    this.duhrName.setBounds(30, 100, 150, 30);
    this.duhrTime.setBounds(30, 130, 150, 30);
    this.shorou9Name.setBounds(200, 100, 150, 30);
    this.shorou9Time.setBounds(200, 130, 150, 30);
    this.fajrName.setBounds(370, 100, 150, 30);
    this.fajrTime.setBounds(370, 130, 150, 30);

    this.ishaaName.setBounds(30, 180, 150, 30);
    this.ishaaTime.setBounds(30, 210, 150, 30);
    this.maghribName.setBounds(200, 180, 150, 30);
    this.maghribTime.setBounds(200, 210, 150, 30);
    this.asrName.setBounds(370, 180, 150, 30);
    this.asrTime.setBounds(370, 210, 150, 30);

    this.digitalClock.setBounds(10, 250, 200, 50);
    this.nextPrayer.setBounds(150, 262, 350, 30);

    this.settings.setBounds(470, 0, 40, 40);
    this.settings.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            settingsLabelMouseClicked(e);
        }
    });

    this.exitLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            exitLabelMouseClicked(e);
        }
    });
    this.mainFrame.addMouseMotionListener(new MouseAdapter() {
        @Override
        public void mouseDragged(MouseEvent e) {
            mainFrameMouseDragged(e);
        }
    });
    this.mainFrame.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            mainFrameMousePressed(e);
        }
    });
    this.mainFrame.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent e) {
            mainFrameMouseReleased(e);
        }
    });

    this.mainFrame.setSize(550, 300);
    this.mainFrame.setLocationRelativeTo(null);
    this.mainFrame.setUndecorated(true);
    this.mainFrame.setResizable(false);

    //adding all labels objects to main panel
    this.mainPanel.add(exitLabel);
    this.mainPanel.add(hijriTime);
    this.mainPanel.add(miladiTime);
    this.mainPanel.add(location);
    this.mainPanel.add(locationFromInternet);

    this.mainPanel.add(duhrName);
    this.mainPanel.add(duhrTime);
    this.mainPanel.add(shorou9Name);
    this.mainPanel.add(shorou9Time);
    this.mainPanel.add(fajrName);
    this.mainPanel.add(fajrTime);
    this.mainPanel.add(ishaaName);
    this.mainPanel.add(ishaaTime);
    this.mainPanel.add(maghribName);
    this.mainPanel.add(maghribTime);
    this.mainPanel.add(asrName);
    this.mainPanel.add(asrTime);
    this.mainPanel.add(digitalClock);
    this.mainPanel.add(nextPrayer);
    this.mainPanel.add(settings);
    this.mainPanel.add(donateLabel);

    this.mainPanel.add(fajrAthan);
    this.mainPanel.add(shorou9Athan);
    this.mainPanel.add(duhrAthan);
    this.mainPanel.add(asrAthan);
    this.mainPanel.add(maghribAthan);
    this.mainPanel.add(ishaaAthan);

    this.mainPanel.add(nextDayPrayerTimes);
    this.mainPanel.add(previousDayPrayerTimes);
    this.mainPanel.add(actualDayPrayerTimes);

    this.mainFrame.add(mainPanel);
    this.pack();

    trayConfig();//create try icon

    this.setAllLabelsTimesHijriMiladiValues(prayersTimes, hijriTimeObj, miladiTimeObj);//set all values to all labels
    this.prayerTimesHandler.start();//start prayer times handler thread
}

From source file:ca.uhn.hl7v2.testpanel.ui.conn.Hl7ConnectionPanelBackup.java

/**
 * Create the panel.//from   w w  w  .  j  a  v a 2  s.c om
 */
public Hl7ConnectionPanelBackup(Controller theController) {
    myController = theController;

    setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[] { 150, 0 };
    gridBagLayout.rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
    gridBagLayout.columnWeights = new double[] { 0.0, 1.0 };
    gridBagLayout.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE };
    setLayout(gridBagLayout);

    mySinglePortRadio = new JRadioButton("Single Port MLLP");
    mySinglePortRadio.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updatePortsModel();
            updatePortsUi();
        }
    });
    myPortButtonGroup.add(mySinglePortRadio);
    GridBagConstraints gbc_SinglePortRadio = new GridBagConstraints();
    gbc_SinglePortRadio.anchor = GridBagConstraints.WEST;
    gbc_SinglePortRadio.insets = new Insets(0, 0, 5, 5);
    gbc_SinglePortRadio.gridx = 0;
    gbc_SinglePortRadio.gridy = 0;
    add(mySinglePortRadio, gbc_SinglePortRadio);

    JPanel panel_4 = new JPanel();
    panel_4.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    GridBagConstraints gbc_panel_4 = new GridBagConstraints();
    gbc_panel_4.fill = GridBagConstraints.BOTH;
    gbc_panel_4.insets = new Insets(0, 0, 5, 0);
    gbc_panel_4.gridx = 1;
    gbc_panel_4.gridy = 0;
    add(panel_4, gbc_panel_4);
    GridBagLayout gbl_panel_4 = new GridBagLayout();
    gbl_panel_4.columnWidths = new int[] { 0, 0, 0 };
    gbl_panel_4.rowHeights = new int[] { 0, 0 };
    gbl_panel_4.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
    gbl_panel_4.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
    panel_4.setLayout(gbl_panel_4);

    mySinglePortTextBox = new JTextField();
    mySinglePortTextBox.getDocument().addDocumentListener(new SimpleDocumentListener() {
        @Override
        public void update(DocumentEvent theE) {
            String text = mySinglePortTextBox.getText();
            text = text.replaceAll("[^0-9]+", "");
            if (!StringUtils.equals(mySinglePortTextBox.getText(), text)) {
                final String newVal = text;
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        mySinglePortTextBox.setText(newVal);
                    }
                });
            }
            if (mySinglePortRadio.isSelected()) {
                if (text.length() > 0) {
                    myConnection.setIncomingOrSinglePort(Integer.parseInt(text));
                } else {
                    myConnection.setIncomingOrSinglePort(-1);
                }
            }
        }
    });

    mylabel = new JLabel("Port");
    mylabel.setHorizontalAlignment(SwingConstants.CENTER);
    mylabel.setPreferredSize(new Dimension(60, 16));
    mylabel.setMinimumSize(new Dimension(60, 16));
    mylabel.setMaximumSize(new Dimension(60, 16));
    GridBagConstraints gbc_label = new GridBagConstraints();
    gbc_label.anchor = GridBagConstraints.EAST;
    gbc_label.insets = new Insets(0, 0, 0, 5);
    gbc_label.gridx = 0;
    gbc_label.gridy = 0;
    panel_4.add(mylabel, gbc_label);
    GridBagConstraints gbc_SinglePortTextBox = new GridBagConstraints();
    gbc_SinglePortTextBox.insets = new Insets(0, 5, 0, 0);
    gbc_SinglePortTextBox.anchor = GridBagConstraints.WEST;
    gbc_SinglePortTextBox.gridx = 1;
    gbc_SinglePortTextBox.gridy = 0;
    panel_4.add(mySinglePortTextBox, gbc_SinglePortTextBox);
    mySinglePortTextBox.setMinimumSize(new Dimension(100, 28));
    mySinglePortTextBox.setMaximumSize(new Dimension(100, 2147483647));
    mySinglePortTextBox.setColumns(10);

    myDualPortRadio = new JRadioButton("Dual Port MLLP");
    myDualPortRadio.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updatePortsModel();
            updatePortsUi();
        }
    });
    myPortButtonGroup.add(myDualPortRadio);
    GridBagConstraints gbc_DualPortRadio = new GridBagConstraints();
    gbc_DualPortRadio.anchor = GridBagConstraints.WEST;
    gbc_DualPortRadio.insets = new Insets(0, 0, 5, 5);
    gbc_DualPortRadio.gridx = 0;
    gbc_DualPortRadio.gridy = 1;
    add(myDualPortRadio, gbc_DualPortRadio);

    JPanel panel = new JPanel();
    panel.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    GridBagConstraints gbc_BottomPanel = new GridBagConstraints();
    gbc_BottomPanel.insets = new Insets(0, 0, 5, 0);
    gbc_BottomPanel.fill = GridBagConstraints.BOTH;
    gbc_BottomPanel.gridx = 1;
    gbc_BottomPanel.gridy = 1;
    add(panel, gbc_BottomPanel);
    GridBagLayout gbl_panel = new GridBagLayout();
    gbl_panel.columnWidths = new int[] { 0, 0, 0, 0, 0, 0 };
    gbl_panel.rowHeights = new int[] { 0, 0 };
    gbl_panel.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
    gbl_panel.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
    panel.setLayout(gbl_panel);

    JLabel lblInbound = new JLabel("Inbound");
    lblInbound.setHorizontalAlignment(SwingConstants.CENTER);
    lblInbound.setPreferredSize(new Dimension(60, 16));
    lblInbound.setMinimumSize(new Dimension(60, 16));
    lblInbound.setMaximumSize(new Dimension(60, 16));
    GridBagConstraints gbc_lblInbound = new GridBagConstraints();
    gbc_lblInbound.insets = new Insets(0, 5, 0, 5);
    gbc_lblInbound.anchor = GridBagConstraints.EAST;
    gbc_lblInbound.gridx = 0;
    gbc_lblInbound.gridy = 0;
    panel.add(lblInbound, gbc_lblInbound);

    myDualIncomingTextBox = new JTextField();
    myDualIncomingTextBox.getDocument().addDocumentListener(new SimpleDocumentListener() {
        @Override
        public void update(DocumentEvent theE) {
            String text = myDualIncomingTextBox.getText();
            text = text.replaceAll("[^0-9]+", "");
            if (!StringUtils.equals(myDualIncomingTextBox.getText(), text)) {
                final String newVal = text;
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        myDualIncomingTextBox.setText(newVal);
                    }
                });
            }
            if (myDualPortRadio.isSelected()) {
                if (text.length() > 0) {
                    myConnection.setIncomingOrSinglePort(Integer.parseInt(text));
                } else {
                    myConnection.setIncomingOrSinglePort(-1);
                }
            }
        }
    });
    myDualIncomingTextBox.setMaximumSize(new Dimension(100, 2147483647));
    myDualIncomingTextBox.setMinimumSize(new Dimension(100, 28));
    GridBagConstraints gbc_DualIncomingTextBox = new GridBagConstraints();
    gbc_DualIncomingTextBox.anchor = GridBagConstraints.WEST;
    gbc_DualIncomingTextBox.insets = new Insets(0, 0, 0, 5);
    gbc_DualIncomingTextBox.gridx = 1;
    gbc_DualIncomingTextBox.gridy = 0;
    panel.add(myDualIncomingTextBox, gbc_DualIncomingTextBox);
    myDualIncomingTextBox.setColumns(10);

    JLabel lblOutbound = new JLabel("Outbound");
    GridBagConstraints gbc_lblOutbound = new GridBagConstraints();
    gbc_lblOutbound.anchor = GridBagConstraints.EAST;
    gbc_lblOutbound.insets = new Insets(0, 0, 0, 5);
    gbc_lblOutbound.gridx = 2;
    gbc_lblOutbound.gridy = 0;
    panel.add(lblOutbound, gbc_lblOutbound);

    myDualOutgoingTextBox = new JTextField();
    myDualOutgoingTextBox.getDocument().addDocumentListener(new SimpleDocumentListener() {
        @Override
        public void update(DocumentEvent theE) {
            String text = myDualOutgoingTextBox.getText();
            text = text.replaceAll("[^0-9]+", "");
            if (!StringUtils.equals(myDualOutgoingTextBox.getText(), text)) {
                final String newVal = text;
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        myDualOutgoingTextBox.setText(newVal);
                    }
                });
            }
            if (myDualPortRadio.isSelected()) {
                if (text.length() > 0) {
                    myConnection.setOutgoingPort(Integer.parseInt(text));
                } else {
                    myConnection.setOutgoingPort(-1);
                }
            }
        }
    });
    myDualOutgoingTextBox.setMinimumSize(new Dimension(100, 28));
    myDualOutgoingTextBox.setMaximumSize(new Dimension(100, 2147483647));
    GridBagConstraints gbc_DualOutgoingTextBox = new GridBagConstraints();
    gbc_DualOutgoingTextBox.insets = new Insets(0, 0, 0, 5);
    gbc_DualOutgoingTextBox.anchor = GridBagConstraints.WEST;
    gbc_DualOutgoingTextBox.gridx = 3;
    gbc_DualOutgoingTextBox.gridy = 0;
    panel.add(myDualOutgoingTextBox, gbc_DualOutgoingTextBox);
    myDualOutgoingTextBox.setColumns(10);

    myHl7OverHttpRadioButton = new JRadioButton("HL7 over HTTP");
    myHl7OverHttpRadioButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updatePortsModel();
            updatePortsUi();
        }
    });
    myPortButtonGroup.add(myHl7OverHttpRadioButton);
    GridBagConstraints gbc_Hl7OverHttpRadioButton = new GridBagConstraints();
    gbc_Hl7OverHttpRadioButton.anchor = GridBagConstraints.WEST;
    gbc_Hl7OverHttpRadioButton.insets = new Insets(0, 0, 5, 5);
    gbc_Hl7OverHttpRadioButton.gridx = 0;
    gbc_Hl7OverHttpRadioButton.gridy = 2;
    add(myHl7OverHttpRadioButton, gbc_Hl7OverHttpRadioButton);

    mypanel = new JPanel();
    mypanel.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    GridBagConstraints gbc_panel = new GridBagConstraints();
    gbc_panel.insets = new Insets(0, 0, 5, 0);
    gbc_panel.fill = GridBagConstraints.BOTH;
    gbc_panel.gridx = 1;
    gbc_panel.gridy = 2;
    add(mypanel, gbc_panel);
    GridBagLayout gbl_panel2 = new GridBagLayout();
    gbl_panel2.columnWidths = new int[] { 0, 0 };
    gbl_panel2.rowHeights = new int[] { 0, 0 };
    gbl_panel2.columnWeights = new double[] { 0.0, 1.0 };
    gbl_panel2.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
    mypanel.setLayout(gbl_panel2);

    mylabel_1 = new JLabel("URL");
    mylabel_1.setHorizontalAlignment(SwingConstants.CENTER);
    mylabel_1.setPreferredSize(new Dimension(60, 16));
    mylabel_1.setMinimumSize(new Dimension(60, 16));
    mylabel_1.setMaximumSize(new Dimension(60, 16));
    GridBagConstraints gbc_label_1 = new GridBagConstraints();
    gbc_label_1.anchor = GridBagConstraints.EAST;
    gbc_label_1.insets = new Insets(0, 0, 0, 5);
    gbc_label_1.gridx = 0;
    gbc_label_1.gridy = 0;
    mypanel.add(mylabel_1, gbc_label_1);

    myHoHUrlTextField = new JTextField();
    myHoHUrlTextField.getDocument().addDocumentListener(new SimpleDocumentListener() {
        @Override
        public void update(DocumentEvent theE) {
            if (myHohUrlTextFieldUpdating) {
                return;
            }

            String value = myHoHUrlTextField.getText();
            try {
                URL url = new URL(value);
                boolean tls;
                if (url.getProtocol().equals("http")) {
                    tls = false;
                } else if (url.getProtocol().equals("https")) {
                    tls = true;
                } else {
                    ourLog.info("Unknown protocol: {}", url.getProtocol());
                    myHoHUrlTextField.setBackground(ERROR_BG);
                    return;
                }

                myConnection.setTls(tls);
                myConnection.setHost(url.getHost());
                myConnection
                        .setIncomingOrSinglePort(url.getPort() != -1 ? url.getPort() : url.getDefaultPort());
                myConnection.setHttpUriPath(url.getPath());

                myHohUrlTextFieldUpdating = true;
                updatePortsUi();
                myHohUrlTextFieldUpdating = false;

                myTlsCheckbox.setSelected(tls);
                myHohTlsCheckbox.setSelected(tls);

                myHoHUrlTextField.setBackground(Color.white);
            } catch (MalformedURLException e) {
                myHoHUrlTextField.setBackground(ERROR_BG);
            }

        }
    });
    GridBagConstraints gbc_HohUsernameTextbox = new GridBagConstraints();
    gbc_HohUsernameTextbox.fill = GridBagConstraints.HORIZONTAL;
    gbc_HohUsernameTextbox.gridx = 1;
    gbc_HohUsernameTextbox.gridy = 0;
    mypanel.add(myHoHUrlTextField, gbc_HohUsernameTextbox);
    myHoHUrlTextField.setColumns(10);

    JLabel lblEncoding = new JLabel("Encoding");
    GridBagConstraints gbc_lblEncoding = new GridBagConstraints();
    gbc_lblEncoding.insets = new Insets(0, 0, 5, 5);
    gbc_lblEncoding.gridx = 0;
    gbc_lblEncoding.gridy = 3;
    add(lblEncoding, gbc_lblEncoding);

    JPanel encodingPanel = new JPanel();
    GridBagConstraints gbc_encodingPanel = new GridBagConstraints();
    gbc_encodingPanel.fill = GridBagConstraints.HORIZONTAL;
    gbc_encodingPanel.insets = new Insets(0, 0, 5, 0);
    gbc_encodingPanel.gridx = 1;
    gbc_encodingPanel.gridy = 3;
    add(encodingPanel, gbc_encodingPanel);
    encodingPanel.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    GridBagLayout gbl_encodingPanel = new GridBagLayout();
    gbl_encodingPanel.columnWidths = new int[] { 144, 58, 0 };
    gbl_encodingPanel.rowHeights = new int[] { 23, 0 };
    gbl_encodingPanel.columnWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
    gbl_encodingPanel.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
    encodingPanel.setLayout(gbl_encodingPanel);

    myXmlRadio = new JRadioButton("XML");
    myXmlRadio.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent theE) {
            updateEncodingModel();
        }
    });

    myEr7Radio = new JRadioButton("ER7 (Pipe and hat)");
    myEr7Radio.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateEncodingModel();
        }
    });
    encodingButtonGroup.add(myEr7Radio);
    GridBagConstraints gbc_Er7Radio = new GridBagConstraints();
    gbc_Er7Radio.anchor = GridBagConstraints.NORTHWEST;
    gbc_Er7Radio.insets = new Insets(0, 0, 0, 5);
    gbc_Er7Radio.gridx = 0;
    gbc_Er7Radio.gridy = 0;
    encodingPanel.add(myEr7Radio, gbc_Er7Radio);
    encodingButtonGroup.add(myXmlRadio);
    GridBagConstraints gbc_XmlRadio = new GridBagConstraints();
    gbc_XmlRadio.anchor = GridBagConstraints.NORTHWEST;
    gbc_XmlRadio.gridx = 1;
    gbc_XmlRadio.gridy = 0;
    encodingPanel.add(myXmlRadio, gbc_XmlRadio);

    JLabel lblCharset = new JLabel("Charset");
    GridBagConstraints gbc_lblCharset = new GridBagConstraints();
    gbc_lblCharset.insets = new Insets(0, 0, 5, 5);
    gbc_lblCharset.gridx = 0;
    gbc_lblCharset.gridy = 4;
    add(lblCharset, gbc_lblCharset);

    JPanel panel_2 = new JPanel();
    GridBagConstraints gbc_panel_2 = new GridBagConstraints();
    gbc_panel_2.fill = GridBagConstraints.HORIZONTAL;
    gbc_panel_2.insets = new Insets(0, 0, 5, 0);
    gbc_panel_2.gridx = 1;
    gbc_panel_2.gridy = 4;
    add(panel_2, gbc_panel_2);
    panel_2.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    GridBagLayout gbl_panel_2 = new GridBagLayout();
    gbl_panel_2.columnWidths = new int[] { 28, 198, 0, 0 };
    gbl_panel_2.rowHeights = new int[] { 27, 0 };
    gbl_panel_2.columnWeights = new double[] { 0.0, 0.0, 0.0, Double.MIN_VALUE };
    gbl_panel_2.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
    panel_2.setLayout(gbl_panel_2);

    myCharsetSelectRadio = new JRadioButton("");
    myCharsetSelectRadio.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateCharsetModel();
        }
    });
    charsetButtonGroup.add(myCharsetSelectRadio);
    GridBagConstraints gbc_CharsetSelectRadio = new GridBagConstraints();
    gbc_CharsetSelectRadio.anchor = GridBagConstraints.WEST;
    gbc_CharsetSelectRadio.insets = new Insets(0, 0, 0, 5);
    gbc_CharsetSelectRadio.gridx = 0;
    gbc_CharsetSelectRadio.gridy = 0;
    panel_2.add(myCharsetSelectRadio, gbc_CharsetSelectRadio);

    myCharsetCombo = new JComboBox();
    myCharsetCombo.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateCharsetModel();
        }
    });
    GridBagConstraints gbc_CharsetCombo = new GridBagConstraints();
    gbc_CharsetCombo.anchor = GridBagConstraints.NORTHWEST;
    gbc_CharsetCombo.insets = new Insets(0, 0, 0, 5);
    gbc_CharsetCombo.gridx = 1;
    gbc_CharsetCombo.gridy = 0;
    panel_2.add(myCharsetCombo, gbc_CharsetCombo);

    myCharsetDetectRadio = new JRadioButton("Detect in Message (MSH-18)");
    myCharsetDetectRadio.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateCharsetModel();
        }
    });
    charsetButtonGroup.add(myCharsetDetectRadio);
    GridBagConstraints gbc_CharsetDetectRadio = new GridBagConstraints();
    gbc_CharsetDetectRadio.anchor = GridBagConstraints.NORTH;
    gbc_CharsetDetectRadio.gridwidth = 2;
    gbc_CharsetDetectRadio.gridx = 2;
    gbc_CharsetDetectRadio.gridy = 0;
    panel_2.add(myCharsetDetectRadio, gbc_CharsetDetectRadio);

    mylabel_5 = new JLabel("Debug");
    GridBagConstraints gbc_label_5 = new GridBagConstraints();
    gbc_label_5.insets = new Insets(0, 0, 5, 5);
    gbc_label_5.gridx = 0;
    gbc_label_5.gridy = 5;
    add(mylabel_5, gbc_label_5);

    mypanel_2 = new JPanel();
    mypanel_2.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    GridBagConstraints gbc_panel_75 = new GridBagConstraints();
    gbc_panel_75.insets = new Insets(0, 0, 5, 0);
    gbc_panel_75.fill = GridBagConstraints.BOTH;
    gbc_panel_75.gridx = 1;
    gbc_panel_75.gridy = 5;
    add(mypanel_2, gbc_panel_75);
    GridBagLayout gbl_panel_74 = new GridBagLayout();
    gbl_panel_74.columnWidths = new int[] { 0, 0 };
    gbl_panel_74.rowHeights = new int[] { 0, 0 };
    gbl_panel_74.columnWeights = new double[] { 0.0, Double.MIN_VALUE };
    gbl_panel_74.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
    mypanel_2.setLayout(gbl_panel_74);

    myCaptureByteStreamCheckbox = new JCheckBox("Capture Bytes");
    GridBagConstraints gbc_CaptureByteStreamCheckbox = new GridBagConstraints();
    gbc_CaptureByteStreamCheckbox.gridx = 0;
    gbc_CaptureByteStreamCheckbox.gridy = 0;
    mypanel_2.add(myCaptureByteStreamCheckbox, gbc_CaptureByteStreamCheckbox);
    myCaptureByteStreamCheckbox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            myConnection.setCaptureBytes(myCaptureByteStreamCheckbox.isSelected());
        }
    });
    myCaptureByteStreamCheckbox.setToolTipText("Check this box to capture the transport level communication");

    myInterfaceTypeCardPanel = new JPanel();
    myInterfaceTypeCardPanel.setBorder(null);
    GridBagConstraints gbc_InterfaceTypeCardPanel = new GridBagConstraints();
    gbc_InterfaceTypeCardPanel.gridwidth = 2;
    gbc_InterfaceTypeCardPanel.fill = GridBagConstraints.BOTH;
    gbc_InterfaceTypeCardPanel.gridx = 0;
    gbc_InterfaceTypeCardPanel.gridy = 6;
    add(myInterfaceTypeCardPanel, gbc_InterfaceTypeCardPanel);
    myInterfaceTypeCardPanel.setLayout(new CardLayout(0, 0));

    myMllpCard = new JPanel();
    myMllpCard.setBorder(null);
    myInterfaceTypeCardPanel.add(myMllpCard, IFACE_TYPE_CARD_MLLP);
    GridBagLayout gbl_MllpCard = new GridBagLayout();
    gbl_MllpCard.columnWidths = new int[] { 150, 0, 0 };
    gbl_MllpCard.rowHeights = new int[] { 0, 0, 0, 0 };
    gbl_MllpCard.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
    gbl_MllpCard.rowWeights = new double[] { 0.0, 0.0, 0.0, Double.MIN_VALUE };
    myMllpCard.setLayout(gbl_MllpCard);

    JLabel lblHost = new JLabel("Host");
    GridBagConstraints gbc_lblHost = new GridBagConstraints();
    gbc_lblHost.insets = new Insets(0, 0, 5, 5);
    gbc_lblHost.gridx = 0;
    gbc_lblHost.gridy = 0;
    myMllpCard.add(lblHost, gbc_lblHost);

    mypanel_1 = new JPanel();
    mypanel_1.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    GridBagConstraints gbc_panel_1 = new GridBagConstraints();
    gbc_panel_1.insets = new Insets(0, 0, 5, 0);
    gbc_panel_1.fill = GridBagConstraints.BOTH;
    gbc_panel_1.gridx = 1;
    gbc_panel_1.gridy = 0;
    myMllpCard.add(mypanel_1, gbc_panel_1);
    GridBagLayout gbl_panel_1 = new GridBagLayout();
    gbl_panel_1.columnWidths = new int[] { 134, 0 };
    gbl_panel_1.rowHeights = new int[] { 28, 0 };
    gbl_panel_1.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gbl_panel_1.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
    mypanel_1.setLayout(gbl_panel_1);

    myHostBox = new JTextField();
    GridBagConstraints gbc_HostBox = new GridBagConstraints();
    gbc_HostBox.fill = GridBagConstraints.HORIZONTAL;
    gbc_HostBox.anchor = GridBagConstraints.NORTH;
    gbc_HostBox.gridx = 0;
    gbc_HostBox.gridy = 0;
    mypanel_1.add(myHostBox, gbc_HostBox);
    myHostBox.getDocument().addDocumentListener(new SimpleDocumentListener() {
        @Override
        public void update(DocumentEvent theE) {
            myConnection.setHost(myHostBox.getText());
        }
    });
    myHostBox.setColumns(10);

    JLabel lblTransport = new JLabel("Transport");
    GridBagConstraints gbc_lblTransport = new GridBagConstraints();
    gbc_lblTransport.insets = new Insets(0, 0, 5, 5);
    gbc_lblTransport.gridx = 0;
    gbc_lblTransport.gridy = 1;
    myMllpCard.add(lblTransport, gbc_lblTransport);

    JPanel panel_3 = new JPanel();
    GridBagConstraints gbc_hohAuthPanel = new GridBagConstraints();
    gbc_hohAuthPanel.fill = GridBagConstraints.HORIZONTAL;
    gbc_hohAuthPanel.insets = new Insets(0, 0, 5, 0);
    gbc_hohAuthPanel.gridx = 1;
    gbc_hohAuthPanel.gridy = 1;
    myMllpCard.add(panel_3, gbc_hohAuthPanel);
    panel_3.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    GridBagLayout gbl_hohAuthPanel = new GridBagLayout();
    gbl_hohAuthPanel.columnWidths = new int[] { 0, 0, 0 };
    gbl_hohAuthPanel.rowHeights = new int[] { 0, 0 };
    gbl_hohAuthPanel.columnWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
    gbl_hohAuthPanel.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
    panel_3.setLayout(gbl_hohAuthPanel);

    myTlsCheckbox = new JCheckBox("Use TLS/SSL");
    myTlsCheckbox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            myHohTlsCheckbox.setSelected(myTlsCheckbox.isSelected());
            myConnection.setTls(myTlsCheckbox.isSelected());
        }
    });
    GridBagConstraints gbc_TlsCheckbox = new GridBagConstraints();
    gbc_TlsCheckbox.insets = new Insets(0, 0, 0, 5);
    gbc_TlsCheckbox.anchor = GridBagConstraints.WEST;
    gbc_TlsCheckbox.gridx = 0;
    gbc_TlsCheckbox.gridy = 0;
    panel_3.add(myTlsCheckbox, gbc_TlsCheckbox);

    myHoHCard = new JPanel();
    myInterfaceTypeCardPanel.add(myHoHCard, IFACE_TYPE_CARD_HOH);
    GridBagLayout gbl_HoHCard = new GridBagLayout();
    gbl_HoHCard.columnWidths = new int[] { 150, 0, 0 };
    gbl_HoHCard.rowHeights = new int[] { 0, 0, 0, 0 };
    gbl_HoHCard.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
    gbl_HoHCard.rowWeights = new double[] { 0.0, 0.0, 0.0, Double.MIN_VALUE };
    myHoHCard.setLayout(gbl_HoHCard);

    mylabel_6 = new JLabel("Authorization");
    GridBagConstraints gbc_label_6 = new GridBagConstraints();
    gbc_label_6.insets = new Insets(0, 0, 5, 5);
    gbc_label_6.gridx = 0;
    gbc_label_6.gridy = 0;
    myHoHCard.add(mylabel_6, gbc_label_6);

    hohAuthPanel = new JPanel();
    hohAuthPanel.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    GridBagConstraints gbc_hohAuthPanel2 = new GridBagConstraints();
    gbc_hohAuthPanel2.insets = new Insets(0, 0, 5, 0);
    gbc_hohAuthPanel2.fill = GridBagConstraints.BOTH;
    gbc_hohAuthPanel2.gridx = 1;
    gbc_hohAuthPanel2.gridy = 0;
    myHoHCard.add(hohAuthPanel, gbc_hohAuthPanel2);
    GridBagLayout gbl_hohAuthPanel3 = new GridBagLayout();
    gbl_hohAuthPanel3.columnWidths = new int[] { 0, 0, 0, 0, 0, 0, 0 };
    gbl_hohAuthPanel3.rowHeights = new int[] { 0, 0 };
    gbl_hohAuthPanel3.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE };
    gbl_hohAuthPanel3.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
    hohAuthPanel.setLayout(gbl_hohAuthPanel3);

    myHohAuthEnabledCheckbox = new JCheckBox("Enabled");
    myHohAuthEnabledCheckbox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent theE) {
            myConnection.setHohAuthenticationEnabled(myHohAuthEnabledCheckbox.isSelected());
        }
    });
    GridBagConstraints gbc_HohAuthEnabledCheckbox = new GridBagConstraints();
    gbc_HohAuthEnabledCheckbox.insets = new Insets(0, 0, 0, 5);
    gbc_HohAuthEnabledCheckbox.gridx = 0;
    gbc_HohAuthEnabledCheckbox.gridy = 0;
    hohAuthPanel.add(myHohAuthEnabledCheckbox, gbc_HohAuthEnabledCheckbox);

    mylabel_7 = new JLabel("Username:");
    GridBagConstraints gbc_label_7 = new GridBagConstraints();
    gbc_label_7.insets = new Insets(0, 0, 0, 5);
    gbc_label_7.anchor = GridBagConstraints.EAST;
    gbc_label_7.gridx = 1;
    gbc_label_7.gridy = 0;
    hohAuthPanel.add(mylabel_7, gbc_label_7);

    myHohAuthUsernameTextbox = new JTextField();
    myHohAuthUsernameTextbox.getDocument().addDocumentListener(new SimpleDocumentListener() {
        @Override
        public void update(DocumentEvent theE) {
            myConnection.setHohAuthenticationUsername(myHohAuthUsernameTextbox.getText());
        }
    });
    myHohAuthUsernameTextbox.setMaximumSize(new Dimension(200, 2147483647));
    myHohAuthUsernameTextbox.setMinimumSize(new Dimension(100, 28));
    myHohAuthUsernameTextbox.setPreferredSize(new Dimension(100, 28));
    GridBagConstraints gbc_HohUsernameTextbox2 = new GridBagConstraints();
    gbc_HohUsernameTextbox2.insets = new Insets(0, 0, 0, 5);
    gbc_HohUsernameTextbox2.fill = GridBagConstraints.HORIZONTAL;
    gbc_HohUsernameTextbox2.gridx = 2;
    gbc_HohUsernameTextbox2.gridy = 0;
    hohAuthPanel.add(myHohAuthUsernameTextbox, gbc_HohUsernameTextbox2);
    myHohAuthUsernameTextbox.setColumns(10);

    mylabel_8 = new JLabel("Password:");
    GridBagConstraints gbc_label_8 = new GridBagConstraints();
    gbc_label_8.insets = new Insets(0, 0, 0, 5);
    gbc_label_8.anchor = GridBagConstraints.EAST;
    gbc_label_8.gridx = 3;
    gbc_label_8.gridy = 0;
    hohAuthPanel.add(mylabel_8, gbc_label_8);

    myHohAuthPasswordTextbox = new JTextField();
    myHohAuthPasswordTextbox.getDocument().addDocumentListener(new SimpleDocumentListener() {
        @Override
        public void update(DocumentEvent theE) {
            myConnection.setHohAuthenticationPassword(myHohAuthPasswordTextbox.getText());
        }
    });
    myHohAuthPasswordTextbox.setPreferredSize(new Dimension(100, 28));
    myHohAuthPasswordTextbox.setMaximumSize(new Dimension(200, 2147483647));
    myHohAuthPasswordTextbox.setMinimumSize(new Dimension(100, 28));
    GridBagConstraints gbc_textField = new GridBagConstraints();
    gbc_textField.insets = new Insets(0, 0, 0, 5);
    gbc_textField.fill = GridBagConstraints.HORIZONTAL;
    gbc_textField.gridx = 4;
    gbc_textField.gridy = 0;
    hohAuthPanel.add(myHohAuthPasswordTextbox, gbc_textField);
    myHohAuthPasswordTextbox.setColumns(10);

    mylabel_2 = new JLabel("Security Profile");
    GridBagConstraints gbc_label_2 = new GridBagConstraints();
    gbc_label_2.insets = new Insets(0, 0, 5, 5);
    gbc_label_2.gridx = 0;
    gbc_label_2.gridy = 1;
    myHoHCard.add(mylabel_2, gbc_label_2);

    securityProfilePanel = new JPanel();
    GridBagConstraints gbc_securityProfilePanel = new GridBagConstraints();
    gbc_securityProfilePanel.insets = new Insets(0, 0, 5, 0);
    gbc_securityProfilePanel.fill = GridBagConstraints.BOTH;
    gbc_securityProfilePanel.gridx = 1;
    gbc_securityProfilePanel.gridy = 1;
    myHoHCard.add(securityProfilePanel, gbc_securityProfilePanel);
    securityProfilePanel.setLayout(new BorderLayout(0, 0));

    myHohTlsCheckbox = new JCheckBox("TLS Enabled");
    myHohTlsCheckbox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            myConnection.setTls(myHohTlsCheckbox.isSelected());
            myTlsCheckbox.setSelected(myHohTlsCheckbox.isSelected());
            updatePortsUi();
        }
    });
    securityProfilePanel.add(myHohTlsCheckbox, BorderLayout.WEST);

    tlsKeystorePanel = new JPanel();
    tlsKeystorePanel.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    securityProfilePanel.add(tlsKeystorePanel, BorderLayout.CENTER);
    GridBagLayout gbl_tlsKeystorePanel = new GridBagLayout();
    gbl_tlsKeystorePanel.columnWidths = new int[] { 58, 107, 77, 0, 0 };
    gbl_tlsKeystorePanel.rowHeights = new int[] { 28, 16, 0 };
    gbl_tlsKeystorePanel.columnWeights = new double[] { 0.0, 1.0, 1.0, 0.0, Double.MIN_VALUE };
    gbl_tlsKeystorePanel.rowWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
    tlsKeystorePanel.setLayout(gbl_tlsKeystorePanel);

    mylabel_3 = new JLabel("Keystore:");
    GridBagConstraints gbc_label_3 = new GridBagConstraints();
    gbc_label_3.anchor = GridBagConstraints.WEST;
    gbc_label_3.fill = GridBagConstraints.VERTICAL;
    gbc_label_3.insets = new Insets(0, 0, 5, 5);
    gbc_label_3.gridx = 0;
    gbc_label_3.gridy = 0;
    tlsKeystorePanel.add(mylabel_3, gbc_label_3);

    myHohSecurityKeystoreTextbox = new JTextField();
    GridBagConstraints gbc_HohKeystoreTextbox = new GridBagConstraints();
    gbc_HohKeystoreTextbox.gridwidth = 2;
    gbc_HohKeystoreTextbox.anchor = GridBagConstraints.NORTH;
    gbc_HohKeystoreTextbox.fill = GridBagConstraints.HORIZONTAL;
    gbc_HohKeystoreTextbox.insets = new Insets(0, 0, 5, 5);
    gbc_HohKeystoreTextbox.gridx = 1;
    gbc_HohKeystoreTextbox.gridy = 0;
    tlsKeystorePanel.add(myHohSecurityKeystoreTextbox, gbc_HohKeystoreTextbox);
    myHohSecurityKeystoreTextbox.setColumns(10);
    myHohSecurityKeystoreTextbox.getDocument().addDocumentListener(new SimpleDocumentListener() {
        @Override
        public void update(DocumentEvent theE) {
            String text = myHohSecurityKeystoreTextbox.getText();
            myHohSecurityKeyPwTextBox.setEnabled(isNotBlank(text));
            myConnection.setTlsKeystoreLocation(text);
            scheduleHohSecurityKeystoreCheck();
        }
    });

    myHohSecurityKeystoreChooseBtn = new JButton("Choose");
    myHohSecurityKeystoreChooseBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            String directory = Prefs.getInstance().getInterfaceHohSecurityKeystoreDirectory();
            directory = StringUtils.defaultString(directory, ".");
            JFileChooser chooser = new JFileChooser(directory);
            chooser.setDialogType(JFileChooser.OPEN_DIALOG);
            chooser.setDialogTitle("Select a Java Keystore");
            int result = chooser.showOpenDialog(Hl7ConnectionPanelBackup.this);
            if (result == JFileChooser.APPROVE_OPTION) {
                Prefs.getInstance()
                        .setInterfaceHohSecurityKeystoreDirectory(chooser.getSelectedFile().getParent());
                myHohSecurityKeystoreTextbox.setText(chooser.getSelectedFile().getAbsolutePath());
            }
        }
    });
    myHohSecurityKeystoreChooseBtn.setIcon(new ImageIcon(
            Hl7ConnectionPanelBackup.class.getResource("/ca/uhn/hl7v2/testpanel/images/open.png")));
    GridBagConstraints gbc_button = new GridBagConstraints();
    gbc_button.insets = new Insets(0, 0, 5, 0);
    gbc_button.gridx = 3;
    gbc_button.gridy = 0;
    tlsKeystorePanel.add(myHohSecurityKeystoreChooseBtn, gbc_button);

    mylabel_4 = new JLabel("Store Pass:");
    GridBagConstraints gbc_label_4 = new GridBagConstraints();
    gbc_label_4.insets = new Insets(0, 0, 0, 5);
    gbc_label_4.anchor = GridBagConstraints.EAST;
    gbc_label_4.gridx = 0;
    gbc_label_4.gridy = 1;
    tlsKeystorePanel.add(mylabel_4, gbc_label_4);

    myHohSecurityKeyPwTextBox = new JTextField();
    myHohSecurityKeyPwTextBox.getDocument().addDocumentListener(new SimpleDocumentListener() {
        @Override
        public void update(DocumentEvent theE) {
            myConnection.setTlsKeystorePassword(myHohSecurityKeyPwTextBox.getText());
            scheduleHohSecurityKeystoreCheck();
        }
    });
    GridBagConstraints gbc_HohSecurityKeyPwTextBox = new GridBagConstraints();
    gbc_HohSecurityKeyPwTextBox.insets = new Insets(0, 0, 0, 5);
    gbc_HohSecurityKeyPwTextBox.fill = GridBagConstraints.HORIZONTAL;
    gbc_HohSecurityKeyPwTextBox.gridx = 1;
    gbc_HohSecurityKeyPwTextBox.gridy = 1;
    tlsKeystorePanel.add(myHohSecurityKeyPwTextBox, gbc_HohSecurityKeyPwTextBox);
    myHohSecurityKeyPwTextBox.setColumns(10);

    myHohSecurityProfileKeystoreStatus = new JLabel("Value goes here");
    myHohSecurityProfileKeystoreStatus.setHorizontalAlignment(SwingConstants.LEFT);
    GridBagConstraints gbc_HohSecurityProfileKeystoreStatus = new GridBagConstraints();
    gbc_HohSecurityProfileKeystoreStatus.anchor = GridBagConstraints.NORTH;
    gbc_HohSecurityProfileKeystoreStatus.fill = GridBagConstraints.HORIZONTAL;
    gbc_HohSecurityProfileKeystoreStatus.gridwidth = 2;
    gbc_HohSecurityProfileKeystoreStatus.gridx = 2;
    gbc_HohSecurityProfileKeystoreStatus.gridy = 1;
    tlsKeystorePanel.add(myHohSecurityProfileKeystoreStatus, gbc_HohSecurityProfileKeystoreStatus);

    init();

}

From source file:com.tiempometa.muestradatos.JReadTags.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY
    // //GEN-BEGIN:initComponents
    ResourceBundle bundle = ResourceBundle.getBundle("com.tiempometa.muestradatos.muestradatos");
    dialogPane = new JPanel();
    contentPanel = new JPanel();
    label2 = new JLabel();
    nextBibTextField = new JTextField();
    statusLabel = new JLabel();
    startReadingButton = new JButton();
    bibLabel = new JLabel();
    scrollPane1 = new JScrollPane();
    tagReadTable = new JTable();
    label3 = new JLabel();
    tidTextField = new JTextField();
    deleteSelectedButton = new JButton();
    label4 = new JLabel();
    epcTextField = new JTextField();
    deleteReadButton = new JButton();
    label1 = new JLabel();
    dataToStoreComboBox = new JComboBox<>();
    deleteAllButton = new JButton();
    allowDuplicateBibsCheckBox = new JCheckBox();
    buttonBar = new JPanel();
    closeButton = new JButton();
    CellConstraints cc = new CellConstraints();

    //======== this ========
    setTitle(bundle.getString("JReadTags.this.title"));
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    setResizable(false);//from   w  w w  . ja  v  a2  s . c o m
    setIconImage(
            new ImageIcon(getClass().getResource("/com/tiempometa/resources/tiempometa_icon_large_alpha.png"))
                    .getImage());
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    //======== dialogPane ========
    {
        dialogPane.setBorder(Borders.DIALOG_BORDER);
        dialogPane.setLayout(new BorderLayout());

        //======== contentPanel ========
        {
            contentPanel.setLayout(new FormLayout(
                    new ColumnSpec[] { new ColumnSpec(Sizes.dluX(15)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(Sizes.dluX(52)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(Sizes.dluX(138)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(Sizes.dluX(71)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(Sizes.dluX(155)) },
                    new RowSpec[] { new RowSpec(Sizes.dluY(17)), FormFactory.LINE_GAP_ROWSPEC,
                            new RowSpec(Sizes.dluY(20)), FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            new RowSpec(Sizes.dluY(20)), FormFactory.LINE_GAP_ROWSPEC,
                            new RowSpec(Sizes.dluY(25)), FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC }));

            //---- label2 ----
            label2.setText(bundle.getString("JReadTags.label2.text"));
            label2.setFont(new Font("Tahoma", Font.PLAIN, 36));
            contentPanel.add(label2, cc.xywh(3, 5, 3, 1));

            //---- nextBibTextField ----
            nextBibTextField.setFont(new Font("Tahoma", Font.PLAIN, 36));
            nextBibTextField.setHorizontalAlignment(SwingConstants.RIGHT);
            nextBibTextField.setText(bundle.getString("JReadTags.nextBibTextField.text"));
            contentPanel.add(nextBibTextField, cc.xy(7, 5));

            //---- statusLabel ----
            statusLabel.setText(bundle.getString("JReadTags.statusLabel.text"));
            statusLabel.setHorizontalAlignment(SwingConstants.CENTER);
            statusLabel.setBackground(Color.yellow);
            statusLabel.setOpaque(true);
            statusLabel.setFont(new Font("Tahoma", Font.BOLD, 20));
            contentPanel.add(statusLabel, cc.xywh(9, 3, 1, 5));

            //---- startReadingButton ----
            startReadingButton.setText(bundle.getString("JReadTags.startReadingButton.text"));
            startReadingButton.setFont(new Font("Tahoma", Font.PLAIN, 14));
            startReadingButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    startReadingButtonActionPerformed(e);
                }
            });
            contentPanel.add(startReadingButton, cc.xywh(3, 7, 3, 1));

            //---- bibLabel ----
            bibLabel.setForeground(Color.red);
            bibLabel.setFont(new Font("Tahoma", Font.BOLD, 36));
            bibLabel.setHorizontalAlignment(SwingConstants.CENTER);
            contentPanel.add(bibLabel, cc.xy(9, 9));

            //======== scrollPane1 ========
            {
                scrollPane1.setViewportView(tagReadTable);
            }
            contentPanel.add(scrollPane1, cc.xywh(3, 11, 7, 1));

            //---- label3 ----
            label3.setText(bundle.getString("JReadTags.label3.text"));
            label3.setHorizontalAlignment(SwingConstants.RIGHT);
            label3.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(label3, cc.xy(3, 13));

            //---- tidTextField ----
            tidTextField.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(tidTextField, cc.xy(5, 13));

            //---- deleteSelectedButton ----
            deleteSelectedButton.setText(bundle.getString("JReadTags.deleteSelectedButton.text"));
            deleteSelectedButton.setFont(new Font("Tahoma", Font.PLAIN, 14));
            deleteSelectedButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    deleteSelectedButtonActionPerformed(e);
                }
            });
            contentPanel.add(deleteSelectedButton, cc.xy(9, 13));

            //---- label4 ----
            label4.setText(bundle.getString("JReadTags.label4.text"));
            label4.setHorizontalAlignment(SwingConstants.RIGHT);
            label4.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(label4, cc.xy(3, 15));

            //---- epcTextField ----
            epcTextField.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(epcTextField, cc.xy(5, 15));

            //---- deleteReadButton ----
            deleteReadButton.setText(bundle.getString("JReadTags.deleteReadButton.text"));
            deleteReadButton.setFont(new Font("Tahoma", Font.PLAIN, 14));
            deleteReadButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    deleteReadButtonActionPerformed(e);
                }
            });
            contentPanel.add(deleteReadButton, cc.xy(9, 15));

            //---- label1 ----
            label1.setText(bundle.getString("JReadTags.label1.text"));
            label1.setHorizontalAlignment(SwingConstants.RIGHT);
            label1.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(label1, cc.xy(3, 17));

            //---- dataToStoreComboBox ----
            dataToStoreComboBox.setModel(new DefaultComboBoxModel<>(new String[] { "EPC", "TID" }));
            dataToStoreComboBox.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(dataToStoreComboBox, cc.xy(5, 17));

            //---- deleteAllButton ----
            deleteAllButton.setText(bundle.getString("JReadTags.deleteAllButton.text"));
            deleteAllButton.setFont(new Font("Tahoma", Font.PLAIN, 14));
            deleteAllButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    deleteAllButtonActionPerformed(e);
                }
            });
            contentPanel.add(deleteAllButton, cc.xy(9, 17));

            //---- allowDuplicateBibsCheckBox ----
            allowDuplicateBibsCheckBox.setText(bundle.getString("JReadTags.allowDuplicateBibsCheckBox.text"));
            contentPanel.add(allowDuplicateBibsCheckBox, cc.xy(5, 19));
        }
        dialogPane.add(contentPanel, BorderLayout.CENTER);

        //======== buttonBar ========
        {
            buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER);
            buttonBar.setLayout(
                    new FormLayout(new ColumnSpec[] { FormFactory.GLUE_COLSPEC, FormFactory.BUTTON_COLSPEC },
                            RowSpec.decodeSpecs("pref")));

            //---- closeButton ----
            closeButton.setText("Cerrar");
            closeButton.setFont(new Font("Tahoma", Font.PLAIN, 14));
            closeButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    closeButtonActionPerformed(e);
                }
            });
            buttonBar.add(closeButton, cc.xy(2, 1));
        }
        dialogPane.add(buttonBar, BorderLayout.SOUTH);
    }
    contentPane.add(dialogPane, BorderLayout.CENTER);
    setSize(710, 675);
    setLocationRelativeTo(getOwner());
    // //GEN-END:initComponents
}

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.navegacao_cego.PainelSimuladorNavegacao.java

/**
 * Cria os componentes/*from  w w  w.java2 s  . co m*/
 * 
 */
private void initComponentsEscalavel() {
    TradSimuladorNavegacao.carregaTexto(TokenLang.LANG);
    JPanel regraFonteBtn = new JPanel();
    regraFonteBtn.setLayout(new BorderLayout());

    textAreaSourceCode = new G_TextAreaSourceCode();
    textAreaSourceCode.getTextPane().setEditable(false);

    // scrollPaneDescricao.getTextPane().setContentType("text/html;");
    conteudoDoAlt = new JTextArea();
    parentFrame.setTitle(TradSimuladorNavegacao.TITULO_SIMULADOR_CEGO);
    parentFrame.setJMenuBar(this.criaMenuBar());
    tabelaDescricao = new TabelaDescricao(this);
    tabelaDescricao.addMouseListener(this);
    conteudoDoAlt = new JTextArea();
    abrir = new JButton();
    cancelar = new JButton();
    btnSalvar = new JMenuItem(GERAL.BTN_SALVAR);

    pnRegra = new JPanel();
    lbRegras1 = new JLabel();
    lbRegras2 = new JLabel();
    pnSetaDescricao = new JPanel();
    spTextoDescricao = new JScrollPane();

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

    pnBotoes = new JPanel();

    buscar = new JButton();

    this.setBackground(CoresDefault.getCorPaineis());
    Container contentPane = this;// ??
    contentPane.setLayout(new GridLayout(2, 1));

    // ======== pnRegra ========
    {
        pnRegra.setBorder(criaBorda(""));
        pnRegra.setLayout(new GridLayout(2, 1));
        pnRegra.add(lbRegras1);
        lbRegras1.setText(TradSimuladorNavegacao.SELECIONE_ITEM_TABELA);
        lbRegras2.setText(TradSimuladorNavegacao.DE_UMA_PAGINA);
        lbRegras1.setHorizontalAlignment(SwingConstants.CENTER);

        lbRegras2.setHorizontalAlignment(SwingConstants.CENTER);
        pnRegra.add(lbRegras1);
        pnRegra.add(lbRegras2);
        pnRegra.setPreferredSize(new Dimension(700, 60));
    }

    // G_URLIcon.setIcon(lbTemp,
    // "http://pitecos.blogs.sapo.pt/arquivo/pai%20natal%20o5.%20jpg.jpg");

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

    abrir.setText(Ferramenta_Scripts.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(10, 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.TELA_ANTERIOR);
    cancelar.setBounds(165, 0, 150, 25);

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

    pnSetaDescricao.setBorder(criaBorda(TradSimuladorNavegacao.DIGITE_TEXTO_BUSCADO));
    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 ========
    {
        spTextoDescricao.setViewportView(conteudoDoAlt);
    }

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

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

        pnListaErros.setBorder(criaBorda(TradSimuladorNavegacao.LINKS_INTERNOS));
        pnListaErros.setLayout(new BorderLayout());
        // ======== scrollPanetabLinCod ========
        {
            scrollPanetabLinCod.setViewportView(tabelaDescricao);
        }
        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) {
                BuscarActionPerformed(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(""));
    textAreaSourceCode.setBackground(CoresDefault.getCorPaineis());

    // JScrollPane ajudaScrollPane = new
    // JScrollPane(ajuda,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    // regraFonteBtn.add(scrollPaneCorrecaoLabel, BorderLayout.CENTER);
    regraFonteBtn.add(textAreaSourceCode, BorderLayout.CENTER);
    pnBotoes.setPreferredSize(new Dimension(600, 35));
    pnBotoes.setBackground(CoresDefault.getCorPaineis());
    // regraFonteBtn.add(pnBotoes, BorderLayout.SOUTH);
    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);
    JPanel pnSalvarCancelar = new JPanel();
    pnSalvarCancelar.setLayout(null);
    pnSalvarCancelar.setPreferredSize(new Dimension(600, 35));

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

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

    this.setVisible(true);

}

From source file:com.funambol.admin.settings.panels.EditServerConfigurationPanel.java

/**
 * Create the panel// ww w.  j  a v  a2 s .  c o  m
 * @throws Exception if error occures during creation of the panel.
 */
private void init() throws Exception {
    final int dy = 25;
    int y = 25;

    int x1 = 15;
    int w1 = 140;
    int w2 = 350;
    int dx = 21;

    int x2 = x1 + w1 + dx;

    setAutoscrolls(true);
    setLayout(null);
    setName(Bundle.getMessage(Bundle.EDIT_SERVER_CONFIGURATION_PANEL_NAME));

    panelNameLabel.setText(Bundle.getMessage(Bundle.EDIT_SERVER_CONFIGURATION_PANEL_NAME));
    panelNameLabel.setBounds(new Rectangle(14, 5, 216, 28));
    panelNameLabel.setAlignmentX(SwingConstants.CENTER);
    panelNameLabel.setBorder(new TitledBorder(""));

    y += dy;

    titleSectionDevInfo.setText(Bundle.getMessage(Bundle.LABEL_DEV_INF));
    titleSectionDevInfo.setBounds(new Rectangle(14, y, 162, 28));
    titleSectionDevInfo.setAlignmentX(SwingConstants.CENTER);
    titleSectionDevInfo.setBorder(new TitledBorder(""));

    y += dy;
    y += 10;

    manLabel.setText(Bundle.getMessage(Bundle.LABEL_MAN) + " :");
    manLabel.setBounds(new Rectangle(x1, y, w1, 18));
    man.setBounds(new Rectangle(x2, y, w2, 18));

    y += dy;

    modLabel.setText(Bundle.getMessage(Bundle.LABEL_MOD) + " :");
    modLabel.setBounds(new Rectangle(x1, y, w1, 18));
    mod.setBounds(new Rectangle(x2, y, w2, 18));

    y += dy;

    swVLabel.setText(Bundle.getMessage(Bundle.LABEL_SWV) + " :");
    swVLabel.setBounds(new Rectangle(x1, y, w1, 18));
    swV.setBounds(new Rectangle(x2, y, w2, 18));
    swV.setEditable(false);

    y += dy;

    hwVLabel.setText(Bundle.getMessage(Bundle.LABEL_HWV) + " :");
    hwVLabel.setBounds(new Rectangle(x1, y, w1, 18));
    hwV.setBounds(new Rectangle(x2, y, w2, 18));

    y += dy;

    fwVLabel.setText(Bundle.getMessage(Bundle.LABEL_FWV) + " :");
    fwVLabel.setBounds(new Rectangle(x1, y, w1, 18));
    fwV.setBounds(new Rectangle(x2, y, w2, 18));

    y += dy;

    oemLabel.setText(Bundle.getMessage(Bundle.LABEL_OEM) + " :");
    oemLabel.setBounds(new Rectangle(x1, y, w1, 18));
    oem.setBounds(new Rectangle(x2, y, w2, 18));

    y += dy;

    devIdLabel.setText(Bundle.getMessage(Bundle.LABEL_DEV_ID) + " :");
    devIdLabel.setBounds(new Rectangle(x1, y, w1, 18));
    devId.setBounds(new Rectangle(x2, y, w2, 18));

    y += dy;

    devTypLabel.setText(Bundle.getMessage(Bundle.LABEL_DEV_TYP) + " :");
    devTypLabel.setBounds(new Rectangle(x1, y, w1, 18));
    devTyp.setBounds(new Rectangle(x2, y, w2, 18));

    y += dy;

    verDTDLabel.setText(Bundle.getMessage(Bundle.LABEL_VER_DTD) + " :");
    verDTDLabel.setBounds(new Rectangle(x1, y, w1, 18));
    verDTD.setBounds(new Rectangle(x2, y, w2, 18));

    y += dy;
    y += 10;

    titleSectionEngineInfo.setText(Bundle.getMessage(Bundle.LABEL_ENGINE_INFO));
    titleSectionEngineInfo.setBounds(new Rectangle(14, y, 162, 28));
    titleSectionEngineInfo.setAlignmentX(SwingConstants.CENTER);
    titleSectionEngineInfo.setBorder(new TitledBorder(""));

    y += 10;
    y += dy;

    serverUriLabel.setText(Bundle.getMessage(Bundle.LABEL_SERVER_URI) + " :");
    serverUriLabel.setBounds(new Rectangle(x1, y, w1, 18));
    serverUri.setBounds(new Rectangle(x2, y, w2, 18));

    y += dy;

    officerLabel.setText(Bundle.getMessage(Bundle.LABEL_OFFICER) + " :");
    officerLabel.setBounds(new Rectangle(x1, y, w1, 18));
    officer.setBounds(new Rectangle(x2, y, w2, 18));

    y += dy;

    handlerLabel.setText(Bundle.getMessage(Bundle.LABEL_HANDLER) + " :");
    handlerLabel.setBounds(new Rectangle(x1, y, w1, 18));
    handler.setBounds(new Rectangle(x2, y, w2, 18));

    y += dy;

    deviceInventoryLabel.setText(Bundle.getMessage(Bundle.LABEL_DEVICE_INVENTORY) + " :");
    deviceInventoryLabel.setBounds(new Rectangle(x1, y, w1, 18));
    deviceInventory.setBounds(new Rectangle(x2, y, w2, 18));

    y += dy;

    dataTransformerManagerLabel.setText(Bundle.getMessage(Bundle.LABEL_DATA_TRANSFORMER_MANAGER) + " :");
    dataTransformerManagerLabel.setBounds(new Rectangle(x1, y, w1, 18));
    dataTransformerManager.setBounds(new Rectangle(x2, y, w2, 18));
    dataTransformerButton.setBounds(new Rectangle(x2 + w2 + 10, y, 85, 18));
    dataTransformerButton.setText(Bundle.getMessage(Bundle.DATA_TRANSFORMER_CONFIGURE_BUTTON));
    dataTransformerButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            String path = dataTransformerManager.getText();
            try {
                ExplorerUtil.getSyncAdminController().getServerSettingsController()
                        .editDataTrasnformerConfiguration(path);
            } catch (AdminException ex) {
                String msg = Bundle.getMessage(Bundle.ERROR_GETTING_DTM_CONFIGURATION);
                NotifyDescriptor desc = new NotifyDescriptor.Message(ex.getMessage());
                DialogDisplayer.getDefault().notify(desc);

                Log.error(msg, ex);

                return;
            }
        }
    });

    y += dy;

    strategyLabel.setText(Bundle.getMessage(Bundle.LABEL_STRATEGY) + " :");
    strategyLabel.setBounds(new Rectangle(x1, y, w1, 18));
    strategy.setBounds(new Rectangle(x2, y, w2, 18));
    strategyButton.setBounds(new Rectangle(x2 + w2 + 10, y, 85, 18));
    strategyButton.setText(Bundle.getMessage(Bundle.LABEL_BUTTON_CONFIGURE));
    strategyButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            String path = strategy.getText();
            try {
                ExplorerUtil.getSyncAdminController().getServerSettingsController()
                        .editStrategyConfiguration(path);
            } catch (AdminException ex) {
                String msg = Bundle.getMessage(Bundle.ERROR_GETTING_STRATEGY_CONFIGURATION);
                NotifyDescriptor desc = new NotifyDescriptor.Message(ex.getMessage());
                DialogDisplayer.getDefault().notify(desc);

                Log.error(msg, ex);

                return;
            }
        }
    });

    y += dy;

    userManagerLabel.setText(Bundle.getMessage(Bundle.LABEL_USER_MANAGER) + " :");
    userManagerLabel.setBounds(new Rectangle(x1, y, w1, 18));
    userManager.setBounds(new Rectangle(x2, y, w2, 18));

    y += dy;

    smsServiceLabel.setText(Bundle.getMessage(Bundle.LABEL_SMS_SERVICE) + " :");
    smsServiceLabel.setBounds(new Rectangle(x1, y, w1, 18));
    smsService.setBounds(new Rectangle(x2, y, w2, 18));

    y += dy;

    minMaxMsgSizeLabel.setText(Bundle.getMessage(Bundle.LABEL_MIN_MAX_MSG_SIZE) + " :");
    minMaxMsgSizeLabel.setBounds(new Rectangle(x1, y, w1, 18));
    minMaxMsgSize.setBounds(new Rectangle(x2, y, w2, 18));

    y += dy;

    checkForUpdatesLabel.setText(Bundle.getMessage(Bundle.LABEL_CHECK_FOR_UPDATES) + " :");
    checkForUpdatesLabel.setBounds(new Rectangle(x1, y, w1, 18));
    checkForUpdates.setBounds(new Rectangle(x2, y, w2, 18));

    y += dy;
    y += dy;

    confirmButton.setText(Bundle.getMessage(Bundle.LABEL_BUTTON_SAVE));
    confirmButton.setBounds(new Rectangle(225, y, 60, 25));

    confirmButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setServerConfiguration();
        }
    });

    cancelButton = new JButton(Bundle.getMessage(Bundle.LABEL_BUTTON_CANCEL));
    cancelButton.setBounds(290, y, 70, 25);

    cancelButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            cancelAction();
        }
    });

    //add components to panel
    add(panelNameLabel, null);
    add(titleSectionDevInfo, null);
    add(manLabel, null);
    add(man, null);
    add(modLabel, null);
    add(mod, null);
    add(swVLabel, null);
    add(swV, null);
    add(hwVLabel, null);
    add(hwV, null);
    add(fwVLabel, null);
    add(fwV, null);
    add(oemLabel, null);
    add(oem, null);
    add(devIdLabel, null);
    add(devId, null);
    add(devTypLabel, null);
    add(devTyp, null);
    add(verDTDLabel, null);
    add(verDTD, null);
    add(titleSectionEngineInfo, null);
    add(serverUriLabel, null);
    add(serverUri, null);
    add(officerLabel, null);
    add(officer, null);
    add(handlerLabel, null);
    add(handler, null);
    add(deviceInventoryLabel, null);
    add(deviceInventory, null);
    add(dataTransformerManagerLabel, null);
    add(dataTransformerManager, null);
    add(dataTransformerButton, null);
    add(strategyLabel, null);
    add(strategy, null);
    add(strategyButton, null);
    add(userManagerLabel, null);
    add(userManager, null);
    add(smsServiceLabel, null);
    add(smsService, null);
    add(minMaxMsgSizeLabel, null);
    add(minMaxMsgSize, null);
    add(checkForUpdatesLabel, null);
    add(checkForUpdates, null);
    add(confirmButton, null);
    add(cancelButton, null);

    GuiFactory.setDefaultFont(this);

    panelNameLabel.setFont(GuiFactory.titlePanelFont);
    titleSectionEngineInfo.setFont(new java.awt.Font("Arial", 2, 12));
    titleSectionDevInfo.setFont(new java.awt.Font("Arial", 2, 12));

}

From source file:game.Clue.ClueGameUI.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 ww .  ja  v  a 2s  .c  o  m*/
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    buttonGroup2 = new javax.swing.ButtonGroup();
    jPanel3 = new javax.swing.JPanel();
    LoginPanel = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    jTextField2 = new javax.swing.JTextField();
    jToggleButton3 = new javax.swing.JToggleButton();
    jLabel12 = new javax.swing.JLabel();
    jProgressBar1 = new javax.swing.JProgressBar();
    CharacterSelectionPanel = new javax.swing.JPanel();
    jLabel3 = new javax.swing.JLabel();
    jToggleButton4 = new javax.swing.JToggleButton();
    jLabel4 = new javax.swing.JLabel();
    jLabel5 = new javax.swing.JLabel();
    jLabel6 = new javax.swing.JLabel();
    jLabel7 = new javax.swing.JLabel();
    jLabel8 = new javax.swing.JLabel();
    jLabel9 = new javax.swing.JLabel();
    jRadioButton1 = new javax.swing.JRadioButton();
    jRadioButton2 = new javax.swing.JRadioButton();
    jRadioButton3 = new javax.swing.JRadioButton();
    jRadioButton4 = new javax.swing.JRadioButton();
    jRadioButton5 = new javax.swing.JRadioButton();
    jRadioButton6 = new javax.swing.JRadioButton();
    jPanel2 = new javax.swing.JPanel();
    jPanel4 = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    jTable1 = new javax.swing.JTable();
    jScrollPane3 = new javax.swing.JScrollPane();
    jTable3 = new javax.swing.JTable();
    jLabel10 = new javax.swing.JLabel();
    jScrollPane2 = new javax.swing.JScrollPane();
    jTable2 = new javax.swing.JTable();
    jPanel5 = new javax.swing.JPanel();
    jLayeredPane5 = new javax.swing.JLayeredPane();
    jButton2 = new javax.swing.JButton();
    jButton4 = new javax.swing.JButton();
    jButton5 = new javax.swing.JButton();
    jLabel2 = new javax.swing.JLabel();
    jLabel15 = new javax.swing.JLabel();
    jLabel16 = new javax.swing.JLabel();
    jToggleButton2 = new javax.swing.JToggleButton();
    jButton6 = new javax.swing.JButton();
    jPanel1 = new javax.swing.JPanel();
    jButton1 = new javax.swing.JButton();
    jButton3 = new javax.swing.JButton();
    jTextField1 = new javax.swing.JTextField();
    jToggleButton1 = new javax.swing.JToggleButton();
    jLabel11 = new javax.swing.JLabel();
    jTextField3 = new javax.swing.JTextField();
    jLabel13 = new javax.swing.JLabel();
    jLabel14 = new javax.swing.JLabel();
    jTextField4 = new javax.swing.JTextField();
    jScrollPane4 = new javax.swing.JScrollPane();
    jTextArea1 = new javax.swing.JTextArea();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setTitle("Clueless");
    setBackground(new java.awt.Color(0, 0, 0));
    setMaximumSize(new java.awt.Dimension(2147483647, 400));
    setResizable(false);

    jPanel3.setMaximumSize(new java.awt.Dimension(2147483647, 400));
    jPanel3.setLayout(new java.awt.CardLayout());

    LoginPanel.setBackground(new java.awt.Color(51, 51, 51));
    LoginPanel.setForeground(new java.awt.Color(255, 153, 153));
    LoginPanel.setMaximumSize(new java.awt.Dimension(32767, 400));
    LoginPanel.setPreferredSize(new java.awt.Dimension(729, 670));
    LoginPanel.setLayout(null);

    jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
    jLabel1.setForeground(new java.awt.Color(255, 255, 255));
    jLabel1.setText("Name:");
    LoginPanel.add(jLabel1);
    jLabel1.setBounds(20, 580, 35, 14);

    jTextField2.setMaximumSize(new java.awt.Dimension(6, 20));
    jTextField2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jTextField2ActionPerformed(evt);
        }
    });
    LoginPanel.add(jTextField2);
    jTextField2.setBounds(90, 570, 110, 30);

    jToggleButton3.setText("Start/Join a game");
    jToggleButton3.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            jToggleButton3ItemStateChanged(evt);
        }
    });
    jToggleButton3.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jToggleButton3ActionPerformed(evt);
        }
    });
    LoginPanel.add(jToggleButton3);
    jToggleButton3.setBounds(40, 610, 130, 23);

    jLabel12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/logo-login3.jpg"))); // NOI18N
    jLabel12.setText("jLabel12");
    jLabel12.setMaximumSize(new java.awt.Dimension(729, 670));
    jLabel12.setMinimumSize(new java.awt.Dimension(729, 670));
    jLabel12.setPreferredSize(new java.awt.Dimension(729, 670));
    LoginPanel.add(jLabel12);
    jLabel12.setBounds(0, 0, 729, 670);
    LoginPanel.add(jProgressBar1);
    jProgressBar1.setBounds(40, 640, 146, 14);

    jPanel3.add(LoginPanel, "card4");

    CharacterSelectionPanel.setBackground(new java.awt.Color(102, 153, 255));
    CharacterSelectionPanel.setMaximumSize(new java.awt.Dimension(32767, 400));
    CharacterSelectionPanel.setPreferredSize(new java.awt.Dimension(729, 670));

    jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
    jLabel3.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/resources/characterImages/ColonelMustard.png"))); // NOI18N
    jLabel3.setPreferredSize(new java.awt.Dimension(175, 233));

    buttonGroup2.add(jToggleButton4);
    jToggleButton4.setText("Next");
    jToggleButton4.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            jToggleButton4ItemStateChanged(evt);
        }
    });
    jToggleButton4.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jToggleButton4ActionPerformed(evt);
        }
    });

    jLabel4.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N
    jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel4.setText("Character Selection");
    jLabel4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);

    jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
    jLabel5.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/resources/characterImages/MissScarlett.png"))); // NOI18N
    jLabel5.setToolTipText("");
    jLabel5.setPreferredSize(new java.awt.Dimension(175, 233));

    jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
    jLabel6.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/resources/characterImages/MrGreen.png"))); // NOI18N
    jLabel6.setPreferredSize(new java.awt.Dimension(175, 233));

    jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
    jLabel7.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/resources/characterImages/MrsPeacock.png"))); // NOI18N
    jLabel7.setPreferredSize(new java.awt.Dimension(175, 233));

    jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
    jLabel8.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/resources/characterImages/MrsWhite.png"))); // NOI18N
    jLabel8.setPreferredSize(new java.awt.Dimension(175, 233));

    jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
    jLabel9.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/resources/characterImages/ProfessorPlum.png"))); // NOI18N
    jLabel9.setPreferredSize(new java.awt.Dimension(175, 233));

    buttonGroup2.add(jRadioButton1);

    buttonGroup2.add(jRadioButton2);

    buttonGroup2.add(jRadioButton3);
    jRadioButton3.setToolTipText("");

    buttonGroup2.add(jRadioButton4);

    buttonGroup2.add(jRadioButton5);

    buttonGroup2.add(jRadioButton6);

    javax.swing.GroupLayout CharacterSelectionPanelLayout = new javax.swing.GroupLayout(
            CharacterSelectionPanel);
    CharacterSelectionPanel.setLayout(CharacterSelectionPanelLayout);
    CharacterSelectionPanelLayout.setHorizontalGroup(CharacterSelectionPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, CharacterSelectionPanelLayout
                    .createSequentialGroup().addGap(47, 47, 47)
                    .addGroup(CharacterSelectionPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(CharacterSelectionPanelLayout.createSequentialGroup()
                                    .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 175,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 156,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(CharacterSelectionPanelLayout.createSequentialGroup()
                                    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 175,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(31, 31, 31).addComponent(jLabel5,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 175,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 41, Short.MAX_VALUE)
                    .addGroup(CharacterSelectionPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 175,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 158,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(85, 85, 85))
            .addGroup(CharacterSelectionPanelLayout.createSequentialGroup().addGap(131, 131, 131)
                    .addComponent(jRadioButton1).addGap(170, 170, 170).addComponent(jRadioButton2)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jRadioButton3).addGap(162, 162, 162))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, CharacterSelectionPanelLayout
                    .createSequentialGroup().addGap(131, 131, 131).addComponent(jRadioButton4)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jRadioButton5).addGap(169, 169, 169).addComponent(jRadioButton6)
                    .addGap(171, 171, 171))
            .addGroup(CharacterSelectionPanelLayout.createSequentialGroup()
                    .addGroup(CharacterSelectionPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(CharacterSelectionPanelLayout.createSequentialGroup()
                                    .addGap(158, 158, 158).addComponent(jLabel4))
                            .addGroup(CharacterSelectionPanelLayout.createSequentialGroup()
                                    .addGap(329, 329, 329).addComponent(jToggleButton4)))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    CharacterSelectionPanelLayout.setVerticalGroup(
            CharacterSelectionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(CharacterSelectionPanelLayout.createSequentialGroup()
                            .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 32,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(32, 32, 32)
                            .addGroup(CharacterSelectionPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 233,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 233,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 233,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(CharacterSelectionPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(CharacterSelectionPanelLayout.createSequentialGroup()
                                            .addGap(5, 5, 5).addComponent(jRadioButton1))
                                    .addGroup(CharacterSelectionPanelLayout.createSequentialGroup()
                                            .addGap(7, 7, 7).addComponent(jRadioButton2))
                                    .addGroup(CharacterSelectionPanelLayout.createSequentialGroup()
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(jRadioButton3)))
                            .addGap(18, 18, 18)
                            .addGroup(CharacterSelectionPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 233,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 233,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 233,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(18, 18, 18)
                            .addGroup(CharacterSelectionPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jRadioButton6).addComponent(jRadioButton5)
                                    .addComponent(jRadioButton4))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jToggleButton4).addContainerGap(25, Short.MAX_VALUE)));

    jPanel3.add(CharacterSelectionPanel, "card5");

    jPanel2.setBackground(new java.awt.Color(204, 204, 204));
    jPanel2.setMaximumSize(new java.awt.Dimension(720, 400));
    jPanel2.setPreferredSize(new java.awt.Dimension(729, 670));

    jPanel4.setBackground(new java.awt.Color(204, 102, 0));

    jTable1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
    jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object[][] { { "Mrs.White", null }, { "Mr. Plum", null }, { "Miss Scarlet", null },
                    { "Mr. Green", null }, { "Mrs.Peacock", null }, { "Col. Mustard", null } },
            new String[] { "SUSPECTS", "" }) {
        boolean[] canEdit = new boolean[] { false, true };

        public boolean isCellEditable(int rowIndex, int columnIndex) {
            return canEdit[columnIndex];
        }
    });
    jScrollPane1.setViewportView(jTable1);

    jTable3.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
    jTable3.setModel(
            new javax.swing.table.DefaultTableModel(
                    new Object[][] { { "Hall", null }, { "Lounge", null }, { "Library", null },
                            { "Kitchen", null }, { "Dining Room", null }, { "Billiard Room", null },
                            { "Study", null }, { "Ballroom", null }, { "Conservatory", null } },
                    new String[] { "ROOMS", "P1" }));
    jScrollPane3.setViewportView(jTable3);

    jLabel10.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
    jLabel10.setText("Scorecard");

    jTable2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
    jTable2.setModel(new javax.swing.table.DefaultTableModel(
            new Object[][] { { "CandleStick", null }, { "Knife", null }, { "LeadPipe", null },
                    { "Revolver", null }, { "Rope", null }, { "Wrench", null } },
            new String[] { "WEAPONS", "" }) {
        boolean[] canEdit = new boolean[] { false, true };

        public boolean isCellEditable(int rowIndex, int columnIndex) {
            return canEdit[columnIndex];
        }
    });
    jScrollPane2.setViewportView(jTable2);

    jPanel5.setBackground(new java.awt.Color(51, 51, 51));

    javax.swing.GroupLayout jLayeredPane5Layout = new javax.swing.GroupLayout(jLayeredPane5);
    jLayeredPane5.setLayout(jLayeredPane5Layout);
    jLayeredPane5Layout.setHorizontalGroup(jLayeredPane5Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 701, Short.MAX_VALUE));
    jLayeredPane5Layout.setVerticalGroup(jLayeredPane5Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 0, Short.MAX_VALUE));

    javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
    jPanel5.setLayout(jPanel5Layout);
    jPanel5Layout.setHorizontalGroup(jPanel5Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup().addContainerGap()
                    .addComponent(jLayeredPane5, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel5Layout
                    .createSequentialGroup().addGap(22, 22, 22).addComponent(jLayeredPane5).addContainerGap()));

    jLayeredPane5.addMouseListener(this);
    jLayeredPane5.addMouseMotionListener(this);
    jLayeredPane5.add(player, JLayeredPane.DRAG_LAYER);

    jButton2.setText("Make Accusation");
    jButton2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton2ActionPerformed(evt);
        }
    });

    jButton4.setText("(unused) jButton4");
    jButton4.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton4ActionPerformed(evt);
        }
    });

    jButton5.setText("Make A Suggestion");
    jButton5.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton5ActionPerformed(evt);
        }
    });

    jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/cards/Ballroom.PNG"))); // NOI18N
    jLabel2.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            jLabel2MouseClicked(evt);
        }
    });

    jLabel15.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/cards/Candlestick.PNG"))); // NOI18N
    jLabel15.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            jLabel15MouseClicked(evt);
        }
    });

    jLabel16.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/resources/characterImages/ColonelMustard.png"))); // NOI18N
    jLabel16.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            jLabel16MouseClicked(evt);
        }
    });

    jToggleButton2.setText("jToggleButton2");
    jToggleButton2.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            jToggleButton2ItemStateChanged(evt);
        }
    });
    jToggleButton2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jToggleButton2ActionPerformed(evt);
        }
    });

    jButton6.setText("Move");
    jButton6.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton6ActionPerformed(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)
                    .addGroup(jPanel4Layout.createSequentialGroup().addContainerGap().addGroup(jPanel4Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.LEADING,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel4Layout
                                    .createSequentialGroup().addGap(25, 25, 25)
                                    .addGroup(jPanel4Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                                    false)
                                            .addComponent(jButton2)
                                            .addComponent(jButton5, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(jToggleButton2).addComponent(jButton4)
                                            .addComponent(jButton6, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 130,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel4Layout.createSequentialGroup().addGap(21, 21, 21).addComponent(jLabel10)))
                    .addGap(11, 11, 11)
                    .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel15).addComponent(jLabel2).addComponent(jLabel16))
                    .addContainerGap(3138, Short.MAX_VALUE)));
    jPanel4Layout
            .setVerticalGroup(jPanel4Layout
                    .createParallelGroup(
                            javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup().addGap(23, 23, 23).addComponent(jLabel10)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 131,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 97,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 133,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(37, 37, 37).addComponent(jToggleButton2)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jButton4)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jButton2)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jButton5)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jButton6).addGap(3, 3, 3))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                            jPanel4Layout.createSequentialGroup().addGap(59, 59, 59).addComponent(jLabel2)
                                    .addGap(58, 58, 58).addComponent(jLabel15).addGap(18, 18, 18)
                                    .addComponent(jLabel16)
                                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));

    javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout.setHorizontalGroup(jPanel2Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                    .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, Short.MAX_VALUE)));
    jPanel2Layout
            .setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                            jPanel2Layout.createSequentialGroup().addContainerGap()
                                    .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addContainerGap()));

    jPanel3.add(jPanel2, "card3");

    jPanel1.setMaximumSize(new java.awt.Dimension(32767, 400));
    jPanel1.setPreferredSize(new java.awt.Dimension(729, 670));

    jButton1.setText("Connect to Server");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton1ActionPerformed(evt);
        }
    });

    jButton3.setText("Send Message to Server");
    jButton3.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton3ActionPerformed(evt);
        }
    });

    jToggleButton1.setText("Go To Gameboard");
    jToggleButton1.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            jToggleButton1ItemStateChanged(evt);
        }
    });
    jToggleButton1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jToggleButton1ActionPerformed(evt);
        }
    });

    jLabel11.setText("Technical Page for Server Communication..Wont be used in Game");

    jTextField3.setText("192.168.1.8");

    jLabel13.setText("IP address:");

    jLabel14.setText("Port:");

    jTextField4.setText("8888");

    jTextArea1.setColumns(20);
    jTextArea1.setRows(5);
    jScrollPane4.setViewportView(jTextArea1);

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(jPanel1Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup().addGap(180, 180, 180).addGroup(jPanel1Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jToggleButton1).addComponent(jLabel11)
                            .addGroup(jPanel1Layout.createSequentialGroup().addComponent(jButton1)
                                    .addGap(42, 42, 42)
                                    .addGroup(jPanel1Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel13).addComponent(jLabel14))
                                    .addGap(18, 18, 18)
                                    .addGroup(jPanel1Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    102, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    58, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(jPanel1Layout.createSequentialGroup().addGap(50, 50, 50).addComponent(
                                    jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 255,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(jPanel1Layout.createSequentialGroup().addGap(247, 247, 247)
                            .addGroup(jPanel1Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jButton3).addComponent(jTextField1,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 139,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addContainerGap(211, Short.MAX_VALUE)));
    jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup().addGap(25, 25, 25).addComponent(jLabel11)
                    .addGap(101, 101, 101)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jButton1)
                            .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel13))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel14)
                            .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(8, 8, 8).addComponent(jToggleButton1).addGap(41, 41, 41)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 154,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jButton3).addContainerGap(190, Short.MAX_VALUE)));

    jPanel3.add(jPanel1, "card2");

    getContentPane().add(jPanel3, java.awt.BorderLayout.PAGE_END);

    pack();
}

From source file:edu.ku.brc.af.tasks.subpane.formeditor.ViewSetSelectorPanel.java

/**
 * /*from   w ww . j a  v  a2s .  com*/
 */
@SuppressWarnings("unchecked") //$NON-NLS-1$
public ViewSetSelectorPanel(final BasicFormPreviewPanel previewPanel) {
    this.previewPanel = previewPanel;

    Vector<String> levelsVec = new Vector<String>();
    SpecifyUser user = AppContextMgr.getInstance().getClassObject(SpecifyUser.class);
    @SuppressWarnings("unused")
    Hashtable<Discipline, Boolean> usedColTypes = new Hashtable<Discipline, Boolean>();

    levelsVec.add(user.getUserType());

    //        for (Agent agent : user.getAgents())
    //        {
    //            // XXX Commented Out
    //            /*Discipline ct = agent.getDiscipline();
    //            if (usedColTypes.get(ct) == null)
    //            {
    //                levelsVec.add(ct.getName());
    //                usedColTypes.put(ct, true);
    //            }*/
    //        }
    levelsVec.add("BackStop"); //$NON-NLS-1$

    addBtn = UIHelper.createIconBtn("PlusSign", "", new ActionListener() { //$NON-NLS-1$ //$NON-NLS-2$
        public void actionPerformed(ActionEvent arg0) {
            addControl();
        }
    });

    delBtn = UIHelper.createIconBtn("MinusSign", "", new ActionListener() { //$NON-NLS-1$ //$NON-NLS-2$
        public void actionPerformed(ActionEvent arg0) {
            delControl(TYPE.SelectedObj);
        }
    });

    ActionListener addViewAL = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            addView();
        }
    };

    ActionListener delViewAL = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            delView();
        }
    };

    viewControlPanel = new EditDeleteAddPanel(null, delViewAL, addViewAL);

    ActionListener addAltViewAL = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            addAltView();
        }
    };

    ActionListener delAltViewAL = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            delAltView();
        }
    };

    altViewControlPanel = new EditDeleteAddPanel(null, delAltViewAL, addAltViewAL);

    ActionListener addDefViewAL = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            addViewDef();
        }
    };

    ActionListener delDefViewAL = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            delViewDef();
        }
    };

    viewDefControlPanel = new EditDeleteAddPanel(null, delDefViewAL, addDefViewAL);

    ActionListener saveAL = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            save();
        }
    };
    EditDeleteAddPanel saveControlPanel = new EditDeleteAddPanel(null, null, saveAL);
    saveControlPanel.getAddBtn().setIcon(IconManager.getIcon("Save", IconManager.IconSize.Std16)); //$NON-NLS-1$
    saveControlPanel.getAddBtn().setEnabled(true);

    setLayout(new BorderLayout());

    levelsList = new JList(levelsVec);
    panel = new EditorPropPanel(controlHash, subcontrolHash, null, true, this);
    //panel.setFormViewDef(null);

    PanelBuilder pb = new PanelBuilder(new FormLayout("p,4px,p, 6px,10px,6px, p,6px,p, 6px,10px,6px, p,f:p:g", //$NON-NLS-1$
            "p,2px,f:p:g,2px,p,10px,p,4px")); //$NON-NLS-1$
    CellConstraints cc = new CellConstraints();

    String[] labels = new String[] { "User Level", "ViewSets", " ", "Views", "AltViews", " ", "View Defs" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
    int x = 1;
    for (String label : labels) {
        pb.add(createLabel(label, SwingConstants.CENTER), cc.xy(x, 1));
        x += 2;
    }

    Color vsFGColor = new Color(224, 224, 224);
    Color vsBGColor = new Color(124, 124, 124);

    Dimension ps = new Dimension(200, 150);

    x = 1;
    JScrollPane sp = createScrollPane(levelsList);
    pb.add(sp, cc.xy(x, 3));
    x += 2;

    viewSetsList = new JList(new DefaultListModel());
    sp = createScrollPane(viewSetsList);
    sp.setPreferredSize(ps);
    pb.add(sp, cc.xy(x, 3));
    x += 2;

    pb.add(new VerticalSeparator(vsFGColor, vsBGColor), cc.xy(x, 3));
    x += 2;

    viewsList = new JList(new DefaultListModel());
    sp = new JScrollPane(viewsList, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    sp.setPreferredSize(ps);
    pb.add(sp, cc.xy(x, 3));
    x += 2;

    altViewsList = new JList(new DefaultListModel());
    sp = createScrollPane(altViewsList);
    sp.setPreferredSize(ps);
    pb.add(sp, cc.xy(x, 3));
    x += 2;

    pb.add(new VerticalSeparator(vsFGColor, vsBGColor), cc.xy(x, 3));
    x += 2;

    viewDefsList = new JList(new DefaultListModel());
    sp = createScrollPane(viewDefsList);
    sp.setPreferredSize(ps);
    pb.add(sp, cc.xy(x, 3));
    x += 2;

    pb.add(saveControlPanel, cc.xy(1, 5));
    //pb.add(createLabel(" "),     cc.xy(3, 5));
    //pb.add(createLabel(" "),     cc.xy(5, 5));
    pb.add(viewControlPanel, cc.xy(7, 5));
    pb.add(altViewControlPanel, cc.xy(9, 5));
    //pb.add(createLabel(" "),     cc.xy(11, 5));
    pb.add(viewDefControlPanel, cc.xy(13, 5));

    pb.addSeparator("View Def Editor", cc.xywh(1, 7, 13, 1)); //$NON-NLS-1$

    add(pb.getPanel(), BorderLayout.NORTH);

    pb = new PanelBuilder(new FormLayout("max(250px;p),4px,f:p:g", "t:p")); //$NON-NLS-1$ //$NON-NLS-2$

    PanelBuilder inner = new PanelBuilder(new FormLayout("max(250px;p)", "t:p,2px,t:p")); //$NON-NLS-1$ //$NON-NLS-2$
    tree = new JTree();
    ((DefaultTreeModel) tree.getModel()).setRoot(null);
    sp = createScrollPane(tree);
    inner.add(sp, cc.xy(1, 1));

    PanelBuilder btnPb = new PanelBuilder(new FormLayout("f:p:g,p,2px,p", "p")); //$NON-NLS-1$ //$NON-NLS-2$
    btnPb.add(delBtn, cc.xy(2, 1));
    btnPb.add(addBtn, cc.xy(4, 1));
    inner.add(btnPb.getPanel(), cc.xy(1, 3));

    pb.add(inner.getPanel(), cc.xy(1, 1));
    pb.add(panel, cc.xy(3, 1));

    add(pb.getPanel(), BorderLayout.CENTER);

    tree.addTreeSelectionListener(new TreeSelectionListener() {
        public void valueChanged(TreeSelectionEvent e) {
            treeSelected();
        }
    });

    levelsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                levelSelected();
            }
        }
    });

    viewSetsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                viewSetSelected();
            }
        }
    });

    viewsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                viewSelected();
            }
        }
    });

    altViewsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                altViewSelected();
            }
        }
    });

    viewDefsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                viewDefSelected();
            }
        }
    });

    tree.addMouseListener(new MouseAdapter() {

        protected void doPopup(MouseEvent e) {
            if (e.isPopupTrigger()) {
                int xc = e.getX();
                int yc = e.getY();
                TreePath path = tree.getPathForLocation(xc, yc);
                if (path != null) {
                    tree.setSelectionPath(path);
                }

                treeSelected();

                DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) tree.getSelectionModel()
                        .getSelectionPath().getLastPathComponent();

                if (selectedCell != null || selectedRow != null) {
                    new TreePopupMenu((Component) e.getSource(), e, selectedCell);

                } else if (selectedNode.getUserObject() instanceof FormViewDef) {
                    new TreePopupMenu((Component) e.getSource(), e);
                }
            }
        }

        public void mouseReleased(MouseEvent e) {
            doPopup(e);
        }

        public void mousePressed(MouseEvent e) {
            doPopup(e);
        }
    });

    XStream xstream = new XStream();
    xstream.alias("control", Control.class); //$NON-NLS-1$
    xstream.useAttributeFor(Control.class, "type"); //$NON-NLS-1$
    xstream.useAttributeFor(Attr.class, "type"); //$NON-NLS-1$
    xstream.useAttributeFor(Attr.class, "name"); //$NON-NLS-1$
    xstream.useAttributeFor(Attr.class, "required"); //$NON-NLS-1$
    xstream.useAttributeFor(Attr.class, "defaultValue"); //$NON-NLS-1$
    xstream.aliasAttribute("default", "defaultValue"); //$NON-NLS-1$ //$NON-NLS-2$

    xstream.alias("uicontrols", Vector.class); //$NON-NLS-1$
    xstream.alias("attr", Attr.class); //$NON-NLS-1$
    xstream.alias("param", Param.class); //$NON-NLS-1$
    xstream.alias("subcontrol", SubControl.class); //$NON-NLS-1$
    xstream.aliasAttribute("desc", "desc"); //$NON-NLS-1$ //$NON-NLS-2$
    xstream.aliasAttribute(Attr.class, "values", "values"); //$NON-NLS-1$ //$NON-NLS-2$
    xstream.useAttributeFor(SubControl.class, "type"); //$NON-NLS-1$

    try {
        controls = (Vector<Control>) xstream.fromXML(FileUtils.readFileToString(new File("UIControls.xml"))); //$NON-NLS-1$
        for (Control control : controls) {
            controlHash.put(control.getType(), control);
            if (control.getSubcontrols() != null) {
                for (SubControl sc : control.getSubcontrols()) {
                    //System.out.println(" ["+sc.getType()+"]  ");
                    subcontrolHash.put(sc.getType(), sc);
                }
            }
        }

    } catch (IOException ex) {
        edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
        edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(ViewSetSelectorPanel.class, ex);
        ex.printStackTrace();
    }
}

From source file:com.diversityarrays.kdxplore.field.PlotIdTrialLayoutPane.java

@Override
public JComponent getFieldLayoutPane(FieldLayout<Integer>[] returnLayout) {
    int runLength = runLengthModel.getNumber().intValue();
    if (runLength <= 0) {
        fieldLayoutRunLengthLE_0.setText("RunLength=" + runLength);
        return fieldLayoutRunLengthLE_0;
    }//from w ww.  j  a va2  s .c  o  m

    int firstPlotId = plotIdModel.getNumber().intValue();

    PlotIdFieldLayoutProcessor layoutProcessor = new PlotIdFieldLayoutProcessor();
    FieldLayout<Integer> fieldLayout = layoutProcessor.layoutField(plotIdentSummary, odtPanel.getOrigin(),
            firstPlotId, odtPanel.getOrientation(), runLength, odtPanel.getTraversal());

    if (returnLayout != null && returnLayout.length > 0) {
        returnLayout[0] = fieldLayout;
    }

    Border insideBorder = new LineBorder(Color.BLACK);
    Border outsideBorder = new EmptyBorder(1, 1, 1, 1);
    Border border = new CompoundBorder(outsideBorder, insideBorder);

    GridLayout gridLayout = new GridLayout(fieldLayout.ysize, fieldLayout.xsize);
    if (DEBUG) {
        System.out.println(
                "GridLayout( rows=" + gridLayout.getRows() + " , cols=" + gridLayout.getColumns() + ")");
    }

    fieldLayoutRunLengthGT_0.setLayout(gridLayout);

    fieldLayoutRunLengthGT_0.removeAll();
    for (int y = 0; y < fieldLayout.ysize; ++y) {
        for (int x = 0; x < fieldLayout.xsize; ++x) {
            Integer plotId = fieldLayout.cells[y][x];

            String label_s;
            if (plotId == null) {
                label_s = ".";
            } else {
                PlotName plotName = plotNameByPlotId.get(plotId);
                if (plotName == null) {
                    label_s = "-";
                } else {
                    //s = "P_" + plotId + ":" + x + "," + y;
                    StringBuilder sb = new StringBuilder("P_");
                    sb.append(plotName.getPlotId());
                    Integer xx = plotName.getX();
                    Integer yy = plotName.getY();

                    if (xx != null || yy != null) {
                        sb.append(": ");
                        if (xx != null) {
                            sb.append(xx);
                        }
                        sb.append(",");
                        if (yy != null) {
                            sb.append(yy);
                        }
                    }
                    label_s = sb.toString();
                }
            }
            JLabel label = new JLabel("<HTML><BR>" + label_s + "<BR>&nbsp;");
            label.setHorizontalAlignment(SwingConstants.CENTER);
            label.setBorder(border);
            fieldLayoutRunLengthGT_0.add(label);
        }
    }

    return fieldLayoutRunLengthGT_0;
}