Example usage for java.awt Container setLayout

List of usage examples for java.awt Container setLayout

Introduction

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

Prototype

public void setLayout(LayoutManager mgr) 

Source Link

Document

Sets the layout manager for this container.

Usage

From source file:org.openmicroscopy.shoola.agents.util.ui.ScriptingDialog.java

/** Builds and lays out the UI. */
private void buildGUI() {
    String text = TEXT;/*  ww  w  . j  av a2 s .  c o  m*/
    TitlePanel tp = new TitlePanel(TITLE, text, script.getIconLarge());
    Container c = getContentPane();
    c.removeAll();
    c.setLayout(new BorderLayout(0, 0));
    c.add(tp, BorderLayout.NORTH);
    c.add(buildBody(), BorderLayout.CENTER);
}

From source file:op.care.nursingprocess.DlgNursingProcess.java

/**
 * This method is called from within the constructor to
 * initialize the form./* w  w  w.j a  va 2 s . com*/
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the PrinterForm Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    jPanel5 = new JPanel();
    lblTopic = new JLabel();
    txtStichwort = new JTextField();
    lblCat = new JLabel();
    cmbKategorie = new JComboBox<>();
    panel4 = new JPanel();
    lblSituation = new JLabel();
    btnPopoutSituation = new JButton();
    jScrollPane3 = new JScrollPane();
    txtSituation = new JTextArea();
    panel5 = new JPanel();
    lblGoal = new JLabel();
    btnPopoutGoal = new JButton();
    jScrollPane1 = new JScrollPane();
    txtZiele = new JTextArea();
    lblFirstRevision = new JLabel();
    jdcKontrolle = new JDateChooser();
    panel2 = new JPanel();
    jspPlanung = new JScrollPane();
    tblPlanung = new JTable();
    panel3 = new JPanel();
    btnAddIntervention = new JButton();
    panel1 = new JPanel();
    btnCancel = new JButton();
    btnSave = new JButton();

    //======== this ========
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    Container contentPane = getContentPane();
    contentPane.setLayout(new FormLayout("14dlu, $lcgap, 280dlu:grow, $ugap, pref, $lcgap, 14dlu",
            "fill:14dlu, $lgap, fill:default:grow, $rgap, pref, $lgap, 14dlu"));

    //======== jPanel5 ========
    {
        jPanel5.setLayout(new FormLayout("default, $lcgap, default:grow",
                "fill:default, $rgap, default, 2*($lgap, fill:default:grow), $lgap, 70dlu, $lgap, pref"));

        //---- lblTopic ----
        lblTopic.setFont(new Font("Arial", Font.PLAIN, 14));
        lblTopic.setText("Stichwort");
        jPanel5.add(lblTopic, CC.xy(1, 1, CC.DEFAULT, CC.TOP));

        //---- txtStichwort ----
        txtStichwort.setFont(new Font("Arial", Font.BOLD, 20));
        txtStichwort.addFocusListener(new FocusAdapter() {
            @Override
            public void focusGained(FocusEvent e) {
                txtStichwortFocusGained(e);
            }
        });
        jPanel5.add(txtStichwort, CC.xy(3, 1));

        //---- lblCat ----
        lblCat.setFont(new Font("Arial", Font.PLAIN, 14));
        lblCat.setText("Kategorie");
        jPanel5.add(lblCat, CC.xy(1, 3));

        //---- cmbKategorie ----
        cmbKategorie
                .setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cmbKategorie.setFont(new Font("Arial", Font.PLAIN, 14));
        jPanel5.add(cmbKategorie, CC.xy(3, 3));

        //======== panel4 ========
        {
            panel4.setLayout(new BorderLayout());

            //---- lblSituation ----
            lblSituation.setFont(new Font("Arial", Font.PLAIN, 14));
            lblSituation.setText("Situation");
            panel4.add(lblSituation, BorderLayout.CENTER);

            //---- btnPopoutSituation ----
            btnPopoutSituation.setText(null);
            btnPopoutSituation.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/popup.png")));
            btnPopoutSituation.setBorderPainted(false);
            btnPopoutSituation.setContentAreaFilled(false);
            btnPopoutSituation
                    .setSelectedIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/pressed.png")));
            btnPopoutSituation.setBorder(null);
            btnPopoutSituation.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnPopoutSituation.addActionListener(e -> btnPopoutSituationActionPerformed(e));
            panel4.add(btnPopoutSituation, BorderLayout.EAST);
        }
        jPanel5.add(panel4, CC.xy(1, 5, CC.DEFAULT, CC.TOP));

        //======== jScrollPane3 ========
        {

            //---- txtSituation ----
            txtSituation.setColumns(20);
            txtSituation.setLineWrap(true);
            txtSituation.setRows(5);
            txtSituation.setWrapStyleWord(true);
            txtSituation.setFont(new Font("Arial", Font.PLAIN, 14));
            txtSituation.addFocusListener(new FocusAdapter() {
                @Override
                public void focusGained(FocusEvent e) {
                    txtSituationFocusGained(e);
                }
            });
            jScrollPane3.setViewportView(txtSituation);
        }
        jPanel5.add(jScrollPane3, CC.xy(3, 5));

        //======== panel5 ========
        {
            panel5.setLayout(new BorderLayout());

            //---- lblGoal ----
            lblGoal.setFont(new Font("Arial", Font.PLAIN, 14));
            lblGoal.setText("Ziele");
            panel5.add(lblGoal, BorderLayout.CENTER);

            //---- btnPopoutGoal ----
            btnPopoutGoal.setText(null);
            btnPopoutGoal.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/popup.png")));
            btnPopoutGoal.setBorderPainted(false);
            btnPopoutGoal.setContentAreaFilled(false);
            btnPopoutGoal
                    .setSelectedIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/pressed.png")));
            btnPopoutGoal.setBorder(null);
            btnPopoutGoal.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnPopoutGoal.addActionListener(e -> btnPopoutGoalActionPerformed(e));
            panel5.add(btnPopoutGoal, BorderLayout.EAST);
        }
        jPanel5.add(panel5, CC.xy(1, 7, CC.DEFAULT, CC.TOP));

        //======== jScrollPane1 ========
        {

            //---- txtZiele ----
            txtZiele.setColumns(20);
            txtZiele.setLineWrap(true);
            txtZiele.setRows(5);
            txtZiele.setWrapStyleWord(true);
            txtZiele.setFont(new Font("Arial", Font.PLAIN, 14));
            txtZiele.addFocusListener(new FocusAdapter() {
                @Override
                public void focusGained(FocusEvent e) {
                    txtZieleFocusGained(e);
                }
            });
            jScrollPane1.setViewportView(txtZiele);
        }
        jPanel5.add(jScrollPane1, CC.xy(3, 7));

        //---- lblFirstRevision ----
        lblFirstRevision.setFont(new Font("Arial", Font.PLAIN, 14));
        lblFirstRevision.setText("Erste Kontrolle am");
        jPanel5.add(lblFirstRevision, CC.xy(1, 11));

        //---- jdcKontrolle ----
        jdcKontrolle.setFont(new Font("Arial", Font.PLAIN, 14));
        jPanel5.add(jdcKontrolle, CC.xy(3, 11));
    }
    contentPane.add(jPanel5, CC.xy(3, 3, CC.DEFAULT, CC.FILL));

    //======== panel2 ========
    {
        panel2.setLayout(new FormLayout("default:grow", "default, $lgap, default"));

        //======== jspPlanung ========
        {
            jspPlanung.addComponentListener(new ComponentAdapter() {
                @Override
                public void componentResized(ComponentEvent e) {
                    jspPlanungComponentResized(e);
                }
            });

            //---- tblPlanung ----
            tblPlanung.setModel(new DefaultTableModel(
                    new Object[][] { { null, null, null, null }, { null, null, null, null },
                            { null, null, null, null }, { null, null, null, null }, },
                    new String[] { "Title 1", "Title 2", "Title 3", "Title 4" }));
            tblPlanung.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
            tblPlanung.addMouseListener(new MouseAdapter() {
                @Override
                public void mousePressed(MouseEvent e) {
                    tblPlanungMousePressed(e);
                }
            });
            jspPlanung.setViewportView(tblPlanung);
        }
        panel2.add(jspPlanung, CC.xy(1, 1));

        //======== panel3 ========
        {
            panel3.setLayout(new BoxLayout(panel3, BoxLayout.X_AXIS));

            //---- btnAddIntervention ----
            btnAddIntervention.setText(null);
            btnAddIntervention.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png")));
            btnAddIntervention.setContentAreaFilled(false);
            btnAddIntervention.setBorderPainted(false);
            btnAddIntervention.setBorder(null);
            btnAddIntervention
                    .setPressedIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png")));
            btnAddIntervention.addActionListener(e -> btnAddInterventionActionPerformed(e));
            panel3.add(btnAddIntervention);
        }
        panel2.add(panel3, CC.xy(1, 3));
    }
    contentPane.add(panel2, CC.xy(5, 3));

    //======== panel1 ========
    {
        panel1.setLayout(new HorizontalLayout(5));

        //---- btnCancel ----
        btnCancel.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/cancel.png")));
        btnCancel.setText(null);
        btnCancel.addActionListener(e -> btnCancelActionPerformed(e));
        panel1.add(btnCancel);

        //---- btnSave ----
        btnSave.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/apply.png")));
        btnSave.setText(null);
        btnSave.addActionListener(e -> btnSaveActionPerformed(e));
        panel1.add(btnSave);
    }
    contentPane.add(panel1, CC.xy(5, 5, CC.RIGHT, CC.DEFAULT));
    setSize(1145, 695);
    setLocationRelativeTo(getOwner());
}

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

