Example usage for java.awt GridBagConstraints BOTH

List of usage examples for java.awt GridBagConstraints BOTH

Introduction

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

Prototype

int BOTH

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

Click Source Link

Document

Resize the component both horizontally and vertically.

Usage

From source file:org.openmicroscopy.shoola.agents.metadata.editor.ChannelAcquisitionComponent.java

/** Builds and lays out the UI. */
private void buildGUI() {
    setBackground(UIUtilities.BACKGROUND_COLOR);
    parent.layoutFields(generalPane, unsetGeneral, fieldsGeneral, unsetGeneralShown);

    setLayout(new GridBagLayout());
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.fill = GridBagConstraints.BOTH;
    constraints.anchor = GridBagConstraints.WEST;
    constraints.insets = new Insets(0, 2, 2, 0);
    constraints.weightx = 1.0;/*w ww . j  ava 2  s. c o m*/
    constraints.gridy = 0;
    if (generalPane.isVisible()) {
        add(generalPane, constraints);
        ++constraints.gridy;
    }
    if (detectorPane.isVisible()) {
        add(detectorPane, constraints);
        ++constraints.gridy;
    }
    if (lightPane.isVisible()) {
        add(lightPane, constraints);
        ++constraints.gridy;
    }
    if (lightPathPane != null) {
        add(lightPathPane, constraints);
        ++constraints.gridy;
    }
    if (filterSetPane != null) {
        add(filterSetPane, constraints);
        ++constraints.gridy;
    }
    constraints.fill = GridBagConstraints.HORIZONTAL;
    add(exposureTask, constraints);
    parent.attachListener(fieldsGeneral);
}

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.script.PainelScript.java

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

    textAreaSourceCode = new G_TextAreaSourceCode();
    textAreaSourceCode.setTipoHTML();//from w ww.  java 2s  .co m
    new OnChange(textAreaSourceCode, this);
    tableLinCod = new TabelaDescricao(erros);
    arTextPainelCorrecao = new ArTextPainelCorrecao();
    salvar = new JButton();
    abrir = new JButton();
    cancelar = new JButton();
    strConteudoalt = new String();
    btnSalvar = new JMenuItem("Salvar");
    salvar.setEnabled(false);
    salvaAlteracoes = TxtBuffer.getInstanciaSalvaAlteracoes(textAreaSourceCode.getTextPane(), salvar,
            new JMenuItem(), parentFrame);

    pnRegra = new JPanel();
    lbRegras1 = new JLabel();
    lbRegras2 = new JLabel();
    pnSetaDescricao = new JPanel();
    new JScrollPane();
    tArParticipRotulo = new TArParticipRotulo();
    conteudoDoAlt = new JTextArea();
    pnListaErros = new JPanel();
    scrollPanetabLinCod = new JScrollPane();
    pnBotoes = new JPanel();
    new JButton();
    aplicar = new JButton();
    conteudoParticRotulo = new ArrayList<String>();
    setBackground(CoresDefault.getCorPaineis());
    Container contentPane = this;// ??
    contentPane.setLayout(new GridLayout(2, 1));
    {
        pnRegra.setBorder(criaBorda(Ferramenta_Scripts.TITULO_REGRA));
        pnRegra.setLayout(new GridLayout(2, 1));
        pnRegra.add(lbRegras1);
        lbRegras1.setText(Ferramenta_Scripts.REGRAP1);
        lbRegras2.setText(Ferramenta_Scripts.REGRAP2);
        lbRegras1.setHorizontalAlignment(SwingConstants.CENTER);

        lbRegras2.setHorizontalAlignment(SwingConstants.CENTER);
        pnRegra.add(lbRegras1);
        pnRegra.add(lbRegras2);
        pnRegra.setPreferredSize(new Dimension(700, 60));
    }
    // ---- Salvar ----
    salvar.setText(Ferramenta_Scripts.BTN_SALVAR);
    salvar.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            salvarActionPerformed(e);
        }
    });

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

    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(165, 0, 150, 25);

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

    cancelar.setToolTipText(Ferramenta_Imagens.DICA_TELA_ANTERIOR);
    cancelar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_TELA_ANTERIOR);
    cancelar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_TELA_ANTERIOR);
    cancelar.setBounds(320, 0, 150, 25);
    GridBagConstraints cons = new GridBagConstraints();

    cons.fill = GridBagConstraints.BOTH;
    cons.weighty = 1;

    pnSetaDescricao.setLayout(new BorderLayout());
    cons.anchor = GridBagConstraints.WEST;
    cons.insets = new Insets(0, 0, 0, 0);
    JScrollPane sp = new JScrollPane();
    sp.setBorder(criaBorda(Ferramenta_Scripts.CONTEUDO_ALTER));
    sp.setViewportView(conteudoDoAlt);
    sp.setPreferredSize(new Dimension(500, 300));
    pnSetaDescricao.setPreferredSize(new Dimension(400, 60));
    pnListaErros.setBorder(criaBorda(Ferramenta_Scripts.LISTA_ERROS));
    pnListaErros.setLayout(new BorderLayout());
    scrollPanetabLinCod.setViewportView(tableLinCod);
    pnListaErros.add(scrollPanetabLinCod, BorderLayout.CENTER);
    {
        pnBotoes.setLayout(null);
        aplicar.setEnabled(false);
        aplicar.setText(Ferramenta_Scripts.BTN_APLICAR);
        aplicar.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                aplicarRotuloActionPerformed(e);
            }
        });

        aplicar.setToolTipText(Ferramenta_Scripts.DICA_APLICAR);
        aplicar.getAccessibleContext().setAccessibleDescription(Ferramenta_Scripts.DICA_APLICAR);
        aplicar.getAccessibleContext().setAccessibleName(Ferramenta_Scripts.DICA_APLICAR);
        aplicar.setBounds(3, 3, 120, 30);
        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);
    sp.setMinimumSize(minimumSize);
    sp.setPreferredSize(new Dimension(150, 90));
    splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sp, textAreaSourceCode);
    splitPane.setOneTouchExpandable(true);
    int w = parentFrame.getWidth();
    int s = w / 4;
    splitPane.setDividerLocation(s);
    regraFonteBtn.add(splitPane, BorderLayout.CENTER);
    pnBotoes.setPreferredSize(new Dimension(600, 35));
    pnBotoes.setBackground(CoresDefault.getCorPaineis());
    regraFonteBtn.setBackground(CoresDefault.getCorPaineis());
    contentPane.add(regraFonteBtn);

    JPanel textoErrosBtn = new JPanel();
    textoErrosBtn.setLayout(new BorderLayout());
    pnSetaDescricao.setBackground(CoresDefault.getCorPaineis());
    pnSetaDescricao.add(pnBotoes, BorderLayout.WEST);
    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.setText(TradPainelRelatorio.REVERTER);
        reverter.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                setVisible(false);
                TxtBuffer.setContent(TxtBuffer.getContentOriginal());
                parentFrame.showPainelFerramentaScriptPArq(TxtBuffer.getContentOriginal());
                setVisible(true);
            }

        });
        reverter.setToolTipText(TradPainelRelatorio.DICA_REVERTER);
        reverter.getAccessibleContext().setAccessibleDescription(TradPainelRelatorio.DICA_REVERTER);
        reverter.getAccessibleContext().setAccessibleName(TradPainelRelatorio.DICA_REVERTER);
        reverter.setBounds(485, 0, 150, 25);
        pnSalvarCancelar.add(reverter);
    }
    pnSalvarCancelar.setBackground(CoresDefault.getCorPaineis());
    textoErrosBtn.add(pnSalvarCancelar, BorderLayout.SOUTH);
    pnListaErros.setBackground(CoresDefault.getCorPaineis());
    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:com.dbschools.quickquiz.client.giver.MainWindow.java

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

    pnlPlayers = new javax.swing.JPanel();
    pnlChat = new javax.swing.JPanel();
    jLabel4 = new javax.swing.JLabel();
    txtChatLine = new javax.swing.JTextField();
    btnSendChatLine = new javax.swing.JButton();
    chkChatEnabled = new javax.swing.JCheckBox();
    pnlMessages = new javax.swing.JPanel();
    scpMessages = new javax.swing.JScrollPane();
    lstMessages = new javax.swing.JList();
    pnlQA = new javax.swing.JPanel();
    jLabel2 = new javax.swing.JLabel();
    countdownMeter = new com.dbschools.gui.CountdownMeter();
    pnlButtons = new javax.swing.JPanel();
    jPanel2 = new javax.swing.JPanel();
    jLabel3 = new javax.swing.JLabel();
    txtTimeLimit = new javax.swing.JFormattedTextField();
    btnSendQuestion = new javax.swing.JButton();
    pnlAward = new javax.swing.JPanel();
    btnAwardPoints = new javax.swing.JButton();
    sprPoints = new javax.swing.JSpinner();
    cbxQuestions = new javax.swing.JComboBox();
    jMenuBar1 = new javax.swing.JMenuBar();
    jMenu1 = new javax.swing.JMenu();
    mnuReset = new javax.swing.JMenuItem();
    jMenuItem1 = new javax.swing.JMenuItem();
    jMenu2 = new javax.swing.JMenu();
    mnuLoad = new javax.swing.JMenuItem();

    addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosing(java.awt.event.WindowEvent evt) {
            exitForm(evt);
        }
    });
    getContentPane().setLayout(new java.awt.GridBagLayout());

    java.util.ResourceBundle bundle = java.util.ResourceBundle
            .getBundle("com/dbschools/quickquiz/client/giver/Bundle"); // NOI18N
    pnlPlayers.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("takers"))); // NOI18N
    pnlPlayers.setPreferredSize(new java.awt.Dimension(600, 250));
    pnlPlayers.setRequestFocusEnabled(false);
    pnlPlayers.setLayout(new javax.swing.BoxLayout(pnlPlayers, javax.swing.BoxLayout.LINE_AXIS));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 0.6;
    gridBagConstraints.insets = new java.awt.Insets(5, 2, 2, 2);
    getContentPane().add(pnlPlayers, gridBagConstraints);

    pnlChat.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("chat"))); // NOI18N
    pnlChat.setLayout(new java.awt.GridBagLayout());

    jLabel4.setDisplayedMnemonic('m');
    jLabel4.setLabelFor(txtChatLine);
    jLabel4.setText(bundle.getString("chatMessage")); // NOI18N
    pnlChat.add(jLabel4, new java.awt.GridBagConstraints());

    txtChatLine.setColumns(40);
    java.util.ResourceBundle bundle1 = java.util.ResourceBundle.getBundle("quickquiz"); // NOI18N
    txtChatLine.setToolTipText(bundle1.getString("tttChatMessage")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2);
    pnlChat.add(txtChatLine, gridBagConstraints);

    btnSendChatLine.setText(bundle.getString("sendChatLine")); // NOI18N
    btnSendChatLine.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnSendChatLineActionPerformed(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2);
    pnlChat.add(btnSendChatLine, gridBagConstraints);

    chkChatEnabled.setSelected(true);
    chkChatEnabled.setText("Enabled");
    chkChatEnabled.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            chatEnable(evt);
        }
    });
    pnlChat.add(chkChatEnabled, new java.awt.GridBagConstraints());

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(5, 2, 2, 2);
    getContentPane().add(pnlChat, gridBagConstraints);

    pnlMessages.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("messages"))); // NOI18N
    pnlMessages.setLayout(new javax.swing.BoxLayout(pnlMessages, javax.swing.BoxLayout.LINE_AXIS));

    lstMessages.setFont(new java.awt.Font("SansSerif", 0, 10));
    lstMessages.setModel(new MessagesListModel());
    lstMessages.setFocusable(false);
    lstMessages.setRequestFocusEnabled(false);
    scpMessages.setViewportView(lstMessages);

    pnlMessages.add(scpMessages);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 6;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weighty = 0.4;
    gridBagConstraints.insets = new java.awt.Insets(5, 2, 0, 2);
    getContentPane().add(pnlMessages, gridBagConstraints);

    pnlQA.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("qa"))); // NOI18N
    pnlQA.setLayout(new java.awt.GridBagLayout());

    jLabel2.setDisplayedMnemonic('q');
    jLabel2.setLabelFor(cbxQuestions);
    jLabel2.setText(bundle.getString("question")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
    pnlQA.add(jLabel2, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
    pnlQA.add(countdownMeter, gridBagConstraints);

    pnlButtons.setLayout(new javax.swing.BoxLayout(pnlButtons, javax.swing.BoxLayout.LINE_AXIS));

    jLabel3.setDisplayedMnemonic('l');
    jLabel3.setLabelFor(txtTimeLimit);
    jLabel3.setText(bundle.getString("timeLimit")); // NOI18N
    jPanel2.add(jLabel3);

    txtTimeLimit.setColumns(3);
    txtTimeLimit.setToolTipText(bundle1.getString("tttTimeLimit")); // NOI18N
    txtTimeLimit.setValue(new Integer(20));
    jPanel2.add(txtTimeLimit);

    btnSendQuestion.setMnemonic('s');
    btnSendQuestion.setText(bundle.getString("sendQuestion")); // NOI18N
    btnSendQuestion.setToolTipText(bundle1.getString("tttSendQuestion")); // NOI18N
    btnSendQuestion.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnSendQuestionActionPerformed(evt);
        }
    });
    jPanel2.add(btnSendQuestion);

    pnlButtons.add(jPanel2);

    btnAwardPoints.setMnemonic('a');
    btnAwardPoints.setText(bundle.getString("winnerButton")); // NOI18N
    btnAwardPoints.setToolTipText(bundle.getString("tttAssignWinner")); // NOI18N
    btnAwardPoints.setEnabled(false);
    btnAwardPoints.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnAwardPointsActionPerformed(evt);
        }
    });
    pnlAward.add(btnAwardPoints);

    sprPoints.setToolTipText(bundle.getString("tttWinnerPoints")); // NOI18N
    sprPoints.setPreferredSize(new java.awt.Dimension(50, 24));
    pnlAward.add(sprPoints);

    pnlButtons.add(pnlAward);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.gridwidth = 3;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    pnlQA.add(pnlButtons, gridBagConstraints);

    cbxQuestions.setEditable(true);
    cbxQuestions.setMaximumRowCount(100);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 2.0;
    gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
    pnlQA.add(cbxQuestions, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
    getContentPane().add(pnlQA, gridBagConstraints);

    jMenu1.setText(bundle.getString("quiz")); // NOI18N

    mnuReset.setText(bundle.getString("resetButton")); // NOI18N
    mnuReset.setToolTipText(bundle.getString("tttResetButton")); // NOI18N
    mnuReset.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuResetActionPerformed(evt);
        }
    });
    jMenu1.add(mnuReset);

    jMenuItem1.setText("Add Simulated Takers");
    jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            addSimulatedTakers(evt);
        }
    });
    jMenu1.add(jMenuItem1);

    jMenuBar1.add(jMenu1);

    jMenu2.setText(bundle.getString("questions")); // NOI18N

    mnuLoad.setText(bundle.getString("load")); // NOI18N
    mnuLoad.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuLoadActionPerformed(evt);
        }
    });
    jMenu2.add(mnuLoad);

    jMenuBar1.add(jMenu2);

    setJMenuBar(jMenuBar1);

    pack();
}

