Example usage for javax.swing SwingConstants CENTER

List of usage examples for javax.swing SwingConstants CENTER

Introduction

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

Prototype

int CENTER

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

Click Source Link

Document

The central position in an area.

Usage

From source file:edu.ku.brc.ui.ChooseFromListDlg.java

/**
 * Create the UI for the dialog./* w  ww .  ja v  a2  s .co  m*/
 * 
 * @param altName title for dialog
 * @param desc the list to be selected from
 * @param includeCancelBtn  indicates whether to create and display a cancel btn
 * @param includeHelpBtn indicates whether to create and display a help btn
 * @param helpContext help context identifier
 * @param titleArg title for dialog
 * @param desc the list to be selected from
 * @param includeCancelBtn indicates whether to create and display a cancel btn
 */
public void createUI() {
    setTitle(title);

    boolean hasDesc = StringUtils.isNotEmpty(desc);
    PanelBuilder builder = new PanelBuilder(
            new FormLayout("f:max(300px;p):g", "p," + (hasDesc ? "2px,p," : "") + "5px,p"));
    CellConstraints cc = new CellConstraints();
    //builder.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 10));
    builder.setDefaultDialogBorder();

    int y = 1;
    if (hasDesc) {
        JLabel lbl = createLabel(desc, SwingConstants.CENTER);
        builder.add(lbl, cc.xy(1, y));
        y += 2;
    }

    try {
        ListModel listModel = new AbstractListModel() {
            public int getSize() {
                return items.size();
            }

            public Object getElementAt(int index) {
                return items.get(index).toString();
            }
        };

        list = new JList(listModel);
        if (icon != null) {
            list.setCellRenderer(getListCellRenderer()); // icon comes from the base
            // class (it's probably size
            // 16)
        }
        list.setSelectionMode(isMultiSelect ? ListSelectionModel.MULTIPLE_INTERVAL_SELECTION
                : ListSelectionModel.SINGLE_SELECTION);
        list.setVisibleRowCount(10);

        if (selectedIndices != null) {
            list.setSelectedIndices(selectedIndices);
        }

        list.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                if (e.getClickCount() == 2) {
                    okBtn.doClick(); // emulate button click
                }
            }
        });
        list.addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent e) {
                if (!e.getValueIsAdjusting()) {
                    updateUIState();
                }
            }
        });
        JScrollPane listScroller = new JScrollPane(list);
        builder.add(listScroller, cc.xy(1, y));
        y += 2;

        // Bottom Button UI
        okBtn = createButton(StringUtils.isNotEmpty(okLabel) ? okLabel : getResourceString("OK"));
        okBtn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                isCancelled = false;
                btnPressed = OK_BTN;
                setVisible(false);
            }
        });
        getRootPane().setDefaultButton(okBtn);

        if ((whichBtns & CANCEL_BTN) == CANCEL_BTN) {
            cancelBtn = createButton(
                    StringUtils.isNotEmpty(cancelLabel) ? cancelLabel : getResourceString("CANCEL"));
            cancelBtn.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                    isCancelled = true;
                    btnPressed = CANCEL_BTN;
                    setVisible(false);
                }
            });
        }

        if ((whichBtns & HELP_BTN) == HELP_BTN) {
            helpBtn = createButton(
                    StringUtils.isNotEmpty(cancelLabel) ? cancelLabel : getResourceString("HELP"));
            if (StringUtils.isNotEmpty(helpContext)) {
                HelpMgr.registerComponent(helpBtn, helpContext);
            } else {
                helpBtn.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent ae) {
                        btnPressed = HELP_BTN;
                    }
                });
            }
        }

        if ((whichBtns & APPLY_BTN) == APPLY_BTN) {
            applyBtn = createButton(
                    StringUtils.isNotEmpty(applyLabel) ? applyLabel : getResourceString("Apply"));
            applyBtn.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                    btnPressed = APPLY_BTN;
                    if (isCloseOnApply) {
                        isCancelled = false;
                        setVisible(false);
                    }
                }
            });
        }

        JPanel bb;
        if (whichBtns == OK_BTN) {
            bb = ButtonBarFactory.buildOKBar(okBtn);

        } else if (whichBtns == OKCANCEL) {
            bb = ButtonBarFactory.buildOKCancelBar(okBtn, cancelBtn);

        } else if (whichBtns == OKCANCELAPPLY) {
            bb = ButtonBarFactory.buildOKCancelApplyBar(okBtn, cancelBtn, applyBtn);

        } else if (whichBtns == OKHELP) {
            bb = ButtonBarFactory.buildOKHelpBar(okBtn, helpBtn);

        } else if (whichBtns == OKCANCELHELP) {
            bb = ButtonBarFactory.buildOKCancelHelpBar(okBtn, cancelBtn, helpBtn);

        } else if (whichBtns == OKCANCELAPPLYHELP) {
            bb = ButtonBarFactory.buildOKCancelApplyHelpBar(okBtn, cancelBtn, applyBtn, helpBtn);

        } else {
            bb = ButtonBarFactory.buildOKBar(okBtn);
        }

        builder.add(bb, cc.xy(1, y));
        y += 2;

        updateUIState();

    } catch (Exception ex) {
        edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
        edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(ChooseFromListDlg.class, ex);
        log.error(ex);
    }

    setContentPane(builder.getPanel());
    pack();
    // setLocationRelativeTo(locationComp);
}

