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:org.forester.archaeopteryx.ControlPanel.java

private void addSequenceRelationBlock() {
    final JLabel spacer = new JLabel("");
    spacer.setSize(1, 1);//from   w w  w.j a v  a 2 s  . co m
    add(spacer);
    final JLabel mainLabel = new JLabel("Sequence relations to display");
    final JLabel typeLabel = customizeLabel(new JLabel("(type) "), getConfiguration());
    typeLabel.setFont(ControlPanel.js_font.deriveFont(7));
    getSequenceRelationTypeBox().setFocusable(false);
    _sequence_relation_type_box.setFont(ControlPanel.js_font);
    if (!_configuration.isUseNativeUI()) {
        _sequence_relation_type_box.setBackground(Constants.BUTTON_BACKGROUND_COLOR_DEFAULT);
        _sequence_relation_type_box.setForeground(Constants.BUTTON_TEXT_COLOR_DEFAULT);
    }
    _sequence_relation_type_box.setRenderer(new ListCellRenderer() {

        @Override
        public Component getListCellRendererComponent(final JList list, final Object value, final int index,
                final boolean isSelected, final boolean cellHasFocus) {
            final Component component = new DefaultListCellRenderer().getListCellRendererComponent(list, value,
                    index, isSelected, cellHasFocus);
            if ((value != null) && (value instanceof SequenceRelation.SEQUENCE_RELATION_TYPE)) {
                ((DefaultListCellRenderer) component).setText(SequenceRelation
                        .getPrintableNameByType((SequenceRelation.SEQUENCE_RELATION_TYPE) value));
            }
            return component;
        }
    });
    final GridBagLayout gbl = new GridBagLayout();
    _sequence_relation_type_box.setMinimumSize(new Dimension(115, 17));
    _sequence_relation_type_box.setPreferredSize(new Dimension(115, 20));
    final JPanel horizGrid = new JPanel(gbl);
    horizGrid.setBackground(getBackground());
    horizGrid.add(typeLabel);
    horizGrid.add(_sequence_relation_type_box);
    add(customizeLabel(mainLabel, getConfiguration()));
    add(horizGrid);
    add(getSequenceRelationBox());
    if (_configuration.doDisplayOption(Configuration.show_relation_confidence)) {
        addCheckbox(Configuration.show_relation_confidence,
                _configuration.getDisplayTitle(Configuration.show_relation_confidence));
        setCheckbox(Configuration.show_relation_confidence,
                _configuration.doCheckOption(Configuration.show_relation_confidence));
    }
}

From source file:Clavis.Windows.WShedule.java