From source file:org.jets3t.gui.ObjectsAttributesDialog.java

/**
 * Initialise the GUI elements to display the given item.
 *///from  ww w  .ja  v a 2s. co m
private void initGui() {
    this.setResizable(true);
    this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);

    JPanel unmodifiableAttributesPanel = skinsFactory.createSkinnedJPanel("ObjectStaticAttributesPanel");
    unmodifiableAttributesPanel.setLayout(new GridBagLayout());
    JPanel metadataContainer = skinsFactory.createSkinnedJPanel("ObjectPropertiesMetadataPanel");
    metadataContainer.setLayout(new GridBagLayout());
    metadataButtonsContainer = skinsFactory.createSkinnedJPanel("ObjectPropertiesMetadataButtonsPanel");
    metadataButtonsContainer.setLayout(new GridBagLayout());

    // Fields to display unmodifiable object details.
    JLabel objectKeyLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectKeyLabel");
    objectKeyLabel.setText("Object key:");
    objectKeyTextField = skinsFactory.createSkinnedJTextField("ObjectKeyTextField");
    objectKeyTextField.setEditable(false);
    JLabel objectContentLengthLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectContentLengthLabel");
    objectContentLengthLabel.setText("Size:");
    objectContentLengthTextField = skinsFactory.createSkinnedJTextField("ObjectContentLengthTextField");
    objectContentLengthTextField.setEditable(false);
    JLabel objectLastModifiedLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectLastModifiedLabel");
    objectLastModifiedLabel.setText("Last modified:");
    objectLastModifiedTextField = skinsFactory.createSkinnedJTextField("ObjectLastModifiedTextField");
    objectLastModifiedTextField.setEditable(false);
    JLabel objectETagLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectETagLabel");
    objectETagLabel.setText("ETag:");
    objectETagTextField = skinsFactory.createSkinnedJTextField("ObjectETagTextField");
    objectETagTextField.setEditable(false);
    JLabel bucketNameLabel = skinsFactory.createSkinnedJHtmlLabel("BucketNameLabel");
    bucketNameLabel.setText("Bucket:");
    bucketLocationTextField = skinsFactory.createSkinnedJTextField("BucketLocationTextField");
    bucketLocationTextField.setEditable(false);
    ownerNameLabel = skinsFactory.createSkinnedJHtmlLabel("OwnerNameLabel");
    ownerNameLabel.setText("Owner name:");
    ownerNameTextField = skinsFactory.createSkinnedJTextField("OwnerNameTextField");
    ownerNameTextField.setEditable(false);
    ownerIdLabel = skinsFactory.createSkinnedJHtmlLabel("OwnerIdLabel");
    ownerIdLabel.setText("Owner ID:");
    ownerIdTextField = skinsFactory.createSkinnedJTextField("OwnerIdTextField");
    ownerIdTextField.setEditable(false);

    int row = 0;

    unmodifiableAttributesPanel.add(objectKeyLabel, new GridBagConstraints(0, row, 1, 1, 0, 0,
            GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
    unmodifiableAttributesPanel.add(objectKeyTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    row++;
    unmodifiableAttributesPanel.add(objectContentLengthLabel, new GridBagConstraints(0, row, 1, 1, 0, 0,
            GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
    unmodifiableAttributesPanel.add(objectContentLengthTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    row++;
    unmodifiableAttributesPanel.add(objectLastModifiedLabel, new GridBagConstraints(0, row, 1, 1, 0, 0,
            GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
    unmodifiableAttributesPanel.add(objectLastModifiedTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    row++;
    unmodifiableAttributesPanel.add(objectETagLabel, new GridBagConstraints(0, row, 1, 1, 0, 0,
            GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
    unmodifiableAttributesPanel.add(objectETagTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    row++;
    unmodifiableAttributesPanel.add(ownerNameLabel, new GridBagConstraints(0, row, 1, 1, 0, 0,
            GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
    unmodifiableAttributesPanel.add(ownerNameTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    row++;
    unmodifiableAttributesPanel.add(ownerIdLabel, new GridBagConstraints(0, row, 1, 1, 0, 0,
            GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
    unmodifiableAttributesPanel.add(ownerIdTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    row++;
    unmodifiableAttributesPanel.add(bucketNameLabel, new GridBagConstraints(0, row, 1, 1, 0, 0,
            GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
    unmodifiableAttributesPanel.add(bucketLocationTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

    // Build metadata table.
    objectMetadataTableModel = new DefaultTableModel(new Object[] { "Name", "Value" }, 0) {
        private static final long serialVersionUID = -3762866886166776851L;

        public boolean isCellEditable(int row, int column) {
            return isModifyMode();
        }
    };

    metadataTableSorter = new TableSorter(objectMetadataTableModel);
    metadataTable = skinsFactory.createSkinnedJTable("MetadataTable");
    metadataTable.setModel(metadataTableSorter);
    metadataTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting() && removeMetadataItemButton != null) {
                int row = metadataTable.getSelectedRow();
                removeMetadataItemButton.setEnabled(row >= 0);
            }
        }
    });

    metadataTableSorter.setTableHeader(metadataTable.getTableHeader());
    metadataTableSorter.setSortingStatus(0, TableSorter.ASCENDING);
    metadataContainer.add(new JScrollPane(metadataTable), new GridBagConstraints(0, 0, 1, 1, 1, 1,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsHorizontalSpace, 0, 0));

    // Add/remove buttons for metadata table.
    removeMetadataItemButton = skinsFactory.createSkinnedJButton("ObjectPropertiesAddMetadataButton");
    removeMetadataItemButton.setEnabled(false);
    removeMetadataItemButton.setToolTipText("Remove the selected metadata item(s)");
    guiUtils.applyIcon(removeMetadataItemButton, "/images/nuvola/16x16/actions/viewmag-.png");
    removeMetadataItemButton.addActionListener(this);
    removeMetadataItemButton.setActionCommand("removeMetadataItem");
    addMetadataItemButton = skinsFactory.createSkinnedJButton("ObjectPropertiesAddMetadataButton");
    addMetadataItemButton.setToolTipText("Add a new metadata item");
    guiUtils.applyIcon(addMetadataItemButton, "/images/nuvola/16x16/actions/viewmag+.png");
    addMetadataItemButton.setActionCommand("addMetadataItem");
    addMetadataItemButton.addActionListener(this);
    metadataButtonsContainer.add(removeMetadataItemButton, new GridBagConstraints(0, 0, 1, 1, 0, 0,
            GridBagConstraints.CENTER, GridBagConstraints.NONE, insetsZero, 0, 0));
    metadataButtonsContainer.add(addMetadataItemButton, new GridBagConstraints(1, 0, 1, 1, 0, 0,
            GridBagConstraints.CENTER, GridBagConstraints.NONE, insetsZero, 0, 0));
    metadataContainer.add(metadataButtonsContainer, new GridBagConstraints(0, 1, 1, 1, 1, 0,
            GridBagConstraints.EAST, GridBagConstraints.NONE, insetsHorizontalSpace, 0, 0));
    metadataButtonsContainer.setVisible(false);

    // OK Button.
    okButton = skinsFactory.createSkinnedJButton("ObjectPropertiesOKButton");
    okButton.setText("OK");
    okButton.setActionCommand("OK");
    okButton.addActionListener(this);

    // Cancel Button.
    cancelButton = null;
    cancelButton = skinsFactory.createSkinnedJButton("ObjectPropertiesCancelButton");
    cancelButton.setText("Cancel");
    cancelButton.setActionCommand("Cancel");
    cancelButton.addActionListener(this);
    cancelButton.setVisible(false);

    // Recognize and handle ENTER, ESCAPE, PAGE_UP, and PAGE_DOWN key presses.
    this.getRootPane().setDefaultButton(okButton);
    this.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"),
            "ESCAPE");
    this.getRootPane().getActionMap().put("ESCAPE", new AbstractAction() {
        private static final long serialVersionUID = -7768790936535999307L;

        public void actionPerformed(ActionEvent actionEvent) {
            setVisible(false);
        }
    });
    this.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("PAGE_UP"),
            "PAGE_UP");
    this.getRootPane().getActionMap().put("PAGE_UP", new AbstractAction() {
        private static final long serialVersionUID = -6324229423705756219L;

        public void actionPerformed(ActionEvent actionEvent) {
            previousObjectButton.doClick();
        }
    });
    this.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("PAGE_DOWN"),
            "PAGE_DOWN");
    this.getRootPane().getActionMap().put("PAGE_DOWN", new AbstractAction() {
        private static final long serialVersionUID = -5808972377672449421L;

        public void actionPerformed(ActionEvent actionEvent) {
            nextObjectButton.doClick();
        }
    });

    // Put it all together.
    row = 0;
    JPanel container = skinsFactory.createSkinnedJPanel("ObjectPropertiesPanel");
    container.setLayout(new GridBagLayout());
    container.add(unmodifiableAttributesPanel, new GridBagConstraints(0, row++, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    // Object previous and next buttons, if we have multiple objects.
    previousObjectButton = skinsFactory.createSkinnedJButton("ObjectPropertiesPreviousButton");
    guiUtils.applyIcon(previousObjectButton, "/images/nuvola/16x16/actions/1leftarrow.png");
    previousObjectButton.addActionListener(this);
    previousObjectButton.setEnabled(false);
    nextObjectButton = skinsFactory.createSkinnedJButton("ObjectPropertiesNextButton");
    guiUtils.applyIcon(nextObjectButton, "/images/nuvola/16x16/actions/1rightarrow.png");
    nextObjectButton.addActionListener(this);
    nextObjectButton.setEnabled(false);
    currentObjectLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectPropertiesCurrentObjectLabel");
    currentObjectLabel.setHorizontalAlignment(JLabel.CENTER);

    nextPreviousPanel = skinsFactory.createSkinnedJPanel("ObjectPropertiesNextPreviousPanel");
    nextPreviousPanel.setLayout(new GridBagLayout());
    nextPreviousPanel.add(previousObjectButton, new GridBagConstraints(0, 0, 1, 1, 1, 0,
            GridBagConstraints.EAST, GridBagConstraints.NONE, insetsZero, 0, 0));
    nextPreviousPanel.add(currentObjectLabel, new GridBagConstraints(1, 0, 1, 1, 0, 0,
            GridBagConstraints.CENTER, GridBagConstraints.NONE, insetsHorizontalSpace, 0, 0));
    nextPreviousPanel.add(nextObjectButton, new GridBagConstraints(2, 0, 1, 1, 1, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, insetsZero, 0, 0));
    container.add(nextPreviousPanel, new GridBagConstraints(0, row, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
    nextPreviousPanel.setVisible(false);
    row++;

    JHtmlLabel metadataLabel = skinsFactory.createSkinnedJHtmlLabel("MetadataLabel");
    metadataLabel.setText("<html><b>Metadata Attributes</b></html>");
    metadataLabel.setHorizontalAlignment(JLabel.CENTER);
    container.add(metadataLabel, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, insetsVerticalSpace, 0, 0));
    container.add(metadataContainer, new GridBagConstraints(0, row++, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsZero, 0, 0));

    // Destination Access Control List setting.
    destinationPanel = skinsFactory.createSkinnedJPanel("DestinationPanel");
    destinationPanel.setLayout(new GridBagLayout());

    JPanel actionButtonsPanel = skinsFactory.createSkinnedJPanel("ObjectPropertiesActionButtonsPanel");
    actionButtonsPanel.setLayout(new GridBagLayout());
    actionButtonsPanel.add(cancelButton, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
    actionButtonsPanel.add(okButton, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
    cancelButton.setVisible(false);

    container.add(actionButtonsPanel, new GridBagConstraints(0, row++, 3, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.NONE, insetsDefault, 0, 0));
    this.getContentPane().add(container);

    this.pack();
    this.setSize(new Dimension(450, 500));
    this.setLocationRelativeTo(this.getOwner());
}

From source file:org.openconcerto.erp.core.finance.accounting.ui.EtatJournauxPanel.java

private JPanel creerJournalMoisPanel(final Date date, long debit, long credit, final Journal jrnl) {

    final JPanel panelMoisCompte = new JPanel();
    panelMoisCompte.setLayout(new GridBagLayout());
    final GridBagConstraints c = new GridBagConstraints();
    c.insets = new Insets(2, 2, 1, 2);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.gridx = 0;//from  w  w  w.j  av a2s  . c  o m
    c.gridy = 0;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 1;
    c.weighty = 0;

    panelMoisCompte.setBorder(BorderFactory.createTitledBorder(dateFormat.format(date)));

    // Date du mois
    panelMoisCompte.add(new JLabel(dateFormat.format(date)), c);

    // Totaux du mois
    c.gridx++;
    panelMoisCompte.add(new JLabel(" dbit : " + GestionDevise.currencyToString(debit)), c);
    c.gridx++;
    panelMoisCompte.add(new JLabel(" crdit : " + GestionDevise.currencyToString(credit)), c);

    // Bouton dtails
    JButton boutonShow = new JButton("+/-");
    boutonShow.setOpaque(false);
    boutonShow.setHorizontalAlignment(SwingConstants.LEFT);

    c.weightx = 0;
    c.gridx++;
    panelMoisCompte.add(boutonShow, c);

    boutonShow.addActionListener(new ActionListener() {
        private boolean isShow = false;
        private ListPanelEcritures listEcriture;

        public void actionPerformed(ActionEvent e) {

            System.err.println(this.isShow);

            // Afficher la JTable du compte
            if (!this.isShow) {
                final SQLElement element = Configuration.getInstance().getDirectory().getElement("ECRITURE");
                final SQLTable ecrTable = element.getTable();

                Calendar cal = Calendar.getInstance();

                cal.setTime(date);
                cal.set(Calendar.DATE, 1);
                Date inf = cal.getTime();

                cal.set(Calendar.DATE, cal.getActualMaximum(Calendar.DATE));
                Date sup = cal.getTime();

                System.out.println("Inf : " + inf + " Sup : " + sup);
                Where w = new Where(ecrTable.getField("ID_JOURNAL"), "=", jrnl.getId());
                Where w2 = new Where(ecrTable.getField("DATE"), inf, sup);

                if (!UserManager.getInstance().getCurrentUser().getRights()
                        .haveRight(ComptaUserRight.ACCES_NOT_RESCTRICTED_TO_411)) {
                    // TODO Show Restricted acces in UI
                    w = w.and(new Where(ecrTable.getField("COMPTE_NUMERO"), "LIKE", "411%"));
                }

                this.listEcriture = new ListPanelEcritures(element, w.and(w2));
                this.listEcriture.setModificationVisible(false);
                this.listEcriture.setAjoutVisible(false);
                this.listEcriture.setSuppressionVisible(false);
                this.listEcriture.getListe().setSQLEditable(false);

                Dimension d;
                // Taille limite  200 maximum
                if (this.listEcriture.getListe().getPreferredSize().height > 200) {
                    d = new Dimension(this.listEcriture.getListe().getPreferredSize().width, 200);
                } else {
                    d = new Dimension(this.listEcriture.getListe().getPreferredSize().width,
                            this.listEcriture.getListe().getPreferredSize().height + 30);
                }
                this.listEcriture.getListe().setPreferredSize(d);

                // c.gridy = 2;
                c.gridx = 0;
                c.gridy = 1;

                c.gridwidth = 4;
                c.weightx = 1;
                c.weighty = 1;
                c.fill = GridBagConstraints.BOTH;

                this.listEcriture.getListe().setSQLEditable(false);

                panelMoisCompte.add(this.listEcriture, c);
                this.listEcriture.getListe().getJTable().addMouseListener(new MouseAdapter() {
                    public void mousePressed(MouseEvent e) {
                        if (e.getButton() == MouseEvent.BUTTON3) {
                            JPopupMenu menu = new JPopupMenu();
                            menu.add(new AbstractAction("Voir la source") {
                                public void actionPerformed(ActionEvent e) {

                                    SQLRow row = base.getTable("ECRITURE")
                                            .getRow(listEcriture.getListe().getSelectedId());

                                    MouvementSQLElement.showSource(row.getInt("ID_MOUVEMENT"));
                                }
                            });

                            menu.show(e.getComponent(), e.getPoint().x, e.getPoint().y);

                        }
                    }
                });

            } else {

                panelMoisCompte.remove(this.listEcriture);
                System.out.println("Hide ListEcriture");

                panelMoisCompte.repaint();
                panelMoisCompte.revalidate();
            }

            this.isShow = !this.isShow;
            SwingUtilities.getRoot(panelMoisCompte).repaint();
        }
    });

    return panelMoisCompte;
}

From source file:net.java.sip.communicator.impl.gui.main.chat.ChatWritePanel.java

private void initTextArea(JPanel centerPanel) {
    GridBagConstraints constraints = new GridBagConstraints();

    editorPane.setContentType("text/html");
    editorPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
    editorPane.setCaretPosition(0);/*  ww  w .  java  2  s  .c  om*/
    editorPane.setEditorKit(new SIPCommHTMLEditorKit(this));
    editorPane.getDocument().addUndoableEditListener(this);
    editorPane.getDocument().addDocumentListener(this);
    editorPane.addKeyListener(this);
    editorPane.addMouseListener(this);
    editorPane.setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
    editorPane.setDragEnabled(true);
    editorPane.setTransferHandler(new ChatTransferHandler(chatPanel));

    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);

    scrollPane.setOpaque(false);
    scrollPane.getViewport().setOpaque(false);
    scrollPane.setBorder(null);

    scrollPane.setViewportView(editorPane);

    constraints.anchor = GridBagConstraints.NORTHWEST;
    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 2;
    constraints.gridy = 0;
    constraints.weightx = 1f;
    constraints.weighty = 1f;
    constraints.gridheight = 1;
    constraints.gridwidth = 1;
    constraints.insets = new Insets(0, 0, 0, 0);
    centerPanel.add(scrollPane, constraints);
}

From source file:de.ailis.xadrian.frames.MainFrame.java

/**
 * Creates the content.//  w  w w  .j a  va2 s.co  m
 */
private void createContent() {
    this.tabs = new JTabbedPane();
    this.tabs.setPreferredSize(new Dimension(640, 480));
    this.tabs.addChangeListener(this);
    this.tabs.setTransferHandler(this.transferHandler);

    final JPanel welcomePanel = this.welcomePanel = new JPanel();
    welcomePanel.setTransferHandler(this.transferHandler);

    welcomePanel.setLayout(new GridBagLayout());
    final GridBagConstraints c = new GridBagConstraints();

    welcomePanel.setPreferredSize(new Dimension(640, 480));
    final JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new GridBagLayout());
    c.anchor = GridBagConstraints.CENTER;
    welcomePanel.add(buttonPanel, c);

    final JButton newButton = new JButton(this.newAction);
    newButton.setHorizontalAlignment(SwingConstants.LEFT);
    newButton.setIconTextGap(10);
    newButton.setText("<html><body><strong>" + newButton.getText() + "</strong><br />"
            + newButton.getToolTipText() + "</body></html>");
    newButton.setToolTipText(null);
    newButton.setMargin(new Insets(5, 10, 5, 10));
    c.gridy = 0;
    c.fill = GridBagConstraints.BOTH;
    c.insets.set(5, 5, 5, 5);
    buttonPanel.add(newButton, c);

    final JButton openButton = new JButton(this.openAction);
    openButton.setHorizontalAlignment(SwingConstants.LEFT);
    openButton.setIconTextGap(10);
    openButton.setText("<html><body><strong>" + openButton.getText() + "</strong><br />"
            + openButton.getToolTipText() + "</body></html>");
    openButton.setToolTipText(null);
    openButton.setMargin(new Insets(5, 10, 5, 10));
    c.gridy++;
    buttonPanel.add(openButton, c);

    final JPanel separator = new JPanel();
    separator.setPreferredSize(new Dimension(20, 20));
    c.gridy++;
    buttonPanel.add(separator, c);

    final JButton donateButton = new JButton(this.donateAction);
    donateButton.setHorizontalAlignment(SwingConstants.LEFT);
    donateButton.setIconTextGap(10);
    donateButton.setText("<html><body><strong>" + donateButton.getText() + "</strong><br />"
            + donateButton.getToolTipText() + "</body></html>");
    donateButton.setToolTipText(null);
    donateButton.setMargin(new Insets(5, 10, 5, 10));
    c.gridy++;
    buttonPanel.add(donateButton, c);

    final SocialPane socialPane = new SocialPane();
    c.insets.top = 50;
    c.gridy++;
    buttonPanel.add(socialPane, c);
    installStatusHandler(buttonPanel);

    add(welcomePanel, BorderLayout.CENTER);
}

From source file:com.sec.ose.osi.ui.dialog.setting.JPanReportProperty.java

/**
 * This method initializes jPanelDefaultReportLocation   
 *    /*from  www. ja  v a  2s  . c  o  m*/
 * @return javax.swing.JPanel   
 */
private JPanel getJPanelDefaultReportLocation() {
    if (jPanelDefaultReportLocation == null) {
        GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
        gridBagConstraints5.gridx = 1;
        gridBagConstraints5.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints5.insets = new Insets(0, 5, 0, 0);
        gridBagConstraints5.gridy = 0;
        GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
        gridBagConstraints4.fill = GridBagConstraints.BOTH;
        gridBagConstraints4.gridy = 0;
        gridBagConstraints4.weightx = 1.0;
        gridBagConstraints4.gridx = 0;
        jPanelDefaultReportLocation = new JPanel();
        jPanelDefaultReportLocation.setLayout(new GridBagLayout());
        jPanelDefaultReportLocation.add(getJTextFieldDefaultReportLocation(), gridBagConstraints4);
        jPanelDefaultReportLocation.add(getJButtonDefaultReportLocation(), gridBagConstraints5);
    }
    return jPanelDefaultReportLocation;
}

From source file:com.compomics.cell_coord.gui.controller.summary.VisualizeTracksController.java

/**
 * Given the amount of plots to render, and the index of the current plot,
 * as well as the number of columns to use, get the appropriate
 * GridBagConstraints.//from   w  ww.j  ava2  s .  co  m
 *
 * @param nPlots
 * @param index
 * @param nCols
 * @return the GridBagConstraints
 */
private GridBagConstraints getGridBagConstraints(int nPlots, int index, int nCols) {
    GridBagConstraints specialGBC = new GridBagConstraints();
    int nRows = (int) Math.ceil(nPlots / nCols);
    specialGBC.fill = GridBagConstraints.BOTH;
    specialGBC.weightx = 1.0 / nCols;
    specialGBC.weighty = 1.0 / nRows;
    specialGBC.gridy = (int) Math.floor(index / nCols);
    if (index < nCols) {
        specialGBC.gridx = index;
    } else {
        specialGBC.gridx = index - ((index / nCols) * nCols);
    }
    return specialGBC;
}

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();// www. ja  v a  2  s  .c  o 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);

}