From source file:edu.ku.brc.specify.BackupAndRestoreApp.java

/**
 * Shows the About dialog.//from ww  w.  jav a2s  .c o m
 */
public void doAbout() {
    CellConstraints cc = new CellConstraints();
    PanelBuilder infoPB = new PanelBuilder(new FormLayout("p,6px,f:min(400;p):g", "p:g"));

    JLabel iconLabel = new JLabel(IconManager.getIcon("SpecifyLargeIcon"), SwingConstants.CENTER); //$NON-NLS-1$
    PanelBuilder iconPB = new PanelBuilder(new FormLayout("p", "20px,t:p,f:p:g"));
    iconPB.add(iconLabel, cc.xy(1, 2));

    infoPB.setDefaultDialogBorder();

    infoPB.add(iconPB.getPanel(), cc.xy(1, 1));
    infoPB.add(createLabel(Specify.getAboutText(appName, appVersion)), cc.xy(3, 1));

    String title = getResourceString("Specify.ABOUT");//$NON-NLS-1$
    CustomDialog aboutDlg = new CustomDialog(topFrame, title + " " + appName, true, CustomDialog.OK_BTN, //$NON-NLS-1$
            infoPB.getPanel());
    String okLabel = getResourceString("Specify.CLOSE");//$NON-NLS-1$
    aboutDlg.setOkLabel(okLabel);
    aboutDlg.createUI();
    aboutDlg.pack();
    // for some strange reason I can't get the dialog to size itself correctly
    Dimension size = aboutDlg.getSize();
    size.height += 80;
    aboutDlg.setSize(size);
    UIHelper.centerAndShow(aboutDlg);
}

From source file:edu.ku.brc.specify.config.ResourceImportExportDlg.java

