Example usage for javax.swing JPanel setBackground

List of usage examples for javax.swing JPanel setBackground

Introduction

In this page you can find the example usage for javax.swing JPanel setBackground.

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The background color of the component.")
public void setBackground(Color bg) 

Source Link

Document

Sets the background color of this component.

Usage

From source file:lcmc.gui.resources.ServiceInfo.java

/** Creates operations combo boxes with labels. */
protected void addOperations(final JPanel optionsPanel, final int leftWidth, final int rightWidth) {
    int rows = 0;
    final JPanel sectionPanel = getParamPanel(Tools.getString("ClusterBrowser.Operations"));
    String defaultOpIdRef = null;
    final Info savedOpIdRef = getSameServiceOpIdRef();
    if (savedOpIdRef != null) {
        defaultOpIdRef = savedOpIdRef.toString();
    }/*from w  ww  .j  a  va2  s  .c  o m*/
    sameAsOperationsWi = new Widget(defaultOpIdRef, getSameServicesOperations(), null, /* units */
            null, /* type */
            null, /* regexp */
            rightWidth, null, /* abbrv */
            new AccessMode(ConfigData.AccessType.ADMIN, false));
    sameAsOperationsWi.setToolTipText(defaultOpIdRef);
    final JLabel label = new JLabel(Tools.getString("ClusterBrowser.OperationsSameAs"));
    sameAsOperationsWi.setLabel(label, "");
    final JPanel saPanel = new JPanel(new SpringLayout());
    saPanel.setBackground(ClusterBrowser.BUTTON_PANEL_BACKGROUND);
    addField(saPanel, label, sameAsOperationsWi, leftWidth, rightWidth, 0);
    SpringUtilities.makeCompactGrid(saPanel, 1, 2, 1, 1, // initX, initY
            1, 1); // xPad, yPad
    sectionPanel.add(saPanel);
    boolean allAreDefaultValues = true;
    mSavedOperationsLock.lock();
    final JPanel normalOpPanel = new JPanel(new SpringLayout());
    normalOpPanel.setBackground(ClusterBrowser.PANEL_BACKGROUND);
    int normalRows = 0;
    final JPanel advancedOpPanel = new JPanel(new SpringLayout());
    advancedOpPanel.setBackground(ClusterBrowser.PANEL_BACKGROUND);
    addToAdvancedList(advancedOpPanel);
    advancedOpPanel.setVisible(Tools.getConfigData().isAdvancedMode());
    int advancedRows = 0;
    for (final String op : getResourceAgent().getOperationNames()) {
        for (final String param : getBrowser().getCRMOperationParams(op)) {
            String defaultValue = resourceAgent.getOperationDefault(op, param);
            if (defaultValue == null) {
                continue;
            }
            if (ClusterBrowser.HB_OP_IGNORE_DEFAULT.contains(op)) {
                defaultValue = "";
            }
            Widget.Type type;
            final String regexp = "^-?\\d*$";
            type = Widget.Type.TEXTFIELDWITHUNIT;
            // TODO: old style resources
            if (defaultValue == null) {
                defaultValue = "0";
            }
            String savedValue = null;
            mOperationsComboBoxHashWriteLock.lock();
            try {
                final Widget prevWi = operationsComboBoxHash.get(op, param);
                if (prevWi != null) {
                    savedValue = prevWi.getStringValue();
                }
            } finally {
                mOperationsComboBoxHashWriteLock.unlock();
            }
            if (savedValue == null) {
                savedValue = savedOperation.get(op, param);
            }
            if (!getService().isNew() && (savedValue == null || "".equals(savedValue))) {
                savedValue = getOpDefaultsDefault(param);
                if (savedValue == null) {
                    savedValue = "";
                }
            }
            if (!defaultValue.equals(savedValue)) {
                allAreDefaultValues = false;
            }
            if (savedValue != null) {
                defaultValue = savedValue;
            }
            final Widget wi = new Widget(defaultValue, null, /* items */
                    getUnits(), type, regexp, rightWidth, null, /* abbrv */
                    new AccessMode(ConfigData.AccessType.ADMIN, false));
            wi.setEnabled(savedOpIdRef == null);

            mOperationsComboBoxHashWriteLock.lock();
            try {
                operationsComboBoxHash.put(op, param, wi);
            } finally {
                mOperationsComboBoxHashWriteLock.unlock();
            }
            rows++;
            final JLabel wiLabel = new JLabel(Tools.ucfirst(op) + " / " + Tools.ucfirst(param));
            wi.setLabel(wiLabel, "");
            JPanel panel;
            if (getBrowser().isCRMOperationAdvanced(op, param)) {
                panel = advancedOpPanel;
                advancedRows++;
            } else {
                panel = normalOpPanel;
                normalRows++;
            }
            addField(panel, wiLabel, wi, leftWidth, rightWidth, 0);
        }
    }
    SpringUtilities.makeCompactGrid(normalOpPanel, normalRows, 2, 1, 1, // initX, initY
            1, 1); // xPad, yPad
    SpringUtilities.makeCompactGrid(advancedOpPanel, advancedRows, 2, 1, 1, // initX, initY
            1, 1); // xPad, yPad
    sectionPanel.add(normalOpPanel);
    sectionPanel.add(getMoreOptionsPanel(leftWidth + rightWidth + 4));
    sectionPanel.add(advancedOpPanel);
    mSavedOperationsLock.unlock();
    if (allAreDefaultValues && savedOpIdRef == null) {
        sameAsOperationsWi.setValue(OPERATIONS_DEFAULT_VALUES_TEXT);
    }
    sameAsOperationsWi.addListeners(new WidgetListener() {
        @Override
        public void check(final Object value) {
            final Info info = sameAsOperationsWiValue();
            setOperationsSameAs(info);
            final String[] params = getParametersFromXML();
            setApplyButtons(CACHED_FIELD, params);
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    if (info != null) {
                        sameAsOperationsWi.setToolTipText(info.toString());
                    }
                }
            });
        }
    });
    optionsPanel.add(sectionPanel);
}