public synchronized void create() {
    initComponents();/* www. j  a v a 2s .com*/
    this.setModal(true);
    this.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            close();
        }
    });
    this.setTitle(lingua.translate("Registos de emprstimo para o recurso") + ": "
            + lingua.translate(mat.getTypeOfMaterialName()).toLowerCase() + " "
            + lingua.translate(mat.getDescription()));
    KeyQuest.addtoPropertyListener(jPanelInicial, true);
    String dat = new TimeDate.Date().toString();
    String[] auxiliar = prefs.get("datainicio", dat).split("/");
    if (auxiliar[0].length() > 1) {
        if (auxiliar[0].charAt(0) == '0') {
            auxiliar[0] = auxiliar[0].replaceFirst("0", "");
        }
    }
    if (auxiliar[1].length() > 1) {
        if (auxiliar[1].charAt(0) == '0') {
            auxiliar[1] = auxiliar[1].replaceFirst("0", "");
        }
    }
    if (auxiliar[2].length() > 1) {
        if (auxiliar[2].charAt(0) == '0') {
            auxiliar[2] = auxiliar[2].replaceFirst("0", "");
        }
    }
    inicio = new TimeDate.Date(Integer.valueOf(auxiliar[0]), Integer.valueOf(auxiliar[1]),
            Integer.valueOf(auxiliar[2]));
    auxiliar = prefs.get("datafim", dat).split("/");
    if (auxiliar[0].length() > 1) {
        if (auxiliar[0].charAt(0) == '0') {
            auxiliar[0] = auxiliar[0].replaceFirst("0", "");
        }
    }
    if (auxiliar[1].length() > 1) {
        if (auxiliar[1].charAt(0) == '0') {
            auxiliar[1] = auxiliar[1].replaceFirst("0", "");
        }
    }
    if (auxiliar[2].length() > 1) {
        if (auxiliar[2].charAt(0) == '0') {
            auxiliar[2] = auxiliar[2].replaceFirst("0", "");
        }
    }
    fim = new TimeDate.Date(Integer.valueOf(auxiliar[0]), Integer.valueOf(auxiliar[1]),
            Integer.valueOf(auxiliar[2]));

    SimpleDateFormat sdf = new SimpleDateFormat("dd/M/yyyy");
    Date date;
    try {
        date = sdf.parse(fim.toString());
    } catch (ParseException ex) {
        date = new Date();

    }
    jXDatePickerFim.setDate(date);
    try {
        date = sdf.parse(inicio.toString());
    } catch (ParseException ex) {
        date = new Date();
    }
    jXDatePickerInicio.setDate(date);
    andamento = 0;
    if (DataBase.DataBase.testConnection(url)) {
        DataBase.DataBase db = new DataBase.DataBase(url);
        java.util.List<Keys.Request> requisicoes = Clavis.RequestList
                .simplifyRequests(db.getRequestsByMaterialByDateInterval(mat, inicio, fim));
        db.close();
        estado = lingua.translate("Todos");
        DefaultTableModel modelo = (DefaultTableModel) jTable1.getModel();
        if (requisicoes.size() > 0) {
            valores = new String[requisicoes.size()][4];
            lista = new java.util.ArrayList<>();
            requisicoes.stream().map((req) -> {
                if (mat.getMaterialTypeID() == 1) {
                    valores[andamento][0] = req.getPerson().getName();
                    valores[andamento][1] = req.getTimeBegin().toString(0) + " - "
                            + req.getTimeEnd().toString(0);
                    valores[andamento][2] = req.getBeginDate().toString();
                    String[] multipla = req.getActivity().split(":::");
                    if (multipla.length > 1) {
                        Components.PopUpMenu pop = new Components.PopUpMenu(multipla, lingua);
                        pop.create();
                        jTable1.addMouseListener(new MouseAdapter() {
                            int x = andamento;
                            int y = 3;

                            @Override
                            public void mousePressed(MouseEvent e) {
                                if (e.getButton() == MouseEvent.BUTTON1) {
                                    int row = jTable1.rowAtPoint(e.getPoint());
                                    int col = jTable1.columnAtPoint(e.getPoint());
                                    if ((row == x) && (col == y)) {
                                        pop.show(e.getComponent(), e.getX(), e.getY());
                                    }
                                }
                            }

                            @Override
                            public void mouseReleased(MouseEvent e) {
                                if (e.getButton() == MouseEvent.BUTTON1) {
                                    if (pop.isShowing()) {
                                        pop.setVisible(false);
                                    }
                                }
                            }
                        });
                        valores[andamento][3] = lingua.translate(multipla[0]) + "";
                    } else {
                        valores[andamento][3] = lingua.translate(req.getActivity());
                    }
                    if (valores[andamento][3].equals("")) {
                        valores[andamento][3] = lingua.translate("Sem descrio");
                    }
                    Object[] ob = { req.getPerson().getName(),
                            req.getTimeBegin().toString(0) + " - " + req.getTimeEnd().toString(0),
                            req.getBeginDate().toString(), valores[andamento][3], req.getSubject().getName() };
                    modelo.addRow(ob);
                } else {
                    valores[andamento][0] = req.getPerson().getName();
                    valores[andamento][1] = req.getBeginDate().toString();
                    valores[andamento][2] = req.getEndDate().toString();
                    String[] multipla = req.getActivity().split(":::");
                    if (multipla.length > 1) {
                        Components.PopUpMenu pop = new Components.PopUpMenu(multipla, lingua);
                        pop.create();
                        jTable1.addMouseListener(new MouseAdapter() {
                            int x = andamento;
                            int y = 3;

                            @Override
                            public void mousePressed(MouseEvent e) {
                                if (e.getButton() == MouseEvent.BUTTON1) {
                                    int row = jTable1.rowAtPoint(e.getPoint());
                                    int col = jTable1.columnAtPoint(e.getPoint());
                                    if ((row == x) && (col == y)) {
                                        pop.show(e.getComponent(), e.getX(), e.getY());
                                    }
                                }
                            }

                            @Override
                            public void mouseReleased(MouseEvent e) {
                                if (e.getButton() == MouseEvent.BUTTON1) {
                                    if (pop.isShowing()) {
                                        pop.setVisible(false);
                                    }
                                }
                            }
                        });
                        valores[andamento][3] = multipla[0];
                    } else {
                        valores[andamento][3] = lingua.translate(req.getActivity());
                    }
                    if (valores[andamento][3].equals("")) {
                        valores[andamento][3] = lingua.translate("Sem descrio");
                    }
                    Object[] ob = { req.getPerson().getName(), req.getBeginDate().toString(),
                            req.getEndDate().toString(), valores[andamento][3] };
                    modelo.addRow(ob);
                }
                return req;
            }).map((req) -> {
                lista.add(req);
                return req;
            }).forEach((_item) -> {
                andamento++;
            });
        }
    }
    jComboBoxEstado.setSelectedIndex(prefs.getInt("comboboxvalue", 0));
    String[] opcoes = { lingua.translate("Ver detalhes da requisio"),
            lingua.translate("Ver requisices com a mesma data"),
            lingua.translate("Ver requisices com o mesmo estado") };
    ActionListener[] eventos = new ActionListener[opcoes.length];
    eventos[0] = (ActionEvent r) -> {
        Border border = BorderFactory.createCompoundBorder(
                BorderFactory.createCompoundBorder(new org.jdesktop.swingx.border.DropShadowBorder(Color.BLACK,
                        3, 0.5f, 6, false, false, true, true), BorderFactory.createLineBorder(Color.BLACK, 1)),
                BorderFactory.createEmptyBorder(0, 10, 0, 10));
        int val = jTable1.getSelectedRow();
        Keys.Request req = lista.get(val);
        javax.swing.JPanel pan = new javax.swing.JPanel(null);
        pan.setPreferredSize(new Dimension(500, 300));
        pan.setBounds(0, 20, 500, 400);
        pan.setBackground(Components.MessagePane.BACKGROUND_COLOR);
        javax.swing.JLabel lrecurso1 = new javax.swing.JLabel(lingua.translate("Recurso") + ": ");
        lrecurso1.setBounds(10, 20, 120, 26);
        lrecurso1.setFocusable(true);
        lrecurso1.setHorizontalAlignment(javax.swing.JLabel.LEFT);
        pan.add(lrecurso1);
        javax.swing.JLabel lrecurso11 = new javax.swing.JLabel(
                lingua.translate(req.getMaterial().getTypeOfMaterialName()) + " "
                        + lingua.translate(req.getMaterial().getDescription()));
        lrecurso11.setBounds(140, 20, 330, 26);
        lrecurso11.setBorder(border);
        pan.add(lrecurso11);
        javax.swing.JLabel lrecurso2 = new javax.swing.JLabel(lingua.translate("Utilizador") + ": ");
        lrecurso2.setBounds(10, 50, 120, 26);
        lrecurso2.setFocusable(true);
        lrecurso2.setHorizontalAlignment(javax.swing.JLabel.LEFT);
        pan.add(lrecurso2);
        javax.swing.JLabel lrecurso22 = new javax.swing.JLabel(req.getPerson().getName());
        lrecurso22.setBounds(140, 50, 330, 26);
        lrecurso22.setBorder(border);
        pan.add(lrecurso22);
        javax.swing.JLabel lrecurso3 = new javax.swing.JLabel(lingua.translate("Data inicial") + ": ");
        lrecurso3.setBounds(10, 80, 120, 26);
        lrecurso3.setFocusable(true);
        lrecurso3.setHorizontalAlignment(javax.swing.JLabel.LEFT);
        pan.add(lrecurso3);
        javax.swing.JLabel lrecurso33 = new javax.swing.JLabel(
                req.getBeginDate().toStringWithMonthWord(lingua));
        lrecurso33.setBounds(140, 80, 330, 26);
        lrecurso33.setBorder(border);
        pan.add(lrecurso33);
        javax.swing.JLabel lrecurso4 = new javax.swing.JLabel(lingua.translate("Data final") + ": ");
        lrecurso4.setBounds(10, 110, 120, 26);
        lrecurso4.setFocusable(true);
        lrecurso4.setHorizontalAlignment(javax.swing.JLabel.LEFT);
        pan.add(lrecurso4);
        javax.swing.JLabel lrecurso44 = new javax.swing.JLabel(req.getEndDate().toStringWithMonthWord(lingua));
        lrecurso44.setBounds(140, 110, 330, 26);
        lrecurso44.setBorder(border);
        pan.add(lrecurso44);

        javax.swing.JLabel lrecurso5 = new javax.swing.JLabel(lingua.translate("Atividade") + ": ");
        lrecurso5.setBounds(10, 140, 120, 26);
        lrecurso5.setFocusable(true);
        lrecurso5.setHorizontalAlignment(javax.swing.JLabel.LEFT);
        pan.add(lrecurso5);
        javax.swing.JLabel lrecurso55;
        if (req.getActivity().equals("")) {
            lrecurso55 = new javax.swing.JLabel(lingua.translate("Sem descrio"));
        } else {
            String[] saux = req.getActivity().split(":::");
            String atividade;
            boolean situacao = false;
            if (saux.length > 1) {
                situacao = true;
                atividade = saux[0];
            } else {
                atividade = req.getActivity();
            }
            if (req.getSubject().getId() > 0) {
                lrecurso55 = new javax.swing.JLabel(
                        lingua.translate(atividade) + ": " + req.getSubject().getName());
            } else {
                lrecurso55 = new javax.swing.JLabel(lingua.translate(atividade));
            }
            if (situacao) {
                Components.PopUpMenu pop = new Components.PopUpMenu(saux, lingua);
                pop.create();
                lrecurso55.addMouseListener(new MouseAdapter() {

                    @Override
                    public void mouseEntered(MouseEvent e) {
                        pop.show(e.getComponent(), e.getX(), e.getY());
                    }

                    @Override
                    public void mouseExited(MouseEvent e) {
                        pop.setVisible(false);
                    }

                });
            }
        }
        lrecurso55.setBounds(140, 140, 330, 26);
        lrecurso55.setBorder(border);
        pan.add(lrecurso55);
        int distancia = 170;
        if (req.getBeginDate().isBigger(req.getEndDate()) == 0) {
            javax.swing.JLabel lrecurso6 = new javax.swing.JLabel(lingua.translate("Horrio") + ": ");
            lrecurso6.setBounds(10, distancia, 120, 26);
            lrecurso6.setFocusable(true);
            lrecurso6.setHorizontalAlignment(javax.swing.JLabel.LEFT);
            pan.add(lrecurso6);
            javax.swing.JLabel lrecurso66 = new javax.swing.JLabel(
                    req.getTimeBegin().toString(0) + " - " + req.getTimeEnd().toString(0));
            lrecurso66.setBounds(140, distancia, 330, 26);
            lrecurso66.setBorder(border);
            pan.add(lrecurso66);
            distancia = 200;
        }
        if (req.getBeginDate().isBigger(req.getEndDate()) == 0) {
            javax.swing.JLabel lrecurso7 = new javax.swing.JLabel(lingua.translate("Dia da semana") + ": ");
            lrecurso7.setBounds(10, distancia, 120, 26);
            lrecurso7.setFocusable(true);
            lrecurso7.setHorizontalAlignment(javax.swing.JLabel.LEFT);
            pan.add(lrecurso7);
            javax.swing.JLabel lrecurso77 = new javax.swing.JLabel(
                    lingua.translate(req.getWeekDay().perDayName()));
            lrecurso77.setBounds(140, distancia, 330, 26);
            lrecurso77.setBorder(border);
            pan.add(lrecurso77);
            if (distancia == 200) {
                distancia = 230;
            } else {
                distancia = 200;
            }
        }
        if (req.isTerminated() || req.isActive()) {
            javax.swing.JLabel lrecurso8 = new javax.swing.JLabel(lingua.translate("Levantamento") + ": ");
            lrecurso8.setBounds(10, distancia, 120, 26);
            lrecurso8.setFocusable(true);
            lrecurso8.setHorizontalAlignment(javax.swing.JLabel.LEFT);
            pan.add(lrecurso8);
            javax.swing.JLabel lrecurso88;
            if ((req.getLiftDate() != null) && (req.getLiftTime() != null)) {
                lrecurso88 = new javax.swing.JLabel(req.getLiftDate().toString() + " " + lingua.translate("s")
                        + " " + req.getLiftTime().toString(0));
            } else {
                lrecurso88 = new javax.swing.JLabel(lingua.translate("sem dados para apresentar"));
            }
            lrecurso88.setBounds(140, distancia, 330, 26);
            lrecurso88.setBorder(border);
            pan.add(lrecurso88);
            switch (distancia) {
            case 200:
                distancia = 230;
                break;
            case 230:
                distancia = 260;
                break;
            default:
                distancia = 200;
                break;
            }
        }
        if (req.isTerminated()) {
            javax.swing.JLabel lrecurso9 = new javax.swing.JLabel(lingua.translate("Entrega") + ": ");
            lrecurso9.setBounds(10, distancia, 120, 26);
            lrecurso9.setFocusable(true);
            lrecurso9.setHorizontalAlignment(javax.swing.JLabel.LEFT);
            pan.add(lrecurso9);
            javax.swing.JLabel lrecurso99;
            if ((req.getDeliveryDate() != null) && (req.getDeliveryTime() != null)) {
                lrecurso99 = new javax.swing.JLabel(req.getDeliveryDate().toString() + " "
                        + lingua.translate("s") + " " + req.getDeliveryTime().toString(0));
            } else {
                lrecurso99 = new javax.swing.JLabel(lingua.translate("sem dados para apresentar"));
            }
            lrecurso99.setBounds(140, distancia, 330, 26);
            lrecurso99.setBorder(border);
            pan.add(lrecurso99);
            switch (distancia) {
            case 200:
                distancia = 230;
                break;
            case 230:
                distancia = 260;
                break;
            case 260:
                distancia = 290;
                break;
            default:
                distancia = 200;
                break;
            }
        }
        Components.MessagePane mensagem = new Components.MessagePane(this, Components.MessagePane.INFORMACAO,
                Clavis.KeyQuest.getSystemColor(), lingua.translate(""), 500, 400, pan, "",
                new String[] { lingua.translate("Voltar") });
        mensagem.showMessage();
    };
    eventos[1] = (ActionEvent r) -> {
        String val = jTable1.getModel().getValueAt(jTable1.getSelectedRow(), 2).toString();
        SimpleDateFormat sdf_auxiliar = new SimpleDateFormat("dd/MM/yyyy");
        Date data_auxiliar;
        try {
            data_auxiliar = sdf_auxiliar.parse(val);
            Calendar cal = Calendar.getInstance();
            cal.setTime(data_auxiliar);
            int dia = cal.get(Calendar.DAY_OF_MONTH);
            int mes = cal.get(Calendar.MONTH) + 1;
            int ano = cal.get(Calendar.YEAR);
            inicio = new TimeDate.Date(dia, mes, ano);
            fim = new TimeDate.Date(dia, mes, ano);
        } catch (ParseException ex) {
            data_auxiliar = new Date();
        }
        jXDatePickerFim.setDate(data_auxiliar);
        jXDatePickerInicio.setDate(data_auxiliar);
        refreshTable(jComboBoxEstado.getSelectedIndex());
    };
    eventos[2] = (ActionEvent r) -> {
        String val = jTable1.getModel().getValueAt(jTable1.getSelectedRow(), 3).toString();
        for (int i = 0; i < jComboBoxEstado.getItemCount(); i++) {
            if (jComboBoxEstado.getItemAt(i).equals(val)) {
                jComboBoxEstado.setSelectedIndex(i);
            }
        }
    };
    KeyStroke[] strokes = new KeyStroke[opcoes.length];
    strokes[0] = KeyStroke.getKeyStroke(KeyEvent.VK_R, Event.CTRL_MASK);
    strokes[1] = KeyStroke.getKeyStroke(KeyEvent.VK_D, Event.CTRL_MASK);
    strokes[2] = KeyStroke.getKeyStroke(KeyEvent.VK_E, Event.CTRL_MASK);
    Components.PopUpMenu pop = new Components.PopUpMenu(opcoes, eventos, strokes);
    pop.create();
    mouseaction = new MouseAdapter() {

        @Override
        public void mousePressed(MouseEvent e) {
            java.awt.Point ponto = new java.awt.Point(e.getX(), e.getY());
            if (jTable1.rowAtPoint(ponto) > -1) {
                jTable1.setRowSelectionInterval(jTable1.rowAtPoint(ponto),
                        jTable1.rowAtPoint(new java.awt.Point(e.getX(), e.getY())));
            }
        }

        @Override
        public void mouseReleased(MouseEvent e) {
            if (e.getButton() == MouseEvent.BUTTON3) {
                if (jTable1.getSelectedRow() >= 0) {
                    java.awt.Point ponto = new java.awt.Point(e.getX(), e.getY());
                    if (jTable1.rowAtPoint(ponto) > -1) {
                        pop.show(e.getComponent(), e.getX(), e.getY());
                    }
                }
            }
        }

    };
    jTable1.addMouseListener(mouseaction);
}