@Override
public void createUI() {
    this.setHelpContext("Import");

    super.createUI();

    CellConstraints cc = new CellConstraints();

    levelCBX = createComboBox();/*from w  w  w . j a v  a2 s. co  m*/

    DataProviderSessionIFace session = null;
    try {
        session = DataProviderFactory.getInstance().createSession();

        for (SpAppResourceDir curDir : contextMgr.getSpAppResourceList()) {
            SpAppResourceDir dir;
            if (curDir.getId() != null) {
                dir = session.get(SpAppResourceDir.class, curDir.getId());
                dir.setTitle(curDir.getTitle());

                // Force Load
                dir.getSpAppResources().size();
                dir.getSpPersistedAppResources().size();
                dir.getSpPersistedViewSets().size();

                for (SpAppResource appRes : curDir.getSpAppResources()) {
                    if (appRes.getId() == null) {
                        dir.getSpAppResources().add(appRes);
                    }
                }
                for (SpViewSetObj vso : curDir.getSpViewSets()) {
                    if (vso.getId() == null) {
                        dir.getSpViewSets().add(vso);
                    }
                }

            } else {
                dir = (SpAppResourceDir) curDir.clone();
            }
            dirs.add(dir);

            levelCBX.addItem(dir);
        }

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

    } finally {
        if (session != null) {
            session.close();
        }
    }

    PanelBuilder centerPB = new PanelBuilder(new FormLayout("f:p:g,p,f:p:g", "p,10px,p"));
    centerPB.add(createLabel(UIRegistry.getLocalizedMessage("RIE_USR_LBL", userName)), cc.xy(2, 1));
    centerPB.add(levelCBX, cc.xy(2, 3));

    tabbedPane = new JTabbedPane();

    PanelBuilder viewPanel = new PanelBuilder(new FormLayout("f:p:g,10px,f:p:g", "p,2px,f:p:g"));
    viewPanel.add(createLabel(getResourceString("RIE_VIEWSETS"), SwingConstants.CENTER), cc.xy(1, 1));
    viewSetsList = new JList(viewSetsModel);
    viewSetsList.setCellRenderer(new ARListRenderer());
    JScrollPane sp = new JScrollPane(viewSetsList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    viewPanel.add(sp, cc.xy(1, 3));

    viewPanel.add(createLabel(getResourceString("RIE_VIEWS"), SwingConstants.CENTER), cc.xy(3, 1));
    viewsList = new JList(viewsModel);
    viewsList.setCellRenderer(new ViewRenderer());
    sp = new JScrollPane(viewsList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    viewPanel.add(sp, cc.xy(3, 3));
    viewsList.setEnabled(false);

    PanelBuilder resPane = new PanelBuilder(new FormLayout("f:p:g", "p,2px,p"));
    resPane.add(createLabel(getResourceString("RIE_OTHER_RES"), SwingConstants.CENTER), cc.xy(1, 1));
    resList = new JList(resModel);
    resList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    resList.setCellRenderer(new ARListRenderer());
    sp = new JScrollPane(resList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    resPane.add(sp, cc.xy(1, 3));

    PanelBuilder repPane = new PanelBuilder(new FormLayout("f:p:g", "p,2px,f:p:g"));
    repPane.add(createLabel(getResourceString("RIE_REPORT_RES"), SwingConstants.CENTER), cc.xy(1, 1));
    repList = new JList(repModel);
    repList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    repList.setCellRenderer(new ARListRenderer());
    sp = new JScrollPane(repList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    repPane.add(sp, cc.xy(1, 3));

    boolean addResourcesPanel = AppPreferences.getLocalPrefs().getBoolean("ADD_IMP_RES", false);

    viewsPanel = viewPanel.getPanel();
    tabbedPane.addTab(getResourceString("RIE_VIEWSETS"), viewsPanel);
    if (addResourcesPanel) {
        resPanel = resPane.getPanel();
        tabbedPane.addTab(getResourceString("RIE_OTHER_RES"), resPanel);
    }
    repPanel = repPane.getPanel();
    tabbedPane.addTab(getResourceString("RIE_REPORT_RES"), repPanel);

    PanelBuilder pb = new PanelBuilder(new FormLayout("f:p:g", "p,4px,f:p:g,2px,p"));
    pb.add(centerPB.getPanel(), cc.xy(1, 1));
    pb.add(tabbedPane, cc.xy(1, 3));

    exportBtn = createButton(getResourceString("RIE_EXPORT"));
    importBtn = createButton(getResourceString("RIE_IMPORT"));
    revertBtn = createButton(getResourceString("RIE_REVERT"));
    PanelBuilder btnPB = new PanelBuilder(new FormLayout("f:p:g,p,f:p:g,p,f:p:g,p,f:p:g", "p,10px"));
    btnPB.add(exportBtn, cc.xy(2, 1));
    btnPB.add(importBtn, cc.xy(4, 1));
    btnPB.add(revertBtn, cc.xy(6, 1));

    pb.add(btnPB.getPanel(), cc.xy(1, 5));

    pb.getPanel().setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    contentPanel = pb.getPanel();
    mainPanel.add(contentPanel, BorderLayout.CENTER);

    tabbedPane.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            Component selectedComp = tabbedPane.getSelectedComponent();
            if (selectedComp != null) {
                if (selectedComp == viewsPanel) {
                    viewSetsList.setSelectedIndex(-1);

                } else if (selectedComp == resPanel) {
                    resList.setSelectedIndex(-1);
                } else {
                    repList.setSelectedIndex(-1);
                }
                //revertBtn.setVisible(selectedComp != repPanel);
            }
            enableUI();

            // JGoodies Resizes the panel in the Dialog and 
            // partially hides the buttons, this fixes that.
            Dimension size = ResourceImportExportDlg.this.getSize();
            //ResourceImportExportDlg.this.pack();
            //Dimension newSize = ResourceImportExportDlg.this.getSize();
            Dimension newSize = ResourceImportExportDlg.this.getPreferredSize();
            size.height = newSize.height;
            ResourceImportExportDlg.this.setSize(size);
        }
    });

    levelCBX.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    levelSelected();
                }
            });
        }
    });

    levelCBX.setSelectedIndex(0);

    pack();

    exportBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            exportResource();
        }
    });

    importBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            importResource();
        }
    });

    revertBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            revertResource();
        }
    });

    viewSetsList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                if (viewSetsList.getSelectedIndex() > -1) {
                    resList.clearSelection();
                    repList.clearSelection();
                }
                fillViewsList();
                enableUI();
            }
        }
    });

    resList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                if (resList.getSelectedIndex() > -1) {
                    viewSetsList.clearSelection();
                    repList.clearSelection();
                }
                enableUI();
            }
        }
    });

    repList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                if (resList.getSelectedIndex() > -1) {
                    viewSetsList.clearSelection();
                    resList.clearSelection();
                }
                enableUI();
            }
        }
    });

    pack();
}

From source file:com.hexidec.ekit.component.UnicodeDialog.java