From source file:lcmc.gui.resources.ServiceInfo.java

/** Returns existing service manu item. */
private MyMenu getExistingServiceMenuItem(final String name, final boolean enableForNew,
        final boolean testOnly) {
    final ServiceInfo thisClass = this;
    return new MyMenu(name, new AccessMode(ConfigData.AccessType.ADMIN, false),
            new AccessMode(ConfigData.AccessType.OP, false)) {
        private static final long serialVersionUID = 1L;
        private final Lock mUpdateLock = new ReentrantLock();

        @Override//from  w  w w . j  av a2  s.c o m
        public String enablePredicate() {
            if (getBrowser().clStatusFailed()) {
                return ClusterBrowser.UNKNOWN_CLUSTER_STATUS_STRING;
            } else if (getService().isRemoved()) {
                return IS_BEING_REMOVED_STRING;
            } else if (getService().isOrphaned()) {
                return IS_ORPHANED_STRING;
            } else if (!enableForNew && getService().isNew()) {
                return IS_NEW_STRING;
            }
            if (getBrowser().getExistingServiceList(thisClass).size() == 0) {
                return "<<empty;>>";
            }
            return null;
        }

        @Override
        public void update() {
            final Thread t = new Thread(new Runnable() {
                @Override
                public void run() {
                    if (mUpdateLock.tryLock()) {
                        try {
                            updateThread();
                        } finally {
                            mUpdateLock.unlock();
                        }
                    }
                }
            });
            t.start();
        }

        private void updateThread() {
            final JCheckBox colocationWi = new JCheckBox("Colo", true);
            final JCheckBox orderWi = new JCheckBox("Order", true);
            colocationWi.setBackground(ClusterBrowser.STATUS_BACKGROUND);
            colocationWi.setPreferredSize(colocationWi.getMinimumSize());
            orderWi.setBackground(ClusterBrowser.STATUS_BACKGROUND);
            orderWi.setPreferredSize(orderWi.getMinimumSize());
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    setEnabled(false);
                }
            });
            Tools.invokeAndWait(new Runnable() {
                @Override
                public void run() {
                    removeAll();
                }
            });

            final MyListModel<MyMenuItem> dlm = new MyListModel<MyMenuItem>();
            final Map<MyMenuItem, ButtonCallback> callbackHash = new HashMap<MyMenuItem, ButtonCallback>();
            final MyList<MyMenuItem> list = new MyList<MyMenuItem>(dlm, getBackground());

            final List<JDialog> popups = new ArrayList<JDialog>();
            for (final ServiceInfo asi : getBrowser().getExistingServiceList(thisClass)) {
                if (asi.isConstraintPH() && isConstraintPH()) {
                    continue;
                }
                if (asi.getCloneInfo() != null || asi.getGroupInfo() != null) {
                    /* skip services that are clones or in groups. */
                    continue;
                }
                addExistingServiceMenuItem(asi.toString(), asi, dlm, callbackHash, list, colocationWi, orderWi,
                        popups, testOnly);
                asi.addExistingGroupServiceMenuItems(thisClass, dlm, callbackHash, list, colocationWi, orderWi,
                        popups, testOnly);
            }
            final JPanel colOrdPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
            colOrdPanel.setBackground(ClusterBrowser.STATUS_BACKGROUND);
            colOrdPanel.add(colocationWi);
            colOrdPanel.add(orderWi);
            final MyMenu thisM = this;
            try {
                SwingUtilities.invokeAndWait(new Runnable() {
                    @Override
                    public void run() {
                        final boolean ret = Tools.getScrollingMenu(name, colOrdPanel, thisM, dlm, list,
                                thisClass, popups, callbackHash);
                        if (!ret) {
                            setEnabled(false);
                        }
                    }
                });
            } catch (final InterruptedException ix) {
                Thread.currentThread().interrupt();
            } catch (final InvocationTargetException x) {
                Tools.printStackTrace();
            }
            super.update();
        }
    };
}