From source file:org.forester.archaeopteryx.ControlPanel.java

void setupSearchTools() {
    final String tip = "Enter text to search for. Use ',' for multiple searches (logical OR) and '+' for logical AND.";
    final JLabel search_label = new JLabel("Search:");
    search_label.setFont(ControlPanel.jcb_bold_font);
    if (!getConfiguration().isUseNativeUI()) {
        search_label.setForeground(ControlPanel.jcb_text_color);
    }/*from   ww w  .  j  av a2s .co  m*/
    add(search_label);
    search_label.setToolTipText(tip);
    _search_found_label = new JLabel();
    getSearchFoundCountsLabel().setVisible(false);
    _search_found_label.setFont(ControlPanel.jcb_bold_font);
    if (!getConfiguration().isUseNativeUI()) {
        _search_found_label.setForeground(ControlPanel.jcb_text_color); //Color of Found: X
    }
    _search_tf = new JTextField(3);
    _search_tf.setToolTipText(tip);
    _search_tf.setEditable(true);
    if (!getConfiguration().isUseNativeUI()) {
        _search_tf.setForeground(Color.GREEN);//ControlPanel.jcb_text_color );
        _search_tf.setBackground(ControlPanel.button_background_color);
        _search_tf.setBorder(null);
    }
    _search_reset_button = new JButton();
    getSearchResetButton().setText("Reset");
    getSearchResetButton().setEnabled(false);
    getSearchResetButton().setVisible(false);
    final JPanel s_panel_1 = new JPanel(new BorderLayout());
    final JPanel s_panel_2 = new JPanel(new GridLayout(1, 2, 0, 0));
    s_panel_1.setBackground(getBackground());
    add(s_panel_1);
    s_panel_2.setBackground(getBackground());
    add(s_panel_2);
    final KeyAdapter key_adapter = new KeyAdapter() {

        @Override
        public void keyReleased(final KeyEvent key_event) {
            search();
            displayedPhylogenyMightHaveChanged(true);
        }
    };
    final ActionListener action_listener = new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            searchReset();
            setSearchFoundCountsOnLabel(0);
            getSearchFoundCountsLabel().setVisible(false);
            getSearchTextField().setText("");
            getSearchResetButton().setEnabled(false);
            getSearchResetButton().setVisible(false);
            displayedPhylogenyMightHaveChanged(true);
        }
    };
    _search_reset_button.addActionListener(action_listener);
    _search_tf.addKeyListener(key_adapter);
    addJTextField(_search_tf, s_panel_1);
    s_panel_2.add(_search_found_label);
    addJButton(_search_reset_button, s_panel_2);
}