public void init(int startIndex) {
    String customFont = Translatrix.getTranslationString("UnicodeDialogButtonFont");
    if (customFont != null && customFont.length() > 0) {
        buttonFont = new Font(Translatrix.getTranslationString("UnicodeDialogButtonFont"), Font.PLAIN, 12);
    } else {// www . ja  v  a  2 s . c  o  m
        buttonFont = new Font("Monospaced", Font.PLAIN, 12);
    }

    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());
    setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);

    JPanel centerPanel = new JPanel();
    centerPanel.setLayout(new GridLayout(0, 17, 0, 0));
    buttonGroup = new ButtonGroup();

    int prefButtonWidth = 32;
    int prefButtonHeight = 32;

    centerPanel.add(new JLabel(""));
    for (int labelLoop = 0; labelLoop < 16; labelLoop++) {
        JLabel jlblMarker = new JLabel(
                "x" + (labelLoop > 9 ? "" + (char) (65 + (labelLoop - 10)) : "" + labelLoop));
        jlblMarker.setHorizontalAlignment(SwingConstants.CENTER);
        jlblMarker.setVerticalAlignment(SwingConstants.CENTER);
        jlblMarker.setForeground(new Color(0.5f, 0.5f, 0.75f));
        centerPanel.add(jlblMarker);
    }

    int labelcount = 0;
    for (int counter = 0; counter < UNICODEBLOCKSIZE; counter++) {
        if ((counter % 16) == 0) {
            JLabel jlblMarker = new JLabel(
                    (labelcount > 9 ? "" + (char) (65 + (labelcount - 10)) : "" + labelcount) + "x");
            jlblMarker.setHorizontalAlignment(SwingConstants.CENTER);
            jlblMarker.setVerticalAlignment(SwingConstants.CENTER);
            jlblMarker.setForeground(new Color(0.5f, 0.5f, 0.75f));
            centerPanel.add(jlblMarker);
            labelcount++;
        }
        buttonArray[counter] = new JToggleButton(" ");
        buttonArray[counter].getModel().setActionCommand("");
        buttonArray[counter].setFont(buttonFont);
        buttonArray[counter].setBorder(
                javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.LOWERED));
        buttonArray[counter].addActionListener(this);
        if (counter == 0) {
            FontRenderContext frcLocal = ((java.awt.Graphics2D) (parentEkit.getGraphics()))
                    .getFontRenderContext();
            Rectangle2D fontBounds = buttonFont.getMaxCharBounds(frcLocal);
            int maxCharWidth = (int) (Math.abs(fontBounds.getX())) + (int) (Math.abs(fontBounds.getWidth()));
            int maxCharHeight = (int) (Math.abs(fontBounds.getY())) + (int) (Math.abs(fontBounds.getHeight()));
            Insets buttonInsets = buttonArray[counter].getBorder().getBorderInsets(buttonArray[counter]);
            prefButtonWidth = maxCharWidth + buttonInsets.left + buttonInsets.right;
            prefButtonHeight = maxCharHeight + buttonInsets.top + buttonInsets.bottom;
        }
        buttonArray[counter].setPreferredSize(new Dimension(prefButtonWidth, prefButtonHeight));
        centerPanel.add(buttonArray[counter]);
        buttonGroup.add(buttonArray[counter]);
    }

    JPanel selectorPanel = new JPanel();

    jcmbBlockSelector = new JComboBox(unicodeBlocks);
    jcmbBlockSelector.setSelectedIndex(startIndex);
    jcmbBlockSelector.setActionCommand(CMDCHANGEBLOCK);
    jcmbBlockSelector.addActionListener(this);

    String[] sPages = { "1" };
    jcmbPageSelector = new JComboBox(sPages);
    jcmbPageSelector.setSelectedIndex(0);
    jcmbPageSelector.setActionCommand(CMDCHANGEBLOCK);
    jcmbPageSelector.addActionListener(this);

    selectorPanel.add(new JLabel(Translatrix.getTranslationString("SelectorToolUnicodeBlock")));
    selectorPanel.add(jcmbBlockSelector);
    selectorPanel.add(new JLabel(Translatrix.getTranslationString("SelectorToolUnicodePage")));
    selectorPanel.add(jcmbPageSelector);

    JPanel buttonPanel = new JPanel();

    JButton closeButton = new JButton(Translatrix.getTranslationString("DialogClose"));
    closeButton.setActionCommand("close");
    closeButton.addActionListener(this);
    buttonPanel.add(closeButton);

    contentPane.add(centerPanel, BorderLayout.CENTER);
    contentPane.add(selectorPanel, BorderLayout.NORTH);
    contentPane.add(buttonPanel, BorderLayout.SOUTH);

    this.pack();

    populateButtons(startIndex, 0);

    this.setVisible(true);
}

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();//w w w. j a va2s  .  c o 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:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.label.PainelLabel.java