From source file:lcmc.gui.resources.ServiceInfo.java

/** Returns info panel with comboboxes for service parameters. */
@Override//from  ww  w .jav a 2s  .c  o m
public JComponent getInfoPanel() {
    if (!getResourceAgent().isMetaDataLoaded()) {
        final JPanel p = new JPanel();
        p.add(new JLabel(Tools.getString("ServiceInfo.LoadingMetaData")));
        return p;
    }
    final CloneInfo ci = getCloneInfo();
    if (ci == null) {
        getBrowser().getCRMGraph().pickInfo(this);
    } else {
        getBrowser().getCRMGraph().pickInfo(ci);
    }
    if (infoPanel != null) {
        return infoPanel;
    }
    /* init save button */
    final boolean abExisted = getApplyButton() != null;
    final ServiceInfo thisClass = this;
    final ButtonCallback buttonCallback = new ButtonCallback() {
        private volatile boolean mouseStillOver = false;

        /**
         * Whether the whole thing should be enabled.
         */
        @Override
        public final boolean isEnabled() {
            final Host dcHost = getBrowser().getDCHost();
            if (dcHost == null) {
                return false;
            }
            if (Tools.versionBeforePacemaker(dcHost)) {
                return false;
            }
            return true;
        }

        @Override
        public final void mouseOut() {
            if (!isEnabled()) {
                return;
            }
            mouseStillOver = false;
            getBrowser().getCRMGraph().stopTestAnimation(getApplyButton());
            getApplyButton().setToolTipText(null);
        }

        @Override
        public final void mouseOver() {
            if (!isEnabled()) {
                return;
            }
            mouseStillOver = true;
            getApplyButton().setToolTipText(ClusterBrowser.STARTING_PTEST_TOOLTIP);
            getApplyButton()
                    .setToolTipBackground(Tools.getDefaultColor("ClusterBrowser.Test.Tooltip.Background"));
            Tools.sleep(250);
            if (!mouseStillOver) {
                return;
            }
            mouseStillOver = false;
            final CountDownLatch startTestLatch = new CountDownLatch(1);
            getBrowser().getCRMGraph().startTestAnimation(getApplyButton(), startTestLatch);
            final Host dcHost = getBrowser().getDCHost();
            getBrowser().ptestLockAcquire();
            final ClusterStatus cs = getBrowser().getClusterStatus();
            cs.setPtestData(null);
            apply(dcHost, true);
            final PtestData ptestData = new PtestData(CRM.getPtest(dcHost));
            getApplyButton().setToolTipText(ptestData.getToolTip());
            cs.setPtestData(ptestData);
            getBrowser().ptestLockRelease();
            startTestLatch.countDown();
        }
    };
    if (getResourceAgent().isGroup()) {
        initApplyButton(buttonCallback, Tools.getString("Browser.ApplyGroup"));
    } else {
        initApplyButton(buttonCallback);
    }
    if (ci != null) {
        ci.setApplyButton(getApplyButton());
        ci.setRevertButton(getRevertButton());
    }
    /* add item listeners to the apply button. */
    if (!abExisted) {
        getApplyButton().addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent e) {
                final Thread thread = new Thread(new Runnable() {
                    @Override
                    public void run() {
                        getBrowser().clStatusLock();
                        apply(getBrowser().getDCHost(), false);
                        getBrowser().clStatusUnlock();
                    }
                });
                thread.start();
            }
        });

        getRevertButton().addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent e) {
                final Thread thread = new Thread(new Runnable() {
                    @Override
                    public void run() {
                        getBrowser().clStatusLock();
                        revert();
                        getBrowser().clStatusUnlock();
                    }
                });
                thread.start();
            }
        });
    }
    /* main, button and options panels */
    final JPanel mainPanel = new JPanel();
    mainPanel.setBackground(ClusterBrowser.PANEL_BACKGROUND);
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
    final JPanel buttonPanel = new JPanel(new BorderLayout());
    buttonPanel.setBackground(ClusterBrowser.BUTTON_PANEL_BACKGROUND);
    buttonPanel.setMinimumSize(new Dimension(0, 50));
    buttonPanel.setPreferredSize(new Dimension(0, 50));
    buttonPanel.setMaximumSize(new Dimension(Short.MAX_VALUE, 50));

    final JPanel optionsPanel = new JPanel();
    optionsPanel.setBackground(ClusterBrowser.PANEL_BACKGROUND);
    optionsPanel.setLayout(new BoxLayout(optionsPanel, BoxLayout.Y_AXIS));
    optionsPanel.setAlignmentX(Component.LEFT_ALIGNMENT);

    /* Actions */
    final JMenuBar mb = new JMenuBar();
    mb.setBackground(ClusterBrowser.PANEL_BACKGROUND);
    AbstractButton serviceMenu;
    if (ci == null) {
        serviceMenu = getActionsButton();
    } else {
        serviceMenu = ci.getActionsButton();
    }
    buttonPanel.add(serviceMenu, BorderLayout.EAST);
    String defaultValue = PRIMITIVE_TYPE_STRING;
    if (ci != null) {
        if (ci.getService().isMaster()) {
            defaultValue = MASTER_SLAVE_TYPE_STRING;
        } else {
            defaultValue = CLONE_TYPE_STRING;
        }
    }
    if (!getResourceAgent().isClone() && getGroupInfo() == null) {
        typeRadioGroup = new Widget(defaultValue,
                new String[] { PRIMITIVE_TYPE_STRING, CLONE_TYPE_STRING, MASTER_SLAVE_TYPE_STRING },
                null, /* units */
                Widget.Type.RADIOGROUP, null, /* regexp */
                ClusterBrowser.SERVICE_LABEL_WIDTH + ClusterBrowser.SERVICE_FIELD_WIDTH, null, /* abbrv */
                new AccessMode(ConfigData.AccessType.ADMIN, false));

        if (!getService().isNew()) {
            typeRadioGroup.setEnabled(false);
        }
        typeRadioGroup.addListeners(new WidgetListener() {
            @Override
            public void check(final Object value) {
                changeType(((JRadioButton) value).getText());
            }
        });
        final JPanel tp = new JPanel();
        tp.setBackground(ClusterBrowser.PANEL_BACKGROUND);
        tp.setLayout(new BoxLayout(tp, BoxLayout.Y_AXIS));
        tp.add(typeRadioGroup);
        typeRadioGroup.setBackgroundColor(ClusterBrowser.PANEL_BACKGROUND);
        optionsPanel.add(tp);
    }
    if (ci != null) {
        /* add clone fields */
        addCloneFields(optionsPanel, ClusterBrowser.SERVICE_LABEL_WIDTH, ClusterBrowser.SERVICE_FIELD_WIDTH);
    }
    getResource().setValue(GUI_ID, getService().getId());

    /* get dependent resources and create combo boxes for ones, that
     * need parameters */
    final String[] params = getParametersFromXML();
    final Info savedMAIdRef = savedMetaAttrInfoRef;
    addParams(optionsPanel, params, ClusterBrowser.SERVICE_LABEL_WIDTH, ClusterBrowser.SERVICE_FIELD_WIDTH,
            getSameAsFields(savedMAIdRef));
    if (ci == null) {
        /* score combo boxes */
        addHostLocations(optionsPanel, ClusterBrowser.SERVICE_LABEL_WIDTH, ClusterBrowser.SERVICE_FIELD_WIDTH);
    }

    for (final String param : params) {
        if (isMetaAttr(param)) {
            final Widget wi = getWidget(param, null);
            wi.setEnabled(savedMAIdRef == null);
        }
    }
    if (!getService().isNew()) {
        getWidget(GUI_ID, null).setEnabled(false);
    }
    if (!getResourceAgent().isGroup() && !getResourceAgent().isClone()) {
        /* Operations */
        addOperations(optionsPanel, ClusterBrowser.SERVICE_LABEL_WIDTH, ClusterBrowser.SERVICE_FIELD_WIDTH);
        /* add item listeners to the operations combos */
        for (final String op : getResourceAgent().getOperationNames()) {
            for (final String param : getBrowser().getCRMOperationParams(op)) {
                addOperationListeners(op, param);
            }
        }
    }
    /* add item listeners to the host scores combos */
    if (ci == null) {
        addHostLocationsListeners();
    } else {
        ci.addHostLocationsListeners();
    }
    /* apply button */
    addApplyButton(buttonPanel);
    addRevertButton(buttonPanel);
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            /* invoke later on purpose  */
            setApplyButtons(null, params);
        }
    });
    mainPanel.add(optionsPanel);
    final JPanel newPanel = new JPanel();
    newPanel.setBackground(ClusterBrowser.PANEL_BACKGROUND);
    newPanel.setLayout(new BoxLayout(newPanel, BoxLayout.Y_AXIS));
    newPanel.add(buttonPanel);
    newPanel.add(
            getMoreOptionsPanel(ClusterBrowser.SERVICE_LABEL_WIDTH + ClusterBrowser.SERVICE_FIELD_WIDTH + 4));
    newPanel.add(new JScrollPane(mainPanel));
    /* if id textfield was changed and this id is not used,
     * enable apply button */
    infoPanel = newPanel;
    infoPanelDone();
    return infoPanel;
}