From source file:org.forester.archaeopteryx.ControlPanel.java

void setUpControlsForDomainStrucures() {
    _domain_display_label = new JLabel("Domain Display:");
    add(customizeLabel(_domain_display_label, getConfiguration()));
    add(_domain_display_label);/*from   w  w w  . j a  v a2s. co  m*/
    _zoom_in_domain_structure = new JButton("d+");
    _zoom_out_domain_structure = new JButton("d-");
    _decr_domain_structure_evalue_thr = new JButton("-");
    _incr_domain_structure_evalue_thr = new JButton("+");
    _zoom_in_domain_structure.setPreferredSize(new Dimension(10, 10));
    _zoom_out_domain_structure.setPreferredSize(new Dimension(10, 10));
    _decr_domain_structure_evalue_thr.setPreferredSize(new Dimension(10, 10));
    _incr_domain_structure_evalue_thr.setPreferredSize(new Dimension(10, 10));
    _incr_domain_structure_evalue_thr.setToolTipText("Increase the E-value threshold by a factor of 10");
    _decr_domain_structure_evalue_thr.setToolTipText("Decrease the E-value threshold by a factor of 10");
    _domain_structure_evalue_thr_tf = new JTextField(3);
    _domain_structure_evalue_thr_tf.setEditable(false);
    if (!getConfiguration().isUseNativeUI()) {
        _domain_structure_evalue_thr_tf.setForeground(Constants.MENU_BACKGROUND_COLOR_DEFAULT);
        _domain_structure_evalue_thr_tf.setBackground(ControlPanel.jcb_text_color);
        _domain_structure_evalue_thr_tf.setBorder(null);
    }
    final JPanel d1_panel = new JPanel(new GridLayout(1, 2, 0, 0));
    final JPanel d2_panel = new JPanel(new GridLayout(1, 3, 0, 0));
    if (!_configuration.isUseNativeUI()) {
        d1_panel.setBackground(getBackground());
        d2_panel.setBackground(getBackground());
    }
    add(d1_panel);
    add(d2_panel);
    addJButton(_zoom_out_domain_structure, d1_panel);
    addJButton(_zoom_in_domain_structure, d1_panel);
    addJButton(_decr_domain_structure_evalue_thr, d2_panel);
    addJTextField(_domain_structure_evalue_thr_tf, d2_panel);
    addJButton(_incr_domain_structure_evalue_thr, d2_panel);
}