/**
 * Cria os componentes/*from   ww  w.  j  av  a2 s .c  o 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:ru.goodfil.catalog.ui.forms.FilterWindow.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Evaluation license - Sasha aaa
    contentPanel = new JPanel();
    label16 = new JLabel();
    label17 = new JLabel();
    label18 = new JLabel();
    label1 = new JLabel();
    cbFilterType = new JComboBox();
    label5 = new JLabel();
    tbAParam = new JTextField();
    label2 = new JLabel();
    cbFilterForm = new JComboBox();
    label6 = new JLabel();
    tbBParam = new JTextField();
    label3 = new JLabel();
    tbName = new JTextField();
    label7 = new JLabel();
    tbCParam = new JTextField();
    label4 = new JLabel();
    panel2 = new JPanel();
    tbImage = new JTextField();
    btnUploadImage = new JButton();
    label8 = new JLabel();
    tbDParam = new JTextField();
    label19 = new JLabel();
    cbFilterStatus = new JComboBox();
    label9 = new JLabel();
    tbEParam = new JTextField();
    label15 = new JLabel();
    scrollPane1 = new JScrollPane();
    tbAdditionalInfo = new JTextArea();
    label10 = new JLabel();
    tbFParam = new JTextField();
    label11 = new JLabel();
    tbGParam = new JTextField();
    label12 = new JLabel();
    tbHParam = new JTextField();
    label13 = new JLabel();
    tbPbParam = new JTextField();
    label14 = new JLabel();
    tbNrParam = new JTextField();
    panel1 = new JPanel();
    okButton = new JButton();
    cancelButton = new JButton();
    CellConstraints cc = new CellConstraints();

    //======== this ========
    setModal(true);//from  w  w w.  j  a  v a  2  s . c  o  m
    setTitle("\u0424\u0438\u043b\u044c\u0442\u0440");
    Container contentPane = getContentPane();
    contentPane.setLayout(new FormLayout("default:grow", "fill:default:grow"));

    //======== contentPanel ========
    {

        // JFormDesigner evaluation mark
        contentPanel.setBorder(new javax.swing.border.CompoundBorder(
                new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0),
                        "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER,
                        javax.swing.border.TitledBorder.BOTTOM,
                        new java.awt.Font("Dialog", java.awt.Font.BOLD, 12), java.awt.Color.red),
                contentPanel.getBorder()));
        contentPanel.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent e) {
                if ("border".equals(e.getPropertyName()))
                    throw new RuntimeException();
            }
        });

        contentPanel.setLayout(new FormLayout(
                "$rgap, default, $lcgap, default:grow, $lcgap, right:20dlu, $lcgap, default:grow, $rgap",
                "13*(default, $lgap), fill:default:grow, $lgap, default"));

        //---- label16 ----
        label16.setText(
                "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0444\u0438\u043b\u044c\u0442\u0440\u0435. ");
        contentPanel.add(label16, cc.xywh(2, 1, 7, 1));

        //---- label17 ----
        label17.setText(
                "\u041f\u043e\u043b\u044f, \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0435 \u0437\u0432\u0435\u0437\u0434\u043e\u0447\u043a\u0430\u043c\u0438, \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.");
        contentPanel.add(label17, cc.xywh(2, 3, 7, 1));

        //---- label18 ----
        label18.setText(
                "\u0427\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u0438\u043f \u0438\u043b\u0438 \u0444\u043e\u0440\u043c\u0443 \u043f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u0432 \"\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b\"->\"\u0422\u0438\u043f\u044b \u0438 \u0444\u043e\u0440\u043c\u044b \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\"");
        label18.setForeground(Color.blue);
        contentPanel.add(label18, cc.xywh(2, 5, 7, 1));

        //---- label1 ----
        label1.setText("\u0422\u0438\u043f*");
        contentPanel.add(label1, cc.xy(2, 7));
        contentPanel.add(cbFilterType, cc.xy(4, 7));

        //---- label5 ----
        label5.setText("A");
        contentPanel.add(label5, cc.xy(6, 7));
        contentPanel.add(tbAParam, cc.xy(8, 7));

        //---- label2 ----
        label2.setText("\u0424\u043e\u0440\u043c\u0430*");
        contentPanel.add(label2, cc.xy(2, 9));
        contentPanel.add(cbFilterForm, cc.xy(4, 9));

        //---- label6 ----
        label6.setText("B");
        contentPanel.add(label6, cc.xy(6, 9));
        contentPanel.add(tbBParam, cc.xy(8, 9));

        //---- label3 ----
        label3.setText("\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435*");
        contentPanel.add(label3, cc.xy(2, 11));

        //---- tbName ----
        tbName.addKeyListener(new KeyAdapter() {
            @Override
            public void keyTyped(KeyEvent e) {
                tbNameKeyTyped(e);
            }
        });
        tbName.addFocusListener(new FocusAdapter() {
            @Override
            public void focusGained(FocusEvent e) {
                tbNameFocusGained(e);
            }

            @Override
            public void focusLost(FocusEvent e) {
                tbNameFocusGained(e);
            }
        });
        contentPanel.add(tbName, cc.xy(4, 11));

        //---- label7 ----
        label7.setText("C");
        contentPanel.add(label7, cc.xy(6, 11));
        contentPanel.add(tbCParam, cc.xy(8, 11));

        //---- label4 ----
        label4.setText("\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435");
        contentPanel.add(label4, cc.xy(2, 13));

        //======== panel2 ========
        {
            panel2.setLayout(new FormLayout("default:grow, $lcgap, default", "default"));
            panel2.add(tbImage, cc.xy(1, 1));

            //---- btnUploadImage ----
            btnUploadImage.setText("...");
            btnUploadImage.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnUploadImageActionPerformed();
                }
            });
            panel2.add(btnUploadImage, cc.xy(3, 1));
        }
        contentPanel.add(panel2, cc.xy(4, 13));

        //---- label8 ----
        label8.setText("D");
        contentPanel.add(label8, cc.xy(6, 13));
        contentPanel.add(tbDParam, cc.xy(8, 13));

        //---- label19 ----
        label19.setText("\u0421\u0442\u0430\u0442\u0443\u0441");
        contentPanel.add(label19, cc.xy(2, 15));

        //---- cbFilterStatus ----
        cbFilterStatus.setModel(new DefaultComboBoxModel(new String[] {
                "\u0412 \u041f\u0420\u041e\u0418\u0417\u0412\u041e\u0414\u0421\u0422\u0412\u0415",
                "\u041f\u041e\u0421\u0422\u0410\u0412\u041b\u042f\u0415\u0422\u0421\u042f",
                "\u041d\u0415 \u041f\u041e\u0421\u0422\u0410\u0412\u041b\u042f\u0415\u0422\u0421\u042f" }));
        contentPanel.add(cbFilterStatus, cc.xy(4, 15));

        //---- label9 ----
        label9.setText("E");
        contentPanel.add(label9, cc.xy(6, 15));
        contentPanel.add(tbEParam, cc.xy(8, 15));

        //---- label15 ----
        label15.setText("\u0414\u043e\u043f. \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f");
        contentPanel.add(label15, cc.xy(2, 17));

        //======== scrollPane1 ========
        {
            scrollPane1.setViewportView(tbAdditionalInfo);
        }
        contentPanel.add(scrollPane1, cc.xywh(4, 17, 1, 11));

        //---- label10 ----
        label10.setText("F");
        contentPanel.add(label10, cc.xy(6, 17));
        contentPanel.add(tbFParam, cc.xy(8, 17));

        //---- label11 ----
        label11.setText("G");
        contentPanel.add(label11, cc.xy(6, 19));
        contentPanel.add(tbGParam, cc.xy(8, 19));

        //---- label12 ----
        label12.setText("H");
        contentPanel.add(label12, cc.xy(6, 21));
        contentPanel.add(tbHParam, cc.xy(8, 21));

        //---- label13 ----
        label13.setText("PB");
        contentPanel.add(label13, cc.xy(6, 23));
        contentPanel.add(tbPbParam, cc.xy(8, 23));

        //---- label14 ----
        label14.setText("NR");
        contentPanel.add(label14, cc.xy(6, 25));
        contentPanel.add(tbNrParam, cc.xy(8, 25));

        //======== panel1 ========
        {
            panel1.setLayout(new FormLayout("default:grow, 2*($lcgap, $button)", "default"));

            //---- okButton ----
            okButton.setText("OK");
            okButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    okButtonActionPerformed(e);
                }
            });
            panel1.add(okButton, cc.xy(3, 1));

            //---- cancelButton ----
            cancelButton.setText("\u041e\u0442\u043c\u0435\u043d\u0430");
            cancelButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    cancelButtonActionPerformed(e);
                }
            });
            panel1.add(cancelButton, cc.xy(5, 1));
        }
        contentPanel.add(panel1, cc.xywh(2, 29, 7, 1));
    }
    contentPane.add(contentPanel, cc.xy(1, 1));
    pack();
    setLocationRelativeTo(getOwner());
    // JFormDesigner - End of component initialization  //GEN-END:initComponents

    cbFilterType.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                SelectItem selectItem = (SelectItem) e.getItem();
                FilterType ft = carsService.getFilterTypeByCode(selectItem.getId());
                reReadFilterForms(ft.getCode());

            }
        }
    });

    cbFilterForm.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                adjustParameters();
                adjustButtonsEnabled();
            }
        }
    });
}

From source file:org.photovault.swingui.BrowserWindow.java

protected void createUI(PhotoCollection collection) {
    window.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    tabPane = new JTabbedPane();
    queryPane = new QueryPane();
    PhotoFolderTreeController treeCtrl = new PhotoFolderTreeController(window, this);
    viewCtrl = new PhotoViewController(window, this);
    treePane = treeCtrl.folderTree;//w w w.  j  a  v  a 2s .  c o m
    viewPane = viewCtrl.getThumbPane();
    previewPane = viewCtrl.getPreviewPane();
    tabPane.addTab("Query", queryPane);
    tabPane.addTab("Folders", treePane);

    VolumeTreeController volTreeCtrl = new VolumeTreeController(this);
    JTree volumeTree = volTreeCtrl.getView();
    JScrollPane voltreeScrollPane = new JScrollPane(volumeTree);
    voltreeScrollPane.setPreferredSize(new Dimension(200, 500));
    tabPane.add("Volumes", voltreeScrollPane);

    // TODO: get rid of this!!!!
    EditSelectionColorsAction colorAction = (EditSelectionColorsAction) viewPane.getEditSelectionColorsAction();
    colorAction.setPreviewCtrl(previewPane);

    // Set listeners to both query and folder tree panes

    /*
    If an actionEvent comes from query pane, swich to query results.
     */
    queryPane.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            viewCtrl.setCollection(queryPane.getResultCollection());
        }
    });

    /*
    If the selected folder is changed in treePane, switch to that immediately
     */

    treeCtrl.registerEventListener(PhotoFolderTreeEvent.class, new DefaultEventListener<PhotoCollection>() {

        public void handleEvent(DefaultEvent<PhotoCollection> event) {
            PhotoCollection c = event.getPayload();
            if (c != null) {
                viewCtrl.setCollection(c);
                if (c instanceof PhotoFolder) {
                    PhotoFolder f = (PhotoFolder) c;

                    if (f.getExternalDir() != null) {
                        ExternalDir ed = f.getExternalDir();
                        folderIndexer.updateDir(ed.getVolume(), ed.getPath());
                        viewCtrl.setIndexingOngoing(true);
                    }
                }
            }
        }
    });

    volTreeCtrl.registerEventListener(PhotoFolderTreeEvent.class, new DefaultEventListener<PhotoCollection>() {

        public void handleEvent(DefaultEvent<PhotoCollection> event) {
            PhotoCollection c = event.getPayload();
            if (c != null) {
                viewCtrl.setCollection(c);
                if (c instanceof ExtDirPhotos) {
                    ExtDirPhotos photos = (ExtDirPhotos) c;
                    ExternalVolume vol = (ExternalVolume) viewCtrl.getDAOFactory().getVolumeDAO()
                            .getVolume(photos.getVolId());
                    folderIndexer.updateDir(vol, photos.getDirPath());
                    viewCtrl.setIndexingOngoing(true);
                }
            }
        }
    });

    collectionPane = viewCtrl.getCollectionPane();

    JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, tabPane, collectionPane);
    split.putClientProperty(JSplitPane.ONE_TOUCH_EXPANDABLE_PROPERTY, new Boolean(true));
    Container cp = window.getContentPane();
    cp.setLayout(new BorderLayout());
    cp.add(split, BorderLayout.CENTER);

    statusBar = new StatusBar();
    cp.add(statusBar, BorderLayout.SOUTH);

    // Create actions for BrowserWindow UI

    ImageIcon indexDirIcon = getIcon("index_dir.png");
    DefaultAction indexDirAction = new DefaultAction("Index directory...", indexDirIcon) {

        public void actionPerformed(ActionEvent e) {
            indexDir();
        }
    };
    indexDirAction.putValue(AbstractAction.MNEMONIC_KEY, KeyEvent.VK_D);
    indexDirAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Index all images in a directory");
    this.registerAction("new_ext_vol", indexDirAction);

    ImageIcon importIcon = getIcon("import.png");
    importAction = new AbstractAction("Import image...", importIcon) {

        public void actionPerformed(ActionEvent e) {
            importFile();
        }
    };
    importAction.putValue(AbstractAction.MNEMONIC_KEY, KeyEvent.VK_O);
    importAction.putValue(AbstractAction.ACCELERATOR_KEY,
            KeyStroke.getKeyStroke(KeyEvent.VK_O, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));

    importAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Import new image into database");

    ImageIcon updateIcon = getIcon("update_indexed_dirs.png");
    UpdateIndexAction updateIndexAction = new UpdateIndexAction(viewCtrl, "Update indexed dirs", updateIcon,
            "Check for changes in previously indexed directories", KeyEvent.VK_U);
    this.registerAction("update_indexed_dirs", updateIndexAction);
    updateIndexAction.addStatusChangeListener(statusBar);

    ImageIcon previewTopIcon = getIcon("view_preview_top.png");
    DefaultAction previewTopAction = new DefaultAction("Preview on top", previewTopIcon) {

        public void actionPerformed(ActionEvent e) {
            viewCtrl.setLayout(PhotoViewController.Layout.PREVIEW_HORIZONTAL_THUMBS);
        }
    };
    previewTopAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Show preview on top of thumbnails");
    previewTopAction.putValue(AbstractAction.MNEMONIC_KEY, KeyEvent.VK_T);
    this.registerAction("view_preview_top", previewTopAction);

    ImageIcon previewRightIcon = getIcon("view_preview_right.png");
    DefaultAction previewRightAction = new DefaultAction("Preview on right", previewRightIcon) {

        public void actionPerformed(ActionEvent e) {
            viewCtrl.setLayout(PhotoViewController.Layout.PREVIEW_VERTICAL_THUMBS);
        }
    };
    previewRightAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Show preview on right of thumbnails");
    previewRightAction.putValue(AbstractAction.MNEMONIC_KEY, KeyEvent.VK_R);
    this.registerAction("view_preview_right", previewRightAction);

    ImageIcon previewNoneIcon = getIcon("view_no_preview.png");
    DefaultAction previewNoneAction = new DefaultAction("No preview", previewNoneIcon) {

        public void actionPerformed(ActionEvent e) {
            viewCtrl.setLayout(PhotoViewController.Layout.ONLY_THUMBS);
        }
    };
    previewNoneAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Show no preview image");
    previewNoneAction.putValue(AbstractAction.MNEMONIC_KEY, KeyEvent.VK_O);
    this.registerAction("view_no_preview", previewNoneAction);

    DefaultAction previewLargeAction = new DefaultAction("Large", null) {

        public void actionPerformed(ActionEvent e) {
            viewCtrl.setPreviewSize(200);
        }
    };
    DefaultAction previewSmallAction = new DefaultAction("Small", null) {

        public void actionPerformed(ActionEvent e) {
            viewCtrl.setPreviewSize(100);
        }
    };

    JToolBar tb = createToolbar();
    cp.add(tb, BorderLayout.NORTH);

    // Create the menu bar & menus
    JMenuBar menuBar = new JMenuBar();
    window.setJMenuBar(menuBar);
    // File menu
    JMenu fileMenu = new JMenu("File");
    fileMenu.setMnemonic(KeyEvent.VK_F);
    menuBar.add(fileMenu);

    JMenuItem newWindowItem = new JMenuItem("New window", KeyEvent.VK_N);
    newWindowItem.setIcon(getIcon("window_new.png"));
    newWindowItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            BrowserWindow br = new BrowserWindow(getParentController(), null);
            //          br.setVisible( true );
        }
    });
    fileMenu.add(newWindowItem);

    JMenuItem importItem = new JMenuItem(importAction);
    fileMenu.add(importItem);

    JMenuItem indexDirItem = new JMenuItem(indexDirAction);
    fileMenu.add(indexDirItem);

    fileMenu.add(new JMenuItem(viewCtrl.getActionAdapter("update_indexed_dirs")));

    ExportSelectedAction exportAction = (ExportSelectedAction) viewPane.getExportSelectedAction();
    JMenuItem exportItem = new JMenuItem(exportAction);
    exportAction.addStatusChangeListener(statusBar);
    fileMenu.add(exportItem);

    JMenu dbMenu = new JMenu("Database");
    dbMenu.setMnemonic(KeyEvent.VK_B);
    dbMenu.setIcon(getIcon("empty_icon.png"));

    ExportMetadataAction exportMetadata = new ExportMetadataAction("Export as XML...", null,
            "Export whole database as XML file", KeyEvent.VK_E);
    dbMenu.add(new JMenuItem(exportMetadata));

    ImportXMLAction importMetadata = new ImportXMLAction("Import XML data...", null,
            "Import data from other Photovault database as XML", KeyEvent.VK_I);
    importMetadata.addStatusChangeListener(statusBar);
    dbMenu.add(new JMenuItem(importMetadata));

    fileMenu.add(dbMenu);

    JMenuItem exitItem = new JMenuItem("Exit", KeyEvent.VK_X);
    exitItem.setIcon(getIcon("exit.png"));
    exitItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            System.exit(0);
        }
    });
    fileMenu.add(exitItem);

    JMenu viewMenu = new JMenu("View");
    viewMenu.setMnemonic(KeyEvent.VK_V);
    menuBar.add(viewMenu);

    JMenuItem vertIconsItem = new JMenuItem(previewRightAction);
    viewMenu.add(vertIconsItem);

    JMenuItem horzIconsItem = new JMenuItem(previewTopAction);
    viewMenu.add(horzIconsItem);

    JMenuItem noPreviewItem = new JMenuItem(previewNoneAction);
    viewMenu.add(noPreviewItem);

    JMenuItem nextPhotoItem = new JMenuItem(viewPane.getSelectNextAction());
    viewMenu.add(nextPhotoItem);

    JMenuItem prevPhotoItem = new JMenuItem(viewPane.getSelectPreviousAction());
    viewMenu.add(prevPhotoItem);

    viewMenu.add(new JMenuItem(previewSmallAction));
    viewMenu.add(new JMenuItem(previewLargeAction));

    JMenu sortMenu = new JMenu("Sort by");
    sortMenu.setMnemonic(KeyEvent.VK_S);
    sortMenu.setIcon(getIcon("empty_icon.png"));
    JMenuItem byDateItem = new JMenuItem(new SetPhotoOrderAction(viewCtrl, new ShootingDateComparator(), "Date",
            null, "Order photos by date", KeyEvent.VK_D));
    sortMenu.add(byDateItem);
    JMenuItem byPlaceItem = new JMenuItem(new SetPhotoOrderAction(viewCtrl, new ShootingPlaceComparator(),
            "Place", null, "Order photos by shooting place", KeyEvent.VK_P));
    sortMenu.add(byPlaceItem);
    JMenuItem byQualityItem = new JMenuItem(new SetPhotoOrderAction(viewCtrl, new QualityComparator(),
            "Quality", null, "Order photos by quality", KeyEvent.VK_Q));
    sortMenu.add(byQualityItem);
    viewMenu.add(sortMenu);

    // Set default ordering by date
    byDateItem.getAction().actionPerformed(new ActionEvent(this, 0, "Setting default"));
    JMenu imageMenu = new JMenu("Image");
    imageMenu.setMnemonic(KeyEvent.VK_I);
    menuBar.add(imageMenu);

    imageMenu.add(new JMenuItem(viewPane.getEditSelectionPropsAction()));
    imageMenu.add(new JMenuItem(viewPane.getShowSelectedPhotoAction()));
    imageMenu.add(new JMenuItem(viewCtrl.getActionAdapter("rotate_cw")));
    imageMenu.add(new JMenuItem(viewCtrl.getActionAdapter("rotate_ccw")));
    imageMenu.add(new JMenuItem(viewCtrl.getActionAdapter("rotate_180")));
    imageMenu.add(new JMenuItem(previewPane.getCropAction()));
    imageMenu.add(new JMenuItem(viewPane.getEditSelectionColorsAction()));
    imageMenu.add(new JMenuItem(viewPane.getDeleteSelectedAction()));

    // Create the Quality submenu
    JMenu qualityMenu = new JMenu("Quality");
    qualityMenu.setIcon(getIcon("empty_icon.png"));

    for (int n = 0; n < 6; n++) {
        Action qualityAction = viewCtrl.getActionAdapter("quality_" + n);
        JMenuItem qualityMenuItem = new JMenuItem(qualityAction);
        qualityMenu.add(qualityMenuItem);
    }
    imageMenu.add(qualityMenu);

    JMenu aboutMenu = new JMenu("About");
    aboutMenu.setMnemonic(KeyEvent.VK_A);
    aboutMenu.add(new JMenuItem(new ShowAboutDlgAction("About Photovault...", null, "", null)));

    menuBar.add(Box.createHorizontalGlue());
    menuBar.add(aboutMenu);
    window.pack();
    window.setVisible(true);
}