private void initComponentsEscalavel(ArrayList<FerramentaLabelModel> erros) {

    LabelPanel.carregaTexto(TokenLang.LANG);
    JPanel regraFonteBtn = new JPanel();
    regraFonteBtn.setLayout(new BorderLayout());

    textAreaSourceCode = new G_TextAreaSourceCode();
    textAreaSourceCode.setTipoHTML();//w  w w  .  ja  va  2s.com

    //parentFrame.setJMenuBar(this.criaMenuBar());

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

    salvar = new JButton();
    salvar.setEnabled(false);
    //btnSalvar.setEnabled(false);
    abrir = new JButton();
    cancelar = new JButton();
    // panelLegenda = new JPanel();
    salvaAlteracoes = TxtBuffer.getInstanciaSalvaAlteracoes(textAreaSourceCode.getTextPane(), salvar,
            new JMenuItem(), parentFrame);
    new OnChange(textAreaSourceCode, this);

    pnRegra = new JPanel();
    lbRegras1 = new JLabel();
    lbRegras2 = new JLabel();
    pnParticRotulo = new JPanel();
    spParticRotulo = new JScrollPane();
    tArParticipRotulo = new TArParticipRotulo();

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

    pnBotoes = new JPanel();

    adicionar = new JButton();
    aplicarRotulo = new JButton();
    conteudoParticRotulo = new ArrayList<String>();
    // 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(LabelPanel.TITULO_REGRA));
        pnRegra.setLayout(new GridLayout(2, 1));
        pnRegra.add(lbRegras1);
        lbRegras1.setText(LabelPanel.REGRAP1);
        lbRegras2.setText(LabelPanel.REGRAP2);
        lbRegras1.setHorizontalAlignment(SwingConstants.CENTER);
        lbRegras2.setHorizontalAlignment(SwingConstants.CENTER);
        pnRegra.add(lbRegras1);
        pnRegra.add(lbRegras2);
        pnRegra.setPreferredSize(new Dimension(700, 60));
    }

    // ======== pnDescricao ========
    {
        // ---- Salvar ----
        salvar.setText(GERAL.BTN_SALVAR);
        salvar.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                System.out.println("btn_salvar.actionPerformed()");
                salvarActionPerformed(e);
            }
        });

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

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

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

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

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

        // ======== pnParticRotulo ========
        {
            pnParticRotulo.setBorder(criaBorda(LabelPanel.TITULO_PARTCP_DO_ROTULO));
            pnParticRotulo.setLayout(new BorderLayout());

            // ======== spParticRotulo ========
            {
                spParticRotulo.setViewportView(tArParticipRotulo);
            }
            pnParticRotulo.add(spParticRotulo, BorderLayout.CENTER);
            pnParticRotulo.setPreferredSize(new Dimension(780, 80));
        }
        // ======== pnListaErros ========
        {

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

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

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

                    adicionarActionPerformed(e);
                }
            });

            adicionar.setToolTipText(LabelPanel.BTN_ADICIONAR_TOOLTIP);
            adicionar.getAccessibleContext().setAccessibleDescription(LabelPanel.BTN_ADICIONAR_TOOLTIP);
            adicionar.getAccessibleContext().setAccessibleName(LabelPanel.BTN_ADICIONAR_TOOLTIP);
            adicionar.setBounds(10, 5, 150, 25);
            pnBotoes.add(adicionar);

            // ---- aplicarRotulo ----
            aplicarRotulo.setEnabled(false);
            aplicarRotulo.setText(LabelPanel.BTN_APLICAR_ROTULO);
            aplicarRotulo.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    aplicarRotuloActionPerformed(e);
                }
            });

            aplicarRotulo.setToolTipText(LabelPanel.BTN_APLICAR_ROTULO_TOOLTIP);
            aplicarRotulo.getAccessibleContext()
                    .setAccessibleDescription(LabelPanel.BTN_APLICAR_ROTULO_TOOLTIP);
            aplicarRotulo.getAccessibleContext().setAccessibleName(LabelPanel.BTN_APLICAR_ROTULO_TOOLTIP);
            aplicarRotulo.setBounds(165, 5, 150, 25);
            pnBotoes.add(aplicarRotulo);
        }
    }
    /*
     * Colocar os controles
     */
    pnRegra.setBackground(CoresDefault.getCorPaineis());
    regraFonteBtn.add(pnRegra, BorderLayout.NORTH);
    textAreaSourceCode.setBorder(criaBorda(""));
    textAreaSourceCode.setBackground(CoresDefault.getCorPaineis());
    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());
    pnParticRotulo.setBackground(CoresDefault.getCorPaineis());
    textoErrosBtn.add(pnParticRotulo, 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);
    pnSalvarCancelar.setBackground(CoresDefault.getCorPaineis());
    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.showPainelFerramentaLabelPArq(TxtBuffer.getContentOriginal());
                setVisible(true);
            }
        });
        //reverter.setActionCommand("Reverter");
        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);
    }

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

    this.setVisible(true);

}