From source file:lcmc.gui.resources.ServiceInfo.java

/** Adds new Service and dependence. */
private MyMenu getAddServiceMenuItem(final boolean testOnly, final String name) {
    final ServiceInfo thisClass = this;
    return new MyMenu(name, new AccessMode(ConfigData.AccessType.ADMIN, false),
            new AccessMode(ConfigData.AccessType.OP, false)) {
        private static final long serialVersionUID = 1L;
        private final Lock mUpdateLock = new ReentrantLock();

        @Override/*from   www  .j  av  a2 s.  c  o  m*/
        public String enablePredicate() {
            if (getBrowser().clStatusFailed()) {
                return ClusterBrowser.UNKNOWN_CLUSTER_STATUS_STRING;
            } else if (getService().isRemoved()) {
                return IS_BEING_REMOVED_STRING;
            } else if (getService().isOrphaned()) {
                return IS_ORPHANED_STRING;
            } else if (getService().isNew()) {
                return IS_NEW_STRING;
            }
            return null;
        }

        @Override
        public void update() {
            final Thread t = new Thread(new Runnable() {
                @Override
                public void run() {
                    if (mUpdateLock.tryLock()) {
                        try {
                            updateThread();
                        } finally {
                            mUpdateLock.unlock();
                        }
                    }
                }
            });
            t.start();
        }

        private void updateThread() {
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    setEnabled(false);
                }
            });
            Tools.invokeAndWait(new Runnable() {
                @Override
                public void run() {
                    removeAll();
                }
            });
            final Point2D pos = getPos();
            final CRMXML crmXML = getBrowser().getCRMXML();
            final ResourceAgent fsService = crmXML.getResourceAgent("Filesystem",
                    ResourceAgent.HEARTBEAT_PROVIDER, ResourceAgent.OCF_CLASS);
            final MyMenu thisMenu = this;
            if (crmXML.isLinbitDrbdPresent()) { /* just skip it, if it
                                                   is not */
                final ResourceAgent linbitDrbdService = crmXML.getHbLinbitDrbd();
                /* Linbit:DRBD */
                try {
                    SwingUtilities.invokeAndWait(new Runnable() {
                        @Override
                        public void run() {
                            addDrbdLinbitMenu(thisMenu, crmXML, pos, fsService, testOnly);
                        }
                    });
                } catch (final InterruptedException ix) {
                    Thread.currentThread().interrupt();
                } catch (final InvocationTargetException x) {
                    Tools.printStackTrace();
                }

            }
            if (crmXML.isDrbddiskPresent()) { /* just skip it,
                                                 if it is not */
                /* drbddisk */
                try {
                    SwingUtilities.invokeAndWait(new Runnable() {
                        @Override
                        public void run() {
                            addDrbddiskMenu(thisMenu, crmXML, pos, fsService, testOnly);
                        }
                    });
                } catch (final InterruptedException ix) {
                    Thread.currentThread().interrupt();
                } catch (final InvocationTargetException x) {
                    Tools.printStackTrace();
                }
            }
            final ResourceAgent ipService = crmXML.getResourceAgent("IPaddr2", ResourceAgent.HEARTBEAT_PROVIDER,
                    ResourceAgent.OCF_CLASS);
            if (ipService != null) { /* just skip it, if it is not*/
                /* ipaddr */
                try {
                    SwingUtilities.invokeAndWait(new Runnable() {
                        @Override
                        public void run() {
                            addIpMenu(thisMenu, pos, ipService, testOnly);
                        }
                    });
                } catch (final InterruptedException ix) {
                    Thread.currentThread().interrupt();
                } catch (final InvocationTargetException x) {
                    Tools.printStackTrace();
                }
            }
            if (fsService != null) { /* just skip it, if it is not*/
                /* Filesystem */
                try {
                    SwingUtilities.invokeAndWait(new Runnable() {
                        @Override
                        public void run() {
                            addFilesystemMenu(thisMenu, pos, fsService, testOnly);
                        }
                    });
                } catch (final InterruptedException ix) {
                    Thread.currentThread().interrupt();
                } catch (final InvocationTargetException x) {
                    Tools.printStackTrace();
                }
            }
            final List<JDialog> popups = new ArrayList<JDialog>();
            for (final String cl : ClusterBrowser.HB_CLASSES) {
                final List<ResourceAgent> services = getAddServiceList(cl);
                if (services.size() == 0) {
                    /* no services, don't show */
                    continue;
                }
                final JCheckBox colocationWi = new JCheckBox("Colo", true);
                final JCheckBox orderWi = new JCheckBox("Order", true);
                colocationWi.setBackground(ClusterBrowser.STATUS_BACKGROUND);
                colocationWi.setPreferredSize(colocationWi.getMinimumSize());
                orderWi.setBackground(ClusterBrowser.STATUS_BACKGROUND);
                orderWi.setPreferredSize(orderWi.getMinimumSize());
                final JPanel colOrdPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
                colOrdPanel.setBackground(ClusterBrowser.STATUS_BACKGROUND);
                colOrdPanel.add(colocationWi);
                colOrdPanel.add(orderWi);
                boolean mode = !AccessMode.ADVANCED;
                if (ResourceAgent.UPSTART_CLASS.equals(cl) || ResourceAgent.SYSTEMD_CLASS.equals(cl)) {
                    mode = AccessMode.ADVANCED;
                }
                if (ResourceAgent.LSB_CLASS.equals(cl)
                        && !getAddServiceList(ResourceAgent.SERVICE_CLASS).isEmpty()) {
                    mode = AccessMode.ADVANCED;
                }
                final MyMenu classItem = new MyMenu(ClusterBrowser.getClassMenu(cl),
                        new AccessMode(ConfigData.AccessType.ADMIN, mode),
                        new AccessMode(ConfigData.AccessType.OP, mode));
                final MyListModel<MyMenuItem> dlm = new MyListModel<MyMenuItem>();
                for (final ResourceAgent ra : services) {
                    try {
                        SwingUtilities.invokeAndWait(new Runnable() {
                            @Override
                            public void run() {
                                addResourceAgentMenu(ra, dlm, pos, popups, colocationWi, orderWi, testOnly);
                            }
                        });
                    } catch (final InterruptedException ix) {
                        Thread.currentThread().interrupt();
                    } catch (final InvocationTargetException x) {
                        Tools.printStackTrace();
                    }
                }
                try {
                    SwingUtilities.invokeAndWait(new Runnable() {
                        @Override
                        public void run() {
                            final boolean ret = Tools.getScrollingMenu(ClusterBrowser.getClassMenu(cl),
                                    colOrdPanel, classItem, dlm, new MyList<MyMenuItem>(dlm, getBackground()),
                                    thisClass, popups, null);
                            if (!ret) {
                                classItem.setEnabled(false);
                            }
                            thisMenu.add(classItem);
                        }
                    });
                } catch (final InterruptedException ix) {
                    Thread.currentThread().interrupt();
                } catch (final InvocationTargetException x) {
                    Tools.printStackTrace();
                }
            }
            super.update();
        }
    };
}

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