From source file:com.haulmont.cuba.desktop.sys.DesktopWindowManager.java

protected void showNotificationPopup(String popupText, NotificationType type) {
    JPanel panel = new JPanel(new MigLayout("flowy"));
    panel.setBorder(BorderFactory.createLineBorder(Color.gray));

    switch (type) {
    case WARNING:
    case WARNING_HTML:
        panel.setBackground(Color.yellow);
        break;/*from  w  w w  . j ava2s.  com*/
    case ERROR:
    case ERROR_HTML:
        panel.setBackground(Color.orange);
        break;
    default:
        panel.setBackground(Color.cyan);
    }

    JLabel label = new JLabel(popupText);
    panel.add(label);

    Dimension labelSize = DesktopComponentsHelper.measureHtmlText(popupText);

    int x = frame.getX() + frame.getWidth() - (50 + labelSize.getSize().width);
    int y = frame.getY() + frame.getHeight() - (50 + labelSize.getSize().height);

    PopupFactory factory = PopupFactory.getSharedInstance();
    final Popup popup = factory.getPopup(frame, panel, x, y);
    popup.show();

    panel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            popup.hide();
        }
    });

    PointerInfo pointerInfo = MouseInfo.getPointerInfo();
    if (pointerInfo != null) {
        final Point location = pointerInfo.getLocation();
        final Timer timer = new Timer(3000, null);
        timer.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                PointerInfo currentPointer = MouseInfo.getPointerInfo();
                if (currentPointer == null) {
                    timer.stop();
                } else if (!currentPointer.getLocation().equals(location)) {
                    popup.hide();
                    timer.stop();
                }
            }
        });
        timer.start();
    }
}