From source file:com.funambol.foundation.admin.PIMSyncSourceConfigPanel.java

/**
 * Creates the panel's components and layout.
 * @todo adjust layout/*from w ww  . j ava 2  s.  c o  m*/
 */
private void init() {
    // set layout
    this.setLayout(null);
    // set properties of label, position and border
    //  referred to the title of the panel
    titledBorder = new TitledBorder("");
    panelName.setFont(titlePanelFont);
    panelName.setText(getPanelName());
    panelName.setBounds(new Rectangle(14, 5, 316, 28));
    panelName.setAlignmentX(SwingConstants.CENTER);
    panelName.setBorder(titledBorder);

    final int LABEL_X = 14;
    final int VALUE_X = 170;
    int y = 60;
    final int GAP_X = 150;
    final int GAP_Y = 30;

    sourceUriLabel.setText("Source URI: ");
    sourceUriLabel.setFont(defaultFont);
    sourceUriLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18));
    sourceUriValue.setFont(defaultFont);
    sourceUriValue.setBounds(new Rectangle(VALUE_X, y, 350, 18));

    y += GAP_Y; // New line

    nameLabel.setText("Name: ");
    nameLabel.setFont(defaultFont);
    nameLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18));
    nameValue.setFont(defaultFont);
    nameValue.setBounds(new Rectangle(VALUE_X, y, 350, 18));
    y += GAP_Y; // New line

    typeLabel.setText("Type: ");
    typeLabel.setFont(defaultFont);
    typeLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18));
    typeCombo.setFont(defaultFont);
    typeCombo.setBounds(new Rectangle(VALUE_X, y, 350, 18));

    // What happens when the Type value is changed?
    typeCombo.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (isSIFSelected()) {
                encoding.setSelected(true); // SIFs always encoded
                encoding.setEnabled(false);
            } else {
                encryption.setSelected(false);
                encoding.setSelected(false);
                encoding.setEnabled(true);
            }
        }
    });

    y += GAP_Y; // New line
    int x = LABEL_X;

    y = addExtraComponents(x, y, GAP_X, GAP_Y); // Add other components, if needed

    encryption.setText("Encrypt data");
    encryption.setFont(defaultFont);
    encryption.setSelected(false);
    encryption.setBounds(x, y, 150, 25);

    // What happens if the encryption is enabled?
    encryption.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == e.SELECTED) {
                encoding.setSelected(true); // Encryption implies encoding
                encoding.setEnabled(false);
            }
            if (e.getStateChange() == e.DESELECTED) {
                if (!isSIFSelected()) {
                    encoding.setEnabled(true);
                }
            }
        }
    });

    y += GAP_Y; // New line

    encoding.setText("Encode data in Base 64");
    encoding.setFont(defaultFont);
    encoding.setSelected(false);
    encoding.setBounds(x, y, 150, 25);

    y += GAP_Y; // New line
    y += GAP_Y; // New line

    confirmButton.setFont(defaultFont);
    confirmButton.setText("Add");
    confirmButton.setBounds(VALUE_X, y, 70, 25);

    // What happens when the confirmButton is pressed?
    confirmButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            try {
                validateValues();
                getValues();
                if (getState() == STATE_INSERT) {
                    PIMSyncSourceConfigPanel.this.actionPerformed(new ActionEvent(PIMSyncSourceConfigPanel.this,
                            ACTION_EVENT_INSERT, event.getActionCommand()));
                } else {
                    PIMSyncSourceConfigPanel.this.actionPerformed(new ActionEvent(PIMSyncSourceConfigPanel.this,
                            ACTION_EVENT_UPDATE, event.getActionCommand()));
                }
            } catch (Exception e) {
                notifyError(new AdminException(e.getMessage(), e));
            }
        }
    });

    // Adds all components to the panel
    this.add(panelName, null);
    this.add(nameLabel, null);
    this.add(sourceUriLabel, null);
    this.add(sourceUriValue, null);
    this.add(nameValue, null);
    this.add(typeLabel, null);
    this.add(typeCombo, null);
    this.add(encryption, null);
    this.add(encoding, null);
    this.add(confirmButton, null);
}

From source file:com.funambol.exchange.admin.ExchangeSyncSourceConfigPanel.java

/**
 * Creates the panel's components and layout.
 * @todo adjust layout/*from  w  ww  . j  a va2  s  . c  o  m*/
 */