From source file:edu.clemson.cs.nestbed.client.gui.TestbedManagerFrame.java

public TestbedManagerFrame() throws RemoteException, NotBoundException, MalformedURLException {
    super(WINDOW_TITLE);

    lookupRemoteManagers();//from  w  w w.j  a va  2s . c  om
    // TODO: testbedManager.addRemoteObserver(new TestbedObserver());
    projectManager.addRemoteObserver(new ProjectObserver());
    configManager.addRemoteObserver(new ProjectDeploymentConfigObserver());

    createComponents();

    setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
    setJMenuBar(buildMenuBar());

    Container c = getContentPane();
    c.setLayout(new BorderLayout());
    c.add(buildListPanel(), BorderLayout.CENTER);

    this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    this.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            doExit();
        }
    });
}

From source file:course_generator.param.frmEditCurve.java

/**
 * This method is called to initialize the form.
 */// w w  w.  ja  va2  s  .  com
private void initComponents() {
    int line = 0;

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setTitle(bundle.getString("frmEditCurve.title"));
    setPreferredSize(new Dimension(1200, 600));
    setAlwaysOnTop(true);
    setResizable(false);
    setType(java.awt.Window.Type.UTILITY);
    addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosing(java.awt.event.WindowEvent evt) {
            formWindowClosing(evt);
        }
    });

    // -- Layout
    // ------------------------------------------------------------
    Container paneGlobal = getContentPane();
    paneGlobal.setLayout(new GridBagLayout());

    //-- Curves list
    ListCurves = new javax.swing.JList<>();
    model = new ParamListModel();
    ListCurves.setModel(model);
    ListCurves.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
    ListCurves.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            SelectCurve();
        }
    });
    jScrollPaneCurves = new javax.swing.JScrollPane();
    jScrollPaneCurves.setViewportView(ListCurves);

    Utils.addComponent(paneGlobal, jScrollPaneCurves, 0, 0, 1, 4, 0.5, 1, 10, 10, 0, 0,
            GridBagConstraints.PAGE_START, GridBagConstraints.BOTH);

    //-- Curve management toolbar
    CreateCurvesToolbar();
    Utils.addComponent(paneGlobal, ToolBarAction, 1, 0, 1, 4, 0, 0, 10, 0, 0, 0,
            GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);

    lbSelectedCurve = new javax.swing.JLabel();
    lbSelectedCurve.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    lbSelectedCurve.setText("Selected");
    lbSelectedCurve.setHorizontalAlignment(JLabel.LEFT);
    Utils.addComponent(paneGlobal, lbSelectedCurve, 2, 0, GridBagConstraints.REMAINDER, 1, 1, 0, 10, 0, 5, 10,
            GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);

    //-- Curve name
    lbName = new javax.swing.JLabel();
    lbName.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    lbName.setText(" " + bundle.getString("frmEditCurve.lbName.text") + " ");
    Utils.addComponent(paneGlobal, lbName, 2, 1, 1, 1, 0, 0, 0, 0, 5, 0, GridBagConstraints.BASELINE_LEADING,
            GridBagConstraints.HORIZONTAL);

    lbNameVal = new javax.swing.JLabel();
    lbNameVal.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    Utils.addComponent(paneGlobal, lbNameVal, 3, 1, GridBagConstraints.REMAINDER, 1, 1, 0, 0, 5, 5, 10,
            GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);

    //-- Curve comment
    lbComment = new javax.swing.JLabel();
    lbComment.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    lbComment.setText(" " + bundle.getString("frmEditCurve.lbComment.text") + " ");
    Utils.addComponent(paneGlobal, lbComment, 2, 2, 1, 1, 0, 0, 0, 0, 5, 0, GridBagConstraints.BASELINE_LEADING,
            GridBagConstraints.HORIZONTAL);

    tfComment = new JTextField();
    tfComment.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    Utils.addComponent(paneGlobal, tfComment, 3, 2, GridBagConstraints.REMAINDER, 1, 1, 0, 0, 5, 5, 10,
            GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);

    //-- Point list
    TablePoints = new javax.swing.JTable();
    TablePoints.setModel(tablemodel);//new ParamPointsModel(param));
    TablePoints.getTableHeader().setReorderingAllowed(false);
    TablePoints.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            //            TableMainMouseClicked(evt);
        }
    });
    TablePoints.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyReleased(java.awt.event.KeyEvent evt) {
            //            TableMainKeyReleased(evt);
        }
    });

    jScrollPanePoint = new javax.swing.JScrollPane();
    jScrollPanePoint.setViewportView(TablePoints);
    Utils.addComponent(paneGlobal, jScrollPanePoint, 2, 3, 2, 1, 0.5, 0, 0, 0, 0, 0,
            GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);

    //-- Edit toolbar
    CreateEditToolbar();
    Utils.addComponent(paneGlobal, ToolBarEdit, 4, 3, 1, 1, 0, 0, 0, 0, 0, 0,
            GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);

    jPanelProfilChart = new ChartPanel(chart);
    Utils.addComponent(paneGlobal, jPanelProfilChart, 5, 3, 1, 1, 1, 0, 0, 0, 0, 10,
            GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
    CrosshairOverlay crosshairOverlay = new CrosshairOverlay();
    xCrosshair = new Crosshair(Double.NaN, Color.DARK_GRAY, new BasicStroke(0f));
    xCrosshair.setLabelVisible(true);
    xCrosshair.setLabelBackgroundPaint(Color.WHITE);

    yCrosshair = new Crosshair(Double.NaN, Color.DARK_GRAY, new BasicStroke(0f));
    yCrosshair.setLabelVisible(true);
    yCrosshair.setLabelBackgroundPaint(Color.WHITE);

    crosshairOverlay.addDomainCrosshair(xCrosshair);
    crosshairOverlay.addRangeCrosshair(yCrosshair);

    jPanelProfilChart.addOverlay(crosshairOverlay);
    jPanelProfilChart.setBackground(new java.awt.Color(255, 0, 51));
    jPanelProfilChart.addChartMouseListener(new ChartMouseListener() {
        @Override
        public void chartMouseClicked(ChartMouseEvent event) {

            ChartEntity chartentity = event.getEntity();
            if (chartentity instanceof XYItemEntity) {
                XYItemEntity e = (XYItemEntity) chartentity;
                XYDataset d = e.getDataset();
                int s = e.getSeriesIndex();
                int i = e.getItem();
                double x = d.getXValue(s, i);
                double y = d.getYValue(s, i);
                xCrosshair.setValue(x);
                yCrosshair.setValue(y);
            }
        }

        @Override
        public void chartMouseMoved(ChartMouseEvent event) {
        }
    });

    // == Bottom button
    // ===========================================================
    btOk = new javax.swing.JButton();
    btOk.setText(bundle.getString("frmEditCurve.btOk.text"));
    btOk.setIcon(new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/valid.png")));
    btOk.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            RequestToClose();
        }
    });
    Utils.addComponent(paneGlobal, btOk, 0, 5, GridBagConstraints.REMAINDER, 1, 0, 0, 10, 0, 10, 0,
            GridBagConstraints.CENTER, GridBagConstraints.NONE);

    // --
    pack();

    //-- Refresh the curve list
    RefreshCurveList();

    //-- Center the windows
    setLocationRelativeTo(null);
}