From source file:org.forester.archaeopteryx.ControlPanel.java

/**
 * Add zoom and quick edit buttons. (Last modified 8/9/04)
 *//* www . j a  v a  2s  . c  om*/
void addButtons() {
    final JLabel spacer = new JLabel("");
    spacer.setOpaque(false);
    add(spacer);
    final JPanel x_panel = new JPanel(new GridLayout(1, 1, 0, 0));
    final JPanel y_panel = new JPanel(new GridLayout(1, 3, 0, 0));
    final JPanel z_panel = new JPanel(new GridLayout(1, 1, 0, 0));
    if (!getConfiguration().isUseNativeUI()) {
        x_panel.setBackground(getBackground());
        y_panel.setBackground(getBackground());
        z_panel.setBackground(getBackground());
    }
    add(_zoom_label = new JLabel("Zoom:"));
    customizeLabel(_zoom_label, getConfiguration());
    add(x_panel);
    add(y_panel);
    add(z_panel);
    if (getConfiguration().isUseNativeUI()) {
        _zoom_in_x = new JButton("+");
        _zoom_out_x = new JButton("-");
    } else {
        _zoom_in_x = new JButton("X+");
        _zoom_out_x = new JButton("X-");
    }
    _zoom_in_y = new JButton("Y+");
    _zoom_out_y = new JButton("Y-");
    _show_whole = new JButton("F");
    _show_whole.setToolTipText("To fit the complete phylogeny to the current display size [Backspace]");
    _zoom_in_x.setToolTipText("To zoom in horizontally [Shift+Right]");
    _zoom_in_y.setToolTipText("To zoom in vertically [Shift+Up]");
    _zoom_out_x.setToolTipText("To zoom out horizontally [Shift+Left]");
    _zoom_out_y.setToolTipText("To zoom out vertically [Shift+Down]");
    if (getConfiguration().isUseNativeUI() && Util.isMac()) {
        _zoom_out_x.setPreferredSize(new Dimension(55, 10));
        _zoom_in_x.setPreferredSize(new Dimension(55, 10));
    } else {
        _zoom_out_x.setPreferredSize(new Dimension(10, 10));
        _zoom_in_x.setPreferredSize(new Dimension(10, 10));
    }
    _zoom_out_y.setPreferredSize(new Dimension(10, 10));
    _zoom_in_y.setPreferredSize(new Dimension(10, 10));
    _show_whole.setPreferredSize(new Dimension(10, 10));
    _return_to_super_tree = new JButton(RETURN_TO_SUPER_TREE_TEXT);
    _return_to_super_tree.setEnabled(false);
    _order = new JButton("Order Subtrees");
    _uncollapse_all = new JButton("Uncollapse All");
    addJButton(_zoom_in_y, x_panel);
    addJButton(_zoom_out_x, y_panel);
    addJButton(_show_whole, y_panel);
    addJButton(_zoom_in_x, y_panel);
    addJButton(_zoom_out_y, z_panel);
    //        if ( getConfiguration().doDisplayOption( Configuration.show_domain_architectures ) ) {
    //            setUpControlsForDomainStrucures();
    //        }
    final JLabel spacer2 = new JLabel("");
    add(spacer2);
    addJButton(_return_to_super_tree, this);
    addJButton(_order, this);
    addJButton(_uncollapse_all, this);
    final JLabel spacer3 = new JLabel("");
    add(spacer3);
    setVisibilityOfDomainStrucureControls();
}