private void init() {
    // set layout
    this.setLayout(null);
    // set properties of label, position and border
    //  referred to the title of the panel
    titledBorder = new TitledBorder("");
    panelName.setFont(titlePanelFont);
    panelName.setText(getPanelName());
    panelName.setBounds(new Rectangle(14, 5, 316, 28));
    panelName.setAlignmentX(SwingConstants.CENTER);
    panelName.setBorder(titledBorder);

    final int LABEL_X = 14;
    final int VALUE_X = 170;
    int y = 60;
    final int GAP_X = 150;
    final int GAP_Y = 30;

    sourceUriLabel.setText("Source URI: ");
    sourceUriLabel.setFont(defaultFont);
    sourceUriLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18));
    sourceUriValue.setFont(defaultFont);
    sourceUriValue.setBounds(new Rectangle(VALUE_X, y, 350, 18));

    y += GAP_Y; // New line

    nameLabel.setText("Name: ");
    nameLabel.setFont(defaultFont);
    nameLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18));
    nameValue.setFont(defaultFont);
    nameValue.setBounds(new Rectangle(VALUE_X, y, 350, 18));
    y += GAP_Y; // New line

    y += GAP_Y; // New line
    typeLabel.setText("Type: ");
    typeLabel.setFont(defaultFont);
    typeLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18));
    typeCombo.setFont(defaultFont);
    typeCombo.setBounds(new Rectangle(VALUE_X, y, 350, 18));

    // What happens when the Type value is changed?
    typeCombo.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            if (isSIFSelected()) {
                encoding.setSelected(true); // SIFs always encoded
                encoding.setEnabled(false);
            } else {
                encryption.setSelected(false);
                encoding.setSelected(false);
                encoding.setEnabled(true);
            }
        }
    });

    y += GAP_Y; // New line
    int x = LABEL_X;

    y = addExtraComponents(x, y, GAP_X, GAP_Y); // Add other components, if needed

    encryption.setText("Encrypt data");
    encryption.setFont(defaultFont);
    encryption.setSelected(false);
    encryption.setBounds(x, y, 150, 25);

    // What happens if the encryption is enabled?
    encryption.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == e.SELECTED) {
                encoding.setSelected(true); // Encryption implies encoding
                encoding.setEnabled(false);
            }
            if (e.getStateChange() == e.DESELECTED) {
                if (!isSIFSelected()) {
                    encoding.setEnabled(true);
                }
            }
        }
    });

    y += GAP_Y; // New line

    encoding.setText("Encode data in Base 64");
    encoding.setFont(defaultFont);
    encoding.setSelected(false);
    encoding.setBounds(x, y, 150, 25);

    y += GAP_Y; // New line
    y += GAP_Y; // New line

    confirmButton.setFont(defaultFont);
    confirmButton.setText("Add");
    confirmButton.setBounds(VALUE_X, y, 70, 25);

    // What happens when the confirmButton is pressed?
    confirmButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent event) {
            try {
                validateValues();
                getValues();
                if (getState() == STATE_INSERT) {
                    ExchangeSyncSourceConfigPanel.this.actionPerformed(new ActionEvent(
                            ExchangeSyncSourceConfigPanel.this, ACTION_EVENT_INSERT, event.getActionCommand()));
                } else {
                    ExchangeSyncSourceConfigPanel.this.actionPerformed(new ActionEvent(
                            ExchangeSyncSourceConfigPanel.this, ACTION_EVENT_UPDATE, event.getActionCommand()));
                }
            } catch (Exception e) {
                notifyError(new AdminException(e.getMessage(), e));
            }
        }
    });

    // Adds all components to the panel
    this.add(panelName, null);
    this.add(nameLabel, null);
    this.add(sourceUriLabel, null);
    this.add(sourceUriValue, null);
    this.add(nameValue, null);
    this.add(typeLabel, null);

    this.add(typeCombo, null);
    this.add(encryption, null);
    this.add(encoding, null);
    this.add(confirmButton, null);
}

From source file:edu.ku.brc.af.ui.forms.formatters.DataObjFieldFormatMultiplePanel.java

/**
 * //from   ww  w .  ja  v a 2  s  . co  m
 */
private void setFormatSwitchTblColumnProperties() {
    // set details of 1st column (field values)
    TableColumnModel model = formatSwitchTbl.getColumnModel();
    TableColumn column = model.getColumn(model.getColumnIndex(FIELD_VALUE_COL));
    column.setMinWidth(20);
    column.setMaxWidth(300);
    column.setPreferredWidth(70);
    DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
    renderer.setHorizontalAlignment(SwingConstants.CENTER);
    column.setCellRenderer(renderer);

    // set details of 3rd column (ellipsis buttons)
    column = model.getColumn(model.getColumnIndex(ELLIPSIS_BUTTON_COL));
    column.setCellRenderer(new EditDataObjFormatButtonRenderer());
    column.setCellEditor(new EditDataObjFormatButtonEditor(createCheckBox()));
    column.setMinWidth(20);
    column.setMaxWidth(20);
    column.setPreferredWidth(20);
}

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.objeto.PainelObjeto.java