/**
 * Cria os componentes/*w  w w. j  a  v a 2  s .  c o m*/
 * 
 */
private void initComponentsEscalavel() {
    TradSimuladorNavegacao.carregaTexto(TokenLang.LANG);
    JPanel regraFonteBtn = new JPanel();
    regraFonteBtn.setLayout(new BorderLayout());

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

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

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

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

    pnBotoes = new JPanel();

    buscar = new JButton();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        pnListaErros.setBorder(criaBorda(TradSimuladorNavegacao.LINKS_INTERNOS));
        pnListaErros.setLayout(new BorderLayout());
        // ======== scrollPanetabLinCod ========
        {
            scrollPanetabLinCod.setViewportView(tabelaDescricao);
        }
        pnListaErros.add(scrollPanetabLinCod, BorderLayout.CENTER);
    }
    // ======== pnBotoes ========
    {

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

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

        // ---- aplicarRotulo ----

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

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

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

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

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

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

    textoErrosBtn.add(pnListaErros, BorderLayout.CENTER);
    JPanel pnSalvarCancelar = new JPanel();
    pnSalvarCancelar.setLayout(null);
    pnSalvarCancelar.setPreferredSize(new Dimension(600, 35));

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

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

    this.setVisible(true);

}

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

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

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

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

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

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

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

    pnBotoes = new JPanel();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        // ---- aplicarRotulo ----

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

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

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

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

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

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

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

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

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

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

}