From source file:com.xilinx.virtex7.MainScreen.java

private JPanel testAndStats() {
    JPanel tstats = new JPanel();
    tstats.setLayout(new BoxLayout(tstats, BoxLayout.Y_AXIS));

    JPanel tstats1 = new JPanel();
    tstats1.setLayout(new BoxLayout(tstats1, BoxLayout.Y_AXIS));

    tstats1.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(""),
            BorderFactory.createRaisedBevelBorder()));

    tstats1.add(testPanelItems());//from   w  w w  .  j  a  v a  2 s . c  o  m

    JPanel dmaInner = new JPanel(new BorderLayout());

    JPanel dmaPanel = new JPanel(new BorderLayout());

    dmaPanel.setBackground(new Color(130, 170, 180));
    table1 = new MyTableModel(dummy_data, dmaColumnNames0);
    dmaStats1 = new JTable(table1);
    try {
        dmaStats1.setDefaultRenderer(Object.class, new CustomTableCellRenderer());
    } catch (Exception e) {
    }
    JTableHeader dmaHeader = dmaStats1.getTableHeader();
    dmaHeader.setForeground(new Color(92, 25, 25));

    dmaPanel.add(dmaHeader, BorderLayout.PAGE_START);
    dmaPanel.add(dmaStats1, BorderLayout.CENTER);
    dmaInner.add(dmaPanel, BorderLayout.CENTER);
    tstats1.add(dmaInner);
    tstats.add(tstats1);

    //tstats.add(trnPanel);

    JPanel tstats2 = new JPanel();
    tstats2.setLayout(new BoxLayout(tstats2, BoxLayout.Y_AXIS));
    tstats2.add(testPanelItems1());

    tstats2.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(""),
            BorderFactory.createRaisedBevelBorder()));

    JPanel dmaPanel1 = new JPanel(new BorderLayout());

    table2 = new MyTableModel(dummy_data, dmaColumnNames1);
    dmaStats2 = new JTable(table2);
    try {
        dmaStats2.setDefaultRenderer(Object.class, new CustomTableCellRenderer());
    } catch (Exception e) {
    }
    JTableHeader dmaHeader1 = dmaStats2.getTableHeader();
    dmaHeader1.setForeground(new Color(92, 25, 25));

    dmaPanel1.add(dmaHeader1, BorderLayout.PAGE_START);
    dmaPanel1.add(dmaStats2, BorderLayout.CENTER);
    tstats2.add(dmaPanel1);
    tstats.add(tstats2);

    return tstats;
}

From source file:com.xilinx.virtex7.MainScreen.java