From source file:loci.slim2.process.interactive.ui.DefaultDecayGraph.java

@Override
public JFrame init(final JFrame parentFrame, final int bins, final double timeInc,
        final PixelPicker pixelPicker) {
    if (null == frame || !frame.isVisible() || this.bins != bins || this.timeInc != timeInc) {
        // save incoming parameters
        this.bins = bins;
        this.timeInc = timeInc;
        maxValue = timeInc * bins;//from  w  w  w  .java2  s  .com
        this.picker = pixelPicker;

        if (null != frame) {
            // delete existing frame
            frame.setVisible(false);
            frame.dispose();
        }

        // create the combined chart
        final JFreeChart chart = createCombinedChart(bins, timeInc);
        final ChartPanel panel = new ChartPanel(chart, true, true, true, false, true);
        panel.setDomainZoomable(false);
        panel.setRangeZoomable(false);
        panel.setPreferredSize(SIZE);

        // add start/stop vertical bar handling
        dataStart = transStop = null;
        final JXLayer<JComponent> layer = new JXLayer<JComponent>(panel);
        startStopDraggingUI = new StartStopDraggingUI<JComponent>(panel, decaySubPlot, this, maxValue);
        layer.setUI(startStopDraggingUI);

        // create a frame for the chart
        frame = new JFrame();
        final Container container = frame.getContentPane();
        container.setLayout(new BorderLayout());
        container.add(layer, BorderLayout.CENTER);

        final JPanel miscPane = new JPanel();
        miscPane.setLayout(new FlowLayout());
        final JLabel label1 = new JLabel(CHI_SQUARE);
        miscPane.add(label1);
        chiSqTextField = new JTextField(7);
        chiSqTextField.setEditable(false);
        miscPane.add(chiSqTextField);
        final JLabel label2 = new JLabel(PHOTON_COUNT);
        miscPane.add(label2);
        photonTextField = new JTextField(7);
        photonTextField.setEditable(false);
        miscPane.add(photonTextField);
        logCheckBox = new JCheckBox(LOGARITHMIC);
        logCheckBox.setSelected(logarithmic);
        logCheckBox.addItemListener(new ItemListener() {

            @Override
            public void itemStateChanged(final ItemEvent e) {
                logarithmic = logCheckBox.isSelected();
                NumberAxis photonAxis;
                if (logarithmic) {
                    photonAxis = new LogarithmicAxis(PHOTON_AXIS_LABEL);
                } else {
                    photonAxis = new NumberAxis(PHOTON_AXIS_LABEL);
                }
                decaySubPlot.setRangeAxis(photonAxis);
            }
        });
        miscPane.add(logCheckBox);
        container.add(miscPane, BorderLayout.SOUTH);

        System.out.println("size from prefs " + getSizeFromPreferences());
        // _frame.setSize(getSizeFromPreferences());
        // _frame.setMaximumSize(MAX_SIZE); // doesn't work; bug in Java
        frame.pack();
        frame.setLocationRelativeTo(parentFrame);
        frame.setVisible(true);
        frame.addComponentListener(new ComponentListener() {

            @Override
            public void componentHidden(final ComponentEvent e) {

            }

            @Override
            public void componentMoved(final ComponentEvent e) {

            }

            @Override
            public void componentResized(final ComponentEvent e) {
                // constrain maximum size
                boolean resize = false;
                final Dimension size = frame.getSize();
                System.out.println("COMPONENT RESIZED incoming size " + size);
                if (size.width > MAX_SIZE.width) {
                    size.width = MAX_SIZE.width;
                    resize = true;
                }
                if (size.height > MAX_SIZE.height) {
                    size.height = MAX_SIZE.height;
                    resize = true;
                }
                if (size.width < MIN_SIZE.width) {
                    size.width = MIN_SIZE.width;
                    resize = true;
                }
                if (size.height < MIN_SIZE.height) {
                    size.height = MIN_SIZE.height;
                    resize = true;
                }
                if (resize) {
                    frame.setSize(size);
                }
                System.out.println("save resized " + resize + " size " + size);
                saveSizeInPreferences(size);
            }

            @Override
            public void componentShown(final ComponentEvent e) {

            }
        });
        this.frame.addWindowListener(new WindowAdapter() {

            @Override
            public void windowClosing(final WindowEvent e) {
                if (null != picker) {
                    // TODO ARG does not work if you use the name 'pixelPicker'
                    // (collides with local var; this.pP won't work).
                    picker.hideCursor();
                }
            }
        });
        this.frame.setSize(getSizeFromPreferences());
    }
    return this.frame;
}