private void initComponentsEscalavel(

        ArrayList<FerramentaDescricaoModel> erros) {
    Ferramenta_Objetos.carregaTexto(TokenLang.LANG);
    JPanel regraFonteBtn = new JPanel();
    regraFonteBtn.setLayout(new BorderLayout());

    scrollPaneDescricao = new G_TextAreaSourceCode();
    scrollPaneDescricao.setTipoHTML();/*from w w  w  .  ja  v  a2  s .  c  om*/
    new OnChange(scrollPaneDescricao, this);
    //parentFrame.setJMenuBar(this.criaMenuBar());

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

    // scrollPaneCorrecaoLabel = new ConteudoCorrecaoLabel();

    salvar = new JButton();
    abrir = new JButton();
    cancelar = new JButton();
    strConteudoalt = new String();
    // panelLegenda = new JPanel();

    pnRegra = new JPanel();
    lbRegras1 = new JLabel();
    lbRegras2 = new JLabel();
    pnSetaDescricao = new JPanel();
    pnSetaDescricao.setLayout(new BorderLayout());
    spTextoDescricao = new JScrollPane();
    tArParticipRotulo = new TArParticipRotulo();
    conteudoDoAlt = new JTextArea();
    pnListaErros = new JPanel();
    scrollPanetabLinCod = new JScrollPane();
    lbTemp = new JLabel();
    pnBotoes = new JPanel();
    btnSalvar = new JMenuItem(GERAL.BTN_SALVAR);

    adicionar = new JButton();
    conteudoParticRotulo = new ArrayList<String>();
    // setJMenuBar(this.criaMenuBar());
    // ======== this ========
    // setTitle("Associe explicitamente os r\u00f3tulos aos respectivos
    // controles:");
    salvar.setEnabled(false);
    salvaAlteracoes = TxtBuffer.getInstanciaSalvaAlteracoes(scrollPaneDescricao.getTextPane(), salvar,
            new JMenuItem(), parentFrame);
    setBackground(CoresDefault.getCorPaineis());
    Container contentPane = this;// ??
    contentPane.setLayout(new GridLayout(2, 1));

    // ======== pnRegra ========
    {
        pnRegra.setBorder(criaBorda(Ferramenta_Objetos.TITULO_REGRA));
        pnRegra.setLayout(new GridLayout(2, 1));
        pnRegra.add(lbRegras1);
        lbRegras1.setText(Ferramenta_Objetos.REGRAP1);
        lbRegras2.setText(Ferramenta_Objetos.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");

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

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

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

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

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

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

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

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

    // pnSetaDescricao.setBorder(criaBorda(Ferramenta_Imagens.TITULO_DIGITE_O_ALT));

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

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

    // pnRegra.add(lbRegras1);

    JScrollPane sp = new JScrollPane();

    sp.setViewportView(conteudoDoAlt);
    sp.setPreferredSize(new Dimension(500, 300));
    sp.setBorder(criaBorda(Ferramenta_Objetos.CONTEUDO_ALTER));
    // pnSetaDescricao.add(spTextoDescricao,cons);

    pnSetaDescricao.setPreferredSize(new Dimension(400, 60));

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

        pnListaErros.setBorder(criaBorda(Ferramenta_Objetos.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_Objetos.BTN_ADICIONAR);
        adicionar.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                adicionarActionPerformed(e);
            }
        });
    }

    /*
     * Colocar os controles
     */
    pnRegra.setBackground(CoresDefault.getCorPaineis());
    regraFonteBtn.add(pnRegra, BorderLayout.NORTH);
    scrollPaneDescricao.setBorder(criaBorda(""));
    scrollPaneDescricao.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, scrollPaneDescricao);
    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);
    aplicar = new JButton();
    aplicar.setBounds(3, 3, 120, 30);
    pnBotoes.add(aplicar);

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

    aplicar.setToolTipText(Ferramenta_Objetos.DICA_APLICAR);
    aplicar.getAccessibleContext().setAccessibleDescription(Ferramenta_Objetos.DICA_APLICAR);
    aplicar.getAccessibleContext().setAccessibleName(Ferramenta_Objetos.DICA_APLICAR);
    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) {
                // TODO Auto-generated method stub
                setVisible(false);
                TxtBuffer.setContent(TxtBuffer.getContentOriginal());
                parentFrame.showPainelFerramentaDescricaoObjetosPArq(TxtBuffer.getContentOriginal());
                setVisible(true);
            }

        });
        //reverter.setActionCommand("Reverter");
        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());
    textoErrosBtn.add(pnListaErros, BorderLayout.CENTER);
    contentPane.setBackground(CoresDefault.getCorPaineis());
    contentPane.add(textoErrosBtn);
    if (tableLinCod.getRowCount() == 0)
        tableLinCod.addLinha(0, 0, GERAL.DOC_SEM_ERROS);
    this.setVisible(true);

}