private JPanel testAndStatsSecondTab() {
    JPanel tstats = new JPanel();
    tstats.setLayout(new BoxLayout(tstats, BoxLayout.Y_AXIS));

    JPanel tstats1 = new JPanel();
    tstats1.setLayout(new BoxLayout(tstats1, BoxLayout.Y_AXIS));

    tstats1.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(""),
            BorderFactory.createRaisedBevelBorder()));

    tstats1.add(testPanelItems2());// need to change testPanelItems method.

    JPanel dmaInner = new JPanel(new BorderLayout());

    JPanel dmaPanel = new JPanel(new BorderLayout());

    dmaPanel.setBackground(new Color(130, 170, 180));
    table1T2 = new MyTableModel(dummy_data, dmaColumnNames2);
    dmaStats1T2 = new JTable(table1T2);
    try {/*from  ww  w  .j  a v  a  2 s  .com*/
        dmaStats1T2.setDefaultRenderer(Object.class, new CustomTableCellRenderer());
    } catch (Exception e) {
    }
    JTableHeader dmaHeader = dmaStats1T2.getTableHeader();
    dmaHeader.setForeground(new Color(92, 25, 25));

    dmaPanel.add(dmaHeader, BorderLayout.PAGE_START);
    dmaPanel.add(dmaStats1T2, BorderLayout.CENTER);
    dmaInner.add(dmaPanel, BorderLayout.CENTER);
    tstats1.add(dmaInner);
    tstats.add(tstats1);

    /*JPanel trnPanel = new JPanel(new GridLayout(1,1));
    trnPanel.setBorder(BorderFactory.createCompoundBorder(
                BorderFactory.createTitledBorder("PCIe Statistics"),
                BorderFactory.createRaisedBevelBorder()));
    JPanel trn1 = new JPanel(new FlowLayout());
    trn1.add(new JLabel("Transmit (writes in Gbps): "));
    trnLTXT2 = new JTextField("0.0", 5);
    trnLTXT2.setEditable(false);
    trn1.add(trnLTXT2);
    trn1.add(new JLabel("Receive (reads in Gbps): "));
    trnLRXT2 = new JTextField("0.0", 5);
    trnLRXT2.setEditable(false);
    trn1.add(trnLRXT2);
    trnPanel.add(trn1);
    tstats.add(trnPanel);*/

    JPanel tstats2 = new JPanel();
    tstats2.setLayout(new BoxLayout(tstats2, BoxLayout.Y_AXIS));
    tstats2.add(testPanelItems3());

    tstats2.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(""),
            BorderFactory.createRaisedBevelBorder()));

    JPanel dmaPanel1 = new JPanel(new BorderLayout());

    table2T2 = new MyTableModel(dummy_data, dmaColumnNames3);
    dmaStats2T2 = new JTable(table2T2);
    try {
        dmaStats2T2.setDefaultRenderer(Object.class, new CustomTableCellRenderer());
    } catch (Exception e) {
    }
    JTableHeader dmaHeader1 = dmaStats2T2.getTableHeader();
    dmaHeader1.setForeground(new Color(92, 25, 25));

    dmaPanel1.add(dmaHeader1, BorderLayout.PAGE_START);
    dmaPanel1.add(dmaStats2T2, BorderLayout.CENTER);
    tstats2.add(dmaPanel1);
    tstats.add(tstats2);
    return tstats;
}

From source file:org.forester.archaeopteryx.ControlPanel.java

void addSecondLevelJCheckBox(final JCheckBox jcb, final JPanel p) {
    jcb.setFocusPainted(false);/*from w w w .  j av a2 s.  co  m*/
    jcb.setFont(ControlPanel.jcb_font);
    if (!_configuration.isUseNativeUI()) {
        jcb.setBackground(ControlPanel.jcb_background_color);
        jcb.setForeground(ControlPanel.jcb_text_color);
    }
    Box box = Box.createHorizontalBox();
    p.setBackground(background_color);
    box.add(Box.createRigidArea(new Dimension(12, 0)));
    jcb.setVisible(_color_branches_cb.isSelected());
    box.add(jcb);
    p.add(box, "Center");
    jcb.addActionListener(this);
}

From source file:org.forester.archaeopteryx.ControlPanel.java

void addSecondLevelJCheckBoxWithSlider(final JCheckBox jcb, final JPanel p) {
    jcb.setFocusPainted(false);/*from   ww w.j a  v  a  2 s  .c  o  m*/
    jcb.setFont(ControlPanel.jcb_font);
    if (!_configuration.isUseNativeUI()) {
        jcb.setBackground(ControlPanel.jcb_background_color);
        jcb.setForeground(ControlPanel.jcb_text_color);
    }
    Box box = Box.createHorizontalBox();
    p.setBackground(background_color);
    box.add(Box.createRigidArea(new Dimension(12, 0)));
    jcb.setVisible(_color_branches_cb.isSelected());
    box.add(jcb);
    buildJSlider(60, _slider_min, _slider_max);
    getColorBranchesEdplSlider().setVisible(_color_branches_cb.isSelected());
    getColorBranchesEdplSlider().setEnabled(_color_branches_edpl.isSelected());
    box.add(getColorBranchesEdplSlider());
    p.add(box, "Center");
    jcb.addActionListener(this);
}