From source file:org.openconcerto.erp.core.finance.accounting.element.AnalytiqueSQLElement.java

private void actionModifierAxe(MouseEvent e, final int index) {

    if (index == -1)
        return;//from w w w.  jav  a  2  s  .c  o  m

    Component comp = (Component) e.getSource();
    JFrame frame = (JFrame) SwingUtilities.getRoot(comp);

    this.windowChangeNom = new JWindow(frame);
    Container container = this.windowChangeNom.getContentPane();
    container.setLayout(new GridBagLayout());

    final GridBagConstraints c = new DefaultGridBagConstraints();
    c.insets = new Insets(0, 0, 0, 0);
    c.weightx = 1;

    this.editedAxeIndex = index;
    this.text = new JTextField(" " + this.tabAxes.getTitleAt(index) + " ");
    this.text.setEditable(true);
    container.add(this.text, c);
    this.text.setBorder(null);
    // text.setBackground(this.tabAxes.getBackground());
    this.text.addKeyListener(new KeyAdapter() {

        public void keyPressed(KeyEvent event) {

            if (event.getKeyCode() == KeyEvent.VK_ENTER) {
                validAxeText();
            }
        }

    });

    this.windowChangeNom.pack();

    int ecartY = this.tabAxes.getBoundsAt(index).height - this.text.getBounds().height + 2;
    int ecartX = this.tabAxes.getBoundsAt(index).width - this.text.getBounds().width;

    this.windowChangeNom.setLocation(
            comp.getLocationOnScreen().x + this.tabAxes.getBoundsAt(index).getLocation().x + ecartX / 2,
            comp.getLocationOnScreen().y + this.tabAxes.getBoundsAt(index).getLocation().y + ecartY / 2);

    this.windowChangeNom.setVisible(true);
}