From source file: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  v  a2  s.  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: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 ww  w.  j a  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);

}

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();/*from  www. j a va 2s  .c  om*/

    //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: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();//from   w w w  . j ava 2 s  .co m
    new OnChange(textAreaSourceCode, this);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        }
    });

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

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

    pnSetaDescricao.setLayout(layout);
    cons.anchor = GridBagConstraints.SOUTHEAST;
    cons.insets = new Insets(0, 0, 0, 10);
    conteudoDoAlt.addKeyListener(new KeyListener() {
        public void keyPressed(KeyEvent arg0) {
        }

        public void keyTyped(KeyEvent arg0) {
        }

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

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

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

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

    // pnRegra.add(lbRegras1);

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

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

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

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

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

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

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

                aplicarRotuloActionPerformed(e);
            }
        });

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

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

    JSplitPane splitPane = null;

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

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

    // regraFonteBtn.add(scrollPaneCorrecaoLabel, BorderLayout.CENTER);
    regraFonteBtn.add(splitPane, BorderLayout.CENTER);
    pnBotoes.setPreferredSize(new Dimension(600, 35));
    pnBotoes.setBackground(CoresDefault.getCorPaineis());
    // regraFonteBtn.add(pnBotoes, BorderLayout.SOUTH);
    regraFonteBtn.setBackground(CoresDefault.getCorPaineis());
    contentPane.add(regraFonteBtn);

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

    textoErrosBtn.add(pnListaErros, BorderLayout.CENTER);
    JPanel pnSalvarCancelar = new JPanel();
    pnSalvarCancelar.setLayout(null);
    pnSalvarCancelar.setPreferredSize(new Dimension(600, 35));
    pnSalvarCancelar.add(salvar);
    pnSalvarCancelar.add(abrir);
    pnSalvarCancelar.add(cancelar);
    if (!original) {
        reverter = new JButton("Reverter");
        reverter.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                setVisible(false);
                TxtBuffer.setContent(TxtBuffer.getContentOriginal());
                parentFrame.showPainelFerramentaImgPArq(TxtBuffer.getContentOriginal(), enderecoPagina);
                setVisible(true);
            }
        });
        //reverter.setActionCommand("Reverter");
        reverter.setText(TradPainelRelatorio.REVERTER);
        reverter.setToolTipText(TradPainelRelatorio.DICA_REVERTER);
        reverter.getAccessibleContext().setAccessibleDescription(TradPainelRelatorio.DICA_REVERTER);
        reverter.getAccessibleContext().setAccessibleName(TradPainelRelatorio.DICA_REVERTER);
        if (EstadoSilvinha.conteudoEmPainelResumo) {
            reverter.setBounds(640, 0, 150, 25);
        } else {
            reverter.setBounds(480, 0, 150, 25);
        }
        pnSalvarCancelar.add(reverter);
    }

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

    this.setVisible(true);

}