From source file:loci.slim.ui.DecayGraph.java

/**
 * Initialize the graph and returns the containing JFrame.
 *
 * @return frame/*from  w w  w.  j a  v a2  s.  co m*/
 */
@Override
public JFrame init(final JFrame frame, final int bins, final double timeInc,
        final ICursorListener cursorListener) {
    final boolean create = false;
    if (null == _frame || !_frame.isVisible() || _bins != bins || _timeInc != timeInc) {
        // save incoming parameters
        _bins = bins;
        _timeInc = timeInc;
        _maxValue = timeInc * bins;
        _cursorListener = cursorListener;

        if (null != _frame) {
            // delete existing frame
            _frame.setVisible(false);
            _frame.dispose();
        }

        // create the combined chart
        final JFreeChart chart = createCombinedChart(bins, timeInc);
        final ChartPanel panel = new ChartPanel(chart, true, true, true, false, true);
        panel.setDomainZoomable(false);
        panel.setRangeZoomable(false);
        panel.setPreferredSize(SIZE);

        // add start/stop vertical bar handling
        _dataStart = _transStop = null;
        final JXLayer<JComponent> layer = new JXLayer<JComponent>(panel);
        _startStopDraggingUI = new StartStopDraggingUI<JComponent>(panel, _decaySubPlot, this, _maxValue);
        layer.setUI(_startStopDraggingUI);

        // create a frame for the chart
        _frame = new JFrame();
        final Container container = _frame.getContentPane();
        container.setLayout(new BorderLayout());
        container.add(layer, BorderLayout.CENTER);

        final JPanel miscPane = new JPanel();
        miscPane.setLayout(new FlowLayout());
        final JLabel label1 = new JLabel(CHI_SQUARE);
        miscPane.add(label1);
        _chiSqTextField = new JTextField(7);
        _chiSqTextField.setEditable(false);
        miscPane.add(_chiSqTextField);
        final JLabel label2 = new JLabel(PHOTON_COUNT);
        miscPane.add(label2);
        _photonTextField = new JTextField(7);
        _photonTextField.setEditable(false);
        miscPane.add(_photonTextField);
        _logCheckBox = new JCheckBox(LOGARITHMIC);
        _logCheckBox.setSelected(_logarithmic);
        _logCheckBox.addItemListener(new ItemListener() {

            @Override
            public void itemStateChanged(final ItemEvent e) {
                _logarithmic = _logCheckBox.isSelected();
                NumberAxis photonAxis;
                if (_logarithmic) {
                    photonAxis = new LogarithmicAxis(PHOTON_AXIS_LABEL);
                } else {
                    photonAxis = new NumberAxis(PHOTON_AXIS_LABEL);
                }
                _decaySubPlot.setRangeAxis(photonAxis);
            }
        });
        miscPane.add(_logCheckBox);
        container.add(miscPane, BorderLayout.SOUTH);

        // IJ.log("size from prefs " + getSizeFromPreferences());
        // _frame.setSize(getSizeFromPreferences());
        // _frame.setMaximumSize(MAX_SIZE); // doesn't work; bug in Java
        _frame.pack();
        _frame.setLocationRelativeTo(frame);
        _frame.setVisible(true);
        _frame.addComponentListener(new ComponentListener() {

            @Override
            public void componentHidden(final ComponentEvent e) {

            }

            @Override
            public void componentMoved(final ComponentEvent e) {

            }

            @Override
            public void componentResized(final ComponentEvent e) {
                // constrain maximum size
                boolean resize = false;
                final Dimension size = _frame.getSize();
                // IJ.log("COMPONENT RESIZED incoming size " + size);
                if (size.width > MAX_SIZE.width) {
                    size.width = MAX_SIZE.width;
                    resize = true;
                }
                if (size.height > MAX_SIZE.height) {
                    size.height = MAX_SIZE.height;
                    resize = true;
                }
                if (size.width < MIN_SIZE.width) {
                    size.width = MIN_SIZE.width;
                    resize = true;
                }
                if (size.height < MIN_SIZE.height) {
                    size.height = MIN_SIZE.height;
                    resize = true;
                }
                if (resize) {
                    _frame.setSize(size);
                }
                // IJ.log("save resized " + resize + " size " + size);
                saveSizeInPreferences(size);
            }

            @Override
            public void componentShown(final ComponentEvent e) {

            }
        });
        _frame.addWindowListener(new WindowAdapter() {

            @Override
            public void windowClosing(final WindowEvent e) {
                _cursorListener.hideCursor();
            }
        });
        _frame.setSize(getSizeFromPreferences());
    }
    return _frame;
}