Example usage for java.awt Component setBackground

List of usage examples for java.awt Component setBackground

Introduction

In this page you can find the example usage for java.awt Component setBackground.

Prototype

public void setBackground(Color c) 

Source Link

Document

Sets the background color of this component.

Usage

From source file:org.dwfa.ace.graph.AceGraphRenderer.java

/**
 * Labels the specified vertex with the specified label.
 * Uses the font specified by this instance's
 * <code>VertexFontFunction</code>. (If the font is unspecified, the
 * existing/*from  ww  w  . j  a  va2 s  .  co  m*/
 * font for the graphics context is used.) If vertex label centering
 * is active, the label is centered on the position of the vertex; otherwise
 * the label is offset slightly.
 */
protected void labelVertex(Graphics g, Vertex v, String label, int x, int y) {
    Component component = prepareRenderer(graphLabelRenderer, label, isPicked(v), v);

    Dimension d = component.getPreferredSize();

    int h_offset;
    int v_offset;
    if (centerVertexLabel) {
        h_offset = -d.width / 2;
        v_offset = -d.height / 2;

    } else {
        Rectangle2D bounds = vertexShapeFunction.getShape(v).getBounds2D();
        h_offset = (int) (bounds.getWidth() / 2) + 5;
        v_offset = (int) (bounds.getHeight() / 2) + 5 - d.height;
    }

    component.setBackground(Color.white);
    rendererPane.paintComponent(g, component, screenDevice, x + h_offset, y + v_offset, d.width, d.height,
            true);

}

From source file:nl.detoren.ijsco.ui.Mainscreen.java

public JPanel createDeelnemersPanel() {
    JPanel panel = new JPanel(false);
    panel.setBackground(Color.BLACK);
    //panel.setLayout(new GridLayout(1, 0));
    panel.setLayout(new BorderLayout());
    JPanel innerPanel = new JPanel();
    JLabel lbAanwezig = new JLabel("Deelnemers: ");
    innerPanel.add(lbAanwezig, BorderLayout.NORTH);
    tfAanwezig = new JLabel(Integer.toString(status.deelnemers.aantalAanwezig()), 10);
    innerPanel.add(tfAanwezig, BorderLayout.NORTH);
    //innerPanel.setLayout(new GridLayout(1, 0));
    innerPanel.add(new JLabel("Naam:"), BorderLayout.NORTH);
    JTextField deelnemer = new JTextField(15);
    ArrayList<String> words = new ArrayList<>();
    if (status.OSBOSpelers != null) {
        for (Speler s : status.OSBOSpelers.values()) {
            words.add(s.getNaam().trim());
            words.add(Integer.toString(s.getKnsbnummer()));
        }/* w  w  w  . ja v  a2 s . co m*/
    }
    @SuppressWarnings("unused")
    Suggesties suggesties = new Suggesties(deelnemer, this, words, 2);
    innerPanel.add(deelnemer, BorderLayout.NORTH);
    deelnemer.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            actieVoegSpelerToe(deelnemer.getText().trim());
            deelnemer.setText("");
        }
    });

    JButton btVoegToe = new JButton("Voeg toe");
    btVoegToe.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            actieVoegSpelerToe(deelnemer.getText().trim());
            deelnemer.setText("");
        }
    });
    innerPanel.add(btVoegToe);
    panel.add(innerPanel);
    // panel_deelnemers.add(new JLabel("Deelnemers IJSCO toernooi"));
    deelnemersModel = new DeelnemersModel(panel, status.deelnemers);
    JTable deelnemersTabel = new JTable(deelnemersModel) {
        private static final long serialVersionUID = -8293073016982337108L;

        @Override
        public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
            Component c = super.prepareRenderer(renderer, row, column);
            DeelnemersModel model = (DeelnemersModel) getModel();
            // Tooltip
            if (c instanceof JComponent) {
                ((JComponent) c)
                        .setToolTipText(model.getToolTip(convertRowIndexToModel(row), column).toString());
            }

            // Alternate row color
            if (!isRowSelected(row)) {
                c.setBackground(row % 2 == 0 ? Color.WHITE : Color.LIGHT_GRAY);
            }

            // Highlight overruled entries
            if (status.deelnemers.get(convertRowIndexToModel(row)).isOverruleNaam()
                    || status.deelnemers.get(convertRowIndexToModel(row)).isOverruleNaam()) {
                c.setForeground(Color.BLUE);
            } else {
                c.setForeground(Color.BLACK);
            }
            return c;
        }
    };

    deelnemersTabel.getModel().addTableModelListener(new TableModelListener() {

        @Override
        public void tableChanged(TableModelEvent arg0) {
            status.groepen = null;
            status.schemas = null;
            status.schema = null;
            groepenText.setText("");
            schemaModel.setSchemas(null);
            schemaModel.fireTableDataChanged();
            if (status.deelnemers != null && tfAanwezig != null) {
                tfAanwezig.setText(Integer.toString(status.deelnemers.aantalAanwezig()));
            }
            panel.repaint();
        }

    });

    deelnemersTabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent e) {
            logger.log(Level.INFO, "MouseEvent on table fired, type : " + e.toString());
            logger.log(Level.INFO, "Popup trigger? : " + e.isPopupTrigger());
            if (e.isPopupTrigger()) {
                int row = deelnemersTabel.rowAtPoint(e.getPoint());
                JPopupMenu popup = new JPopupMenu();
                JMenuItem menuItem = new JMenuItem("Bewerk speler");
                menuItem.addActionListener(new ActionListener() {

                    @Override
                    public void actionPerformed(ActionEvent e) {
                        logger.log(Level.INFO,
                                "Bewerk Speler  : " + deelnemersTabel.convertRowIndexToModel(row));
                        Speler s = status.deelnemers.get(deelnemersTabel.convertRowIndexToModel(row));
                        BewerkSpelerDialoog rd = new BewerkSpelerDialoog(new JFrame(), "Bewerk Speler", s,
                                deelnemersModel);
                        rd.addWindowListener(new WindowAdapter() {
                            @Override
                            public void windowClosed(WindowEvent e) {
                                System.out.println("closing...");
                            }

                        });
                        rd.setVisible(true);
                    }

                });
                popup.add(menuItem);

                menuItem = new JMenuItem("Verwijder Speler");
                popup.add(menuItem);
                menuItem.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        logger.log(Level.INFO,
                                "Verwijder Speler  : " + deelnemersTabel.convertRowIndexToModel(row));
                        Speler s = status.deelnemers.get(deelnemersTabel.convertRowIndexToModel(row));
                        status.deelnemers.remove(s);
                        deelnemersModel.fireTableDataChanged();
                    }
                });
                popup.show(e.getComponent(), e.getX(), e.getY());

            }
        }
    });

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setViewportView(deelnemersTabel);
    innerPanel.add(scrollPane, BorderLayout.CENTER);

    TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(deelnemersModel);
    deelnemersTabel.setRowSorter(sorter);

    innerPanel.add(new JLabel("Filter op : "));
    JTextField tfFilter = new JTextField(10);
    tfFilter.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            String text = tfFilter.getText();
            logger.log(Level.INFO, "Filter tabel op : " + text);
            if (text.length() == 0) {
                sorter.setRowFilter(null);
            } else {
                sorter.setRowFilter(RowFilter.regexFilter("(?i)" + text));
            }
        }
    });
    innerPanel.add(tfFilter);
    JButton btPasToe = new JButton("Apply");
    btPasToe.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            String text = tfFilter.getText();
            logger.log(Level.INFO, "Filter tabel op : " + text);
            if (text.length() == 0) {
                sorter.setRowFilter(null);
            } else {
                sorter.setRowFilter(RowFilter.regexFilter("(?i)" + text));
            }
        }
    });
    innerPanel.add(btPasToe);
    JButton btWis = new JButton("Wis");
    btWis.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            tfFilter.setText("");
            logger.log(Level.INFO, "Wis filter");
            sorter.setRowFilter(null);
        }
    });
    innerPanel.add(btWis);

    Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(0), 30);
    Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(1), 55);
    Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(2), 170);
    Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(3), 40);
    Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(4), 40);
    Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(5), 30);
    Utils.fixedComponentSize(scrollPane, 400, 580);
    return panel;
}

From source file:org.tinymediamanager.ui.moviesets.MovieSetTreeCellRenderer.java

@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded,
        boolean leaf, int row, boolean hasFocus) {
    Component returnValue = null;

    // paint movie set node
    if (value != null && value instanceof MovieSetTreeNode) {
        Object userObject = ((MovieSetTreeNode) value).getUserObject();
        if (userObject instanceof MovieSet) {
            MovieSet movieSet = (MovieSet) userObject;

            if (StringUtils.isNotBlank(movieSet.getTitle())) {
                movieSetTitle.setText(movieSet.getTitle());
            } else {
                movieSetTitle.setText(BUNDLE.getString("tmm.unknowntitle")); //$NON-NLS-1$
            }/*w  ww . j  a va2 s .  c o  m*/
            movieSetInfo.setText(movieSet.getMovies().size() + " Movies");
            movieSetImageLabel.setIcon(movieSet.getHasImages() ? IconManager.CHECKMARK : IconManager.CROSS);

            movieSetPanel.setEnabled(tree.isEnabled());
            movieSetPanel.invalidate();
            returnValue = movieSetPanel;
        }
    }

    // paint movie node
    if (value != null && value instanceof MovieTreeNode) {
        Object userObject = ((MovieTreeNode) value).getUserObject();
        if (userObject instanceof Movie) {
            Movie movie = (Movie) userObject;

            if (StringUtils.isNotBlank(movie.getTitle())) {
                movieTitle.setText(movie.getTitle());
            } else {
                movieTitle.setText(BUNDLE.getString("tmm.unknowntitle")); //$NON-NLS-1$
            }
            movieNfoLabel.setIcon(movie.getHasNfoFile() ? IconManager.CHECKMARK : IconManager.CROSS);
            movieImageLabel.setIcon(movie.getHasImages() ? IconManager.CHECKMARK : IconManager.CROSS);

            moviePanel.setEnabled(tree.isEnabled());
            moviePanel.invalidate();
            returnValue = moviePanel;
        }
    }

    if (returnValue == null) {
        returnValue = defaultRenderer.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row,
                hasFocus);
    }

    // paint background
    if (selected) {
        returnValue.setBackground(defaultRenderer.getBackgroundSelectionColor());
    } else {
        returnValue.setBackground(row % 2 == 0 ? EVEN_ROW_COLOR : Color.WHITE);
        // rendererPanel.setBackground(defaultRenderer.getBackgroundNonSelectionColor());
    }

    return returnValue;
}

From source file:com.farouk.projectapp.FirstGUI.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.//from   w  ww.j a  v  a2s  . c  om
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    jTabbedPane1 = new javax.swing.JTabbedPane();
    jPanel5 = new javax.swing.JPanel();
    jPanel6 = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    DefaultTableModel a = new DefaultTableModel();
    jTable2 = new javax.swing.JTable() {
        public boolean isCellEditable(int d, int c) {
            return false;
        }

        @Override
        public Component prepareRenderer(TableCellRenderer renderer, int row, int col) {
            Component comp = super.prepareRenderer(renderer, row, col);
            String value = getModel().getValueAt(row, 0).toString();
            int a = SQLConnect.ifReported(userID, value);
            if (a == 1) {
                comp.setBackground(Color.red);
            } else {
                comp.setBackground(Color.white);
                comp.setForeground(Color.black);
            }

            return comp;
        }
    };
    jButton5 = new javax.swing.JButton();
    jLabel4 = new javax.swing.JLabel();
    jLabel5 = new javax.swing.JLabel();
    jSeparator2 = new javax.swing.JSeparator();
    jButton10 = new javax.swing.JButton();
    jLabel10 = new javax.swing.JLabel();
    jPanel15 = new javax.swing.JPanel();
    jPanel16 = new javax.swing.JPanel();
    jTextField6 = new javax.swing.JTextField();
    jTextField7 = new javax.swing.JTextField();
    jLabel14 = new javax.swing.JLabel();
    jButton13 = new javax.swing.JButton();
    jButton14 = new javax.swing.JButton();
    jButton7 = new javax.swing.JButton();
    jButton3 = new javax.swing.JButton();
    jPanel10 = new javax.swing.JPanel();
    jScrollPane2 = new javax.swing.JScrollPane();
    jEditorPane1 = new javax.swing.JEditorPane();
    jButton15 = new javax.swing.JButton();
    jButton19 = new javax.swing.JButton();
    jTextField4 = new javax.swing.JTextField();
    jPanel1 = new javax.swing.JPanel();
    jPanel2 = new javax.swing.JPanel();
    jTextField1 = new javax.swing.JTextField();
    jPanel3 = new javax.swing.JPanel();
    jButton1 = new javax.swing.JButton();
    jButton2 = new javax.swing.JButton();
    jLabel1 = new javax.swing.JLabel();
    jPanel4 = new javax.swing.JPanel();
    jScrollPane5 = new javax.swing.JScrollPane();
    jTable3 = new javax.swing.JTable() {
        public boolean isCellEditable(int d, int c) {
            return false;
        }
    };
    jButton6 = new javax.swing.JButton();
    jLabel2 = new javax.swing.JLabel();
    jSeparator1 = new javax.swing.JSeparator();
    jPanel8 = new javax.swing.JPanel();
    jScrollPane3 = new javax.swing.JScrollPane();
    DefaultListModel modelCompaniesName = new DefaultListModel();
    try {
        for (String p : SQLConnect.getAllCompaniesNames()) {
            modelCompaniesName.addElement(p);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    jList1 = new javax.swing.JList();
    jLabel3 = new javax.swing.JLabel();
    jButton4 = new javax.swing.JButton();
    jButton9 = new javax.swing.JButton();
    jLabel9 = new javax.swing.JLabel();
    jLabel8 = new javax.swing.JLabel();
    jButton8 = new javax.swing.JButton();
    jPanel7 = new javax.swing.JPanel();
    jTextField2 = new javax.swing.JTextField();
    jPasswordField1 = new javax.swing.JPasswordField();
    jButton11 = new javax.swing.JButton();
    jButton12 = new javax.swing.JButton();
    jPanel9 = new javax.swing.JPanel();
    jLabel11 = new javax.swing.JLabel();
    jButton17 = new javax.swing.JButton();
    jLabel12 = new javax.swing.JLabel();
    jButton18 = new javax.swing.JButton();
    jTextField3 = new javax.swing.JTextField();
    jLabel15 = new javax.swing.JLabel();
    jLabel6 = new javax.swing.JLabel();
    jLabel7 = new javax.swing.JLabel();
    jMenuBar1 = new javax.swing.JMenuBar();
    jMenu1 = new javax.swing.JMenu();
    jMenuItem1 = new javax.swing.JMenuItem();
    jMenu2 = new javax.swing.JMenu();
    jMenuItem2 = new javax.swing.JMenuItem();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

    jTabbedPane1.setToolTipText("");
    jTabbedPane1.setMinimumSize(new java.awt.Dimension(150, 200));
    jTabbedPane1.setPreferredSize(new java.awt.Dimension(200, 200));

    jScrollPane1.setViewportView(jTable2);
    jTable2.setModel(a);
    try {
        UpdatejTable2();
    } catch (Exception e) {
        e.printStackTrace();
    }
    jTable2.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            jTable2MouseClicked(evt);
        }
    });
    jTable2.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyReleased(java.awt.event.KeyEvent evt) {
            jTable2KeyReleased(evt);
        }
    });
    jScrollPane1.setViewportView(jTable2);

    jButton5.setText("Refresh My Portfolio");
    jButton5.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton5ActionPerformed(evt);
        }
    });

    jLabel4.setText("   Last Refreshed : ");

    jButton10.setText("Refresh Company");
    jButton10.setVisible(false);
    jButton10.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton10ActionPerformed(evt);
        }
    });

    jLabel10.setText("Total is : " + String.valueOf(total.doubleValue()) + "");

    jTextField6.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jTextField6ActionPerformed(evt);
        }
    });
    jTextField6.setVisible(false);

    jTextField7.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jTextField7ActionPerformed(evt);
        }
    });

    jLabel14.setText("N of Actions");

    javax.swing.GroupLayout jPanel16Layout = new javax.swing.GroupLayout(jPanel16);
    jPanel16.setLayout(jPanel16Layout);
    jPanel16Layout.setHorizontalGroup(jPanel16Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel16Layout.createSequentialGroup()
                    .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel16Layout.createSequentialGroup()
                                    .addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, 42,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(34, 34, 34).addComponent(jTextField6,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 10,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jLabel14))
                    .addGap(0, 3, Short.MAX_VALUE)));
    jPanel16Layout.setVerticalGroup(jPanel16Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel16Layout.createSequentialGroup()
                    .addComponent(jLabel14)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 30,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, 30,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(13, 13, 13)));

    jButton13.setText("Buy");
    jButton13.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton13ActionPerformed(evt);
        }
    });

    jButton14.setText("Sell");
    jButton14.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton14ActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout jPanel15Layout = new javax.swing.GroupLayout(jPanel15);
    jPanel15.setLayout(jPanel15Layout);
    jPanel15Layout
            .setHorizontalGroup(
                    jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel15Layout.createSequentialGroup().addComponent(jButton13)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jButton14).addGap(166, 166, 166))
                            .addGroup(jPanel15Layout.createSequentialGroup()
                                    .addComponent(jPanel16, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    jPanel15Layout
            .setVerticalGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel15Layout.createSequentialGroup()
                            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel16, javax.swing.GroupLayout.PREFERRED_SIZE, 58,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(jPanel15Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jButton14).addComponent(jButton13))));

    jButton7.setText("Get News !");
    jButton7.setVisible(false);
    jButton7.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton7ActionPerformed(evt);
        }
    });

    jButton3.setText("Report");
    jButton3.setVisible(false);
    jButton3.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton3ActionPerformed(evt);
        }
    });

    jPanel10.setVisible(false);

    jScrollPane2.setViewportView(jEditorPane1);

    javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
    jPanel10.setLayout(jPanel10Layout);
    jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                    jPanel10Layout.createSequentialGroup().addGap(39, 39, 39).addComponent(jScrollPane2,
                            javax.swing.GroupLayout.DEFAULT_SIZE, 423, Short.MAX_VALUE)));
    jPanel10Layout.setVerticalGroup(jPanel10Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel10Layout
                    .createSequentialGroup().addContainerGap().addComponent(jScrollPane2).addContainerGap()));

    jButton15.setText("Automate");
    jButton15.setVisible(false);
    jButton15.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton15ActionPerformed(evt);
        }
    });

    jButton19.setText("Alert");
    jButton19.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton19ActionPerformed(evt);
        }
    });

    jTextField4.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jTextField4ActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
    jPanel6.setLayout(jPanel6Layout);
    jPanel6Layout.setHorizontalGroup(jPanel6Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup().addContainerGap().addGroup(jPanel6Layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jScrollPane1)
                    .addGroup(jPanel6Layout.createSequentialGroup().addGroup(jPanel6Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jPanel15, javax.swing.GroupLayout.PREFERRED_SIZE, 131,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel6Layout.createSequentialGroup().addGroup(jPanel6Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(jButton19, javax.swing.GroupLayout.Alignment.LEADING,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jButton15, javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jButton7, javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(jPanel6Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jButton3).addComponent(jTextField4,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 68,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE))))
                            .addGroup(jPanel6Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel6Layout.createSequentialGroup()
                                            .addPreferredGap(
                                                    javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                            .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addGroup(jPanel6Layout
                                                    .createParallelGroup(
                                                            javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                                            jPanel6Layout.createSequentialGroup()
                                                                    .addGroup(jPanel6Layout.createParallelGroup(
                                                                            javax.swing.GroupLayout.Alignment.TRAILING)
                                                                            .addComponent(jLabel10)
                                                                            .addComponent(jButton10))
                                                                    .addPreferredGap(
                                                                            javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                                    .addGroup(jPanel6Layout.createParallelGroup(
                                                                            javax.swing.GroupLayout.Alignment.LEADING)
                                                                            .addComponent(jButton5)
                                                                            .addComponent(jLabel4)))
                                                    .addComponent(jLabel5,
                                                            javax.swing.GroupLayout.Alignment.TRAILING,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE, 157,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE)))
                                    .addGroup(jPanel6Layout.createSequentialGroup().addGap(70, 70, 70)
                                            .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    419, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(0, 0, Short.MAX_VALUE)))))
                    .addContainerGap()));

    jPanel6Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
            new java.awt.Component[] { jButton3, jTextField4 });

    jPanel6Layout.setVerticalGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup().addContainerGap()
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 249,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel6Layout.createSequentialGroup().addComponent(jButton7)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(jPanel6Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(jButton15).addComponent(jButton3))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(jPanel6Layout
                                            .createParallelGroup(
                                                    javax.swing.GroupLayout.Alignment.LEADING, false)
                                            .addComponent(jButton19)
                                            .addGroup(jPanel6Layout.createSequentialGroup().addGap(1, 1, 1)
                                                    .addComponent(jTextField4)))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jPanel15, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(9, 9, 9))
                            .addGroup(jPanel6Layout.createSequentialGroup()
                                    .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(jPanel6Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addGroup(jPanel6Layout.createSequentialGroup()
                                                    .addGroup(jPanel6Layout
                                                            .createParallelGroup(
                                                                    javax.swing.GroupLayout.Alignment.BASELINE)
                                                            .addComponent(jButton5).addComponent(jButton10))
                                                    .addPreferredGap(
                                                            javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                    .addGroup(jPanel6Layout
                                                            .createParallelGroup(
                                                                    javax.swing.GroupLayout.Alignment.BASELINE)
                                                            .addComponent(jLabel4).addComponent(jLabel10))
                                                    .addPreferredGap(
                                                            javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                    .addComponent(jLabel5,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE, 24,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addGap(0, 0, Short.MAX_VALUE)))
                                    .addContainerGap()))));

    javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
    jPanel5.setLayout(jPanel5Layout);
    jPanel5Layout.setHorizontalGroup(jPanel5Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup().addContainerGap().addComponent(jPanel6,
                    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addContainerGap()));
    jPanel5Layout.setVerticalGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup().addContainerGap().addComponent(jPanel6,
                    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addContainerGap()));

    jTabbedPane1.addTab("    My Portfolio    ", jPanel5);

    jTextField1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
    jTextField1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jTextField1ActionPerformed(evt);
        }
    });

    jButton1.setText("Search");
    jButton1.setAlignmentY(0.3F);
    jButton1.setAutoscrolls(true);
    jButton1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton1ActionPerformed(evt);
        }
    });

    jButton2.setText("Clear");
    jButton2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton2ActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
    jPanel3.setLayout(jPanel3Layout);
    jPanel3Layout.setHorizontalGroup(jPanel3Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup().addGap(2, 2, 2)
                    .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 82,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18).addComponent(jButton2)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jButton2))
                    .addContainerGap()));

    javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout.setHorizontalGroup(jPanel2Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap()
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 145,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 24, Short.MAX_VALUE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(51, 51, 51)));
    jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jTextField1).addComponent(jPanel3,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE))
                    .addContainerGap()));

    jLabel1.setText("Name of Company to look for : ");

    jTable3.setModel(a);
    jScrollPane5.setViewportView(jTable3);
    jScrollPane5.setVisible(false);

    jButton6.setText("Refresh Company");
    jButton6.setVisible(false);
    jButton6.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton6ActionPerformed(evt);
        }
    });

    jLabel2.setText(null);
    jLabel2.setVisible(false);

    javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
    jPanel4.setLayout(jPanel4Layout);
    jPanel4Layout.setHorizontalGroup(jPanel4Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup().addContainerGap().addGroup(jPanel4Layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jScrollPane5)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                            jPanel4Layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE)
                                    .addGroup(jPanel4Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel2).addComponent(jButton6))))
                    .addContainerGap()));
    jPanel4Layout.setVerticalGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                    jPanel4Layout.createSequentialGroup().addGap(5, 5, 5).addComponent(jButton6)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jLabel2)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 39,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(19, 19, 19)));

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(jPanel1Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap().addComponent(jPanel4,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                            Short.MAX_VALUE))
                    .addGroup(jPanel1Layout.createSequentialGroup().addGap(82, 82, 82)
                            .addGroup(jPanel1Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel1).addComponent(jSeparator1,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 598,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(0, 236, Short.MAX_VALUE)))
                    .addContainerGap()));
    jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup().addGap(36, 36, 36).addComponent(jLabel1)
                    .addGap(18, 18, 18)
                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18)
                    .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 16,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18)
                    .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(210, Short.MAX_VALUE)));

    jTabbedPane1.addTab("    Search    ", jPanel1);

    jList1.setModel(modelCompaniesName);
    jList1.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            jList1MouseClicked(evt);
        }
    });
    jScrollPane3.setViewportView(jList1);

    jLabel3.setText("  List of Companies (NASDAQ)");

    javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
    jPanel8.setLayout(jPanel8Layout);
    jPanel8Layout
            .setHorizontalGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                    .addGroup(jPanel8Layout.createSequentialGroup().addComponent(jLabel3).addGap(0, 50,
                            Short.MAX_VALUE)));
    jPanel8Layout.setVerticalGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                    jPanel8Layout.createSequentialGroup().addGap(5, 5, 5).addComponent(jLabel3)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(
                                    jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 613, Short.MAX_VALUE)));

    jButton4.setText("Refresh All");
    jButton4.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton4ActionPerformed(evt);
        }
    });

    jButton9.setVisible(false);
    jButton9.setText("Quit");
    jButton9.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton9ActionPerformed(evt);
        }
    });

    jLabel9.setText("All prices are in .");

    jLabel8.setVisible(false);

    jButton8.setText("Stop");
    jButton8.setVisible(false);

    jTextField2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jTextField2ActionPerformed(evt);
        }
    });

    jPasswordField1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jPasswordField1ActionPerformed(evt);
        }
    });

    jButton11.setText("Log in");
    jButton11.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton11ActionPerformed(evt);
        }
    });

    jButton12.setText("Create account");
    jButton12.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton12ActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
    jPanel7.setLayout(jPanel7Layout);
    jPanel7Layout
            .setHorizontalGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 150,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, 138,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addGroup(jPanel7Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jButton11, javax.swing.GroupLayout.PREFERRED_SIZE, 97,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jButton12, javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addContainerGap()));

    jPanel7Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
            new java.awt.Component[] { jPasswordField1, jTextField2 });

    jPanel7Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
            new java.awt.Component[] { jButton11, jButton12 });

    jPanel7Layout.setVerticalGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup().addContainerGap()
                    .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 29,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, 30,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jButton11))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jButton12).addContainerGap()));

    jPanel7Layout.linkSize(javax.swing.SwingConstants.VERTICAL,
            new java.awt.Component[] { jPasswordField1, jTextField2 });

    jLabel11.setFont(new java.awt.Font("Tahoma", 0, 17)); // NOI18N

    jButton17.setText("Log out");
    jButton17.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton17ActionPerformed(evt);
        }
    });

    jButton18.setText("Change Limit");
    jButton18.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton18ActionPerformed(evt);
        }
    });

    jTextField3.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jTextField3ActionPerformed(evt);
        }
    });

    jPanel9.setVisible(false);

    javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
    jPanel9.setLayout(jPanel9Layout);
    jPanel9Layout.setHorizontalGroup(jPanel9Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
                    .addContainerGap(18, Short.MAX_VALUE)
                    .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel9Layout.createSequentialGroup()
                                    .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 39,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(jButton18))
                            .addGroup(jPanel9Layout.createSequentialGroup()
                                    .addGroup(jPanel9Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                                    jPanel9Layout.createSequentialGroup().addComponent(jLabel11)
                                                            .addGap(30, 30, 30))
                                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                                    jPanel9Layout.createSequentialGroup().addComponent(jLabel12)
                                                            .addGap(18, 18, 18)))
                                    .addComponent(jButton17)))
                    .addGap(36, 36, 36)));
    jPanel9Layout.setVerticalGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup().addContainerGap()
                    .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel9Layout.createSequentialGroup().addComponent(jLabel11)
                                    .addGap(18, 18, 18).addComponent(jLabel12))
                            .addComponent(jButton17))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(
                            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jButton18).addGroup(jPanel9Layout.createSequentialGroup()
                                            .addGap(1, 1, 1).addComponent(jTextField3)))
                    .addContainerGap()));

    jLabel6.setVisible(false);

    jMenu1.setText("File");

    jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q,
            java.awt.event.InputEvent.CTRL_MASK));
    jMenuItem1.setText("Quit");
    jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem1ActionPerformed(evt);
        }
    });
    jMenu1.add(jMenuItem1);

    jMenuBar1.add(jMenu1);

    jMenu2.setText("Help");

    jMenuItem2.setText("About");
    jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem2ActionPerformed(evt);
        }
    });
    jMenu2.add(jMenuItem2);

    jMenuBar1.add(jMenu2);

    setJMenuBar(jMenuBar1);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup().addComponent(jButton4)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jButton8)))
                    .addGap(18, 18, 18)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup().addGroup(layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE)
                                            .addComponent(jLabel6)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(jLabel8).addGap(85, 85, 85).addComponent(jLabel7)
                                            .addGap(77, 77, 77).addComponent(jButton9))
                                    .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 931,
                                            Short.MAX_VALUE)
                                    .addGroup(layout.createSequentialGroup().addComponent(jLabel9)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(53, 53, 53).addComponent(jPanel7,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)))
                                    .addGap(18, 18, 18))
                            .addGroup(layout.createSequentialGroup().addComponent(jLabel15)
                                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                    layout.createSequentialGroup()
                            .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jButton9).addComponent(jButton4).addComponent(jLabel8)
                                    .addComponent(jButton8).addComponent(jLabel6).addComponent(jLabel7))
                            .addContainerGap())
            .addGroup(layout.createSequentialGroup().addGap(16, 16, 16).addGroup(layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup().addGap(68, 68, 68)
                                            .addComponent(jLabel9))
                                    .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 515,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel15)
                    .addGap(0, 0, Short.MAX_VALUE)));

    jTabbedPane1.getAccessibleContext().setAccessibleName("");

    pack();
}

From source file:forge.toolbox.FSkin.java

public static void setTempBackground(final Component comp, final SkinColor skinColor) {
    comp.setBackground(skinColor.color);
}

From source file:semaforo.Semaforo.java

public Component getTableCellRendererComponentCell(JTable table, Color color, Object value, boolean isSelected,
        boolean hasFocus, int row, int column) {
    Component cellComponent = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row,
            column);/*from w ww .  j av a  2s  .  com*/

    cellComponent.setBackground(color);
    cellComponent.setForeground(color);

    return cellComponent;
}

From source file:org.tinymediamanager.ui.tvshows.TvShowTreeCellRenderer.java

@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded,
        boolean leaf, int row, boolean hasFocus) {
    Component returnValue = null;
    // paint tv show node
    if (value != null && value instanceof TvShowTreeNode) {
        Object userObject = ((TvShowTreeNode) value).getUserObject();
        if (userObject instanceof TvShow) {
            TvShow tvShow = (TvShow) userObject;

            if (StringUtils.isBlank(tvShow.getYear()) || "0".equals(tvShow.getYear())) {
                tvShowTitle.setText(tvShow.getTitleSortable());
            } else {
                tvShowTitle.setText(tvShow.getTitleSortable() + " (" + tvShow.getYear() + ")");
            }/*  w w  w  .  java 2  s.  c o m*/
            if (StringUtils.isBlank(tvShowTitle.getText())) {
                tvShowTitle.setText(BUNDLE.getString("tmm.unknowntitle")); //$NON-NLS-1$
            }

            if (tvShow.isNewlyAdded() || tvShow.hasNewlyAddedEpisodes()) {
                tvShowTitle.setIcon(IconManager.NEW);
            } else {
                tvShowTitle.setIcon(null);
            }

            tvShowInfo.setText(tvShow.getSeasons().size() + " " + BUNDLE.getString("metatag.seasons") + " - " //$NON-NLS-1$
                    + tvShow.getEpisodes().size() + " " + BUNDLE.getString("metatag.episodes"));
            tvShowNfoLabel.setIcon(tvShow.getHasNfoFile() ? IconManager.CHECKMARK : IconManager.CROSS);
            tvShowImageLabel.setIcon(tvShow.getHasImages() ? IconManager.CHECKMARK : IconManager.CROSS);

            tvShowPanel.setEnabled(tree.isEnabled());
            tvShowPanel.invalidate();
            returnValue = tvShowPanel;
        }
    }

    // paint tv show season node
    if (value != null && value instanceof TvShowSeasonTreeNode) {
        Object userObject = ((TvShowSeasonTreeNode) value).getUserObject();
        if (userObject instanceof TvShowSeason) {
            TvShowSeason season = (TvShowSeason) userObject;
            tvShowSeasonTitle.setText(BUNDLE.getString("metatag.season") + " " + season.getSeason());//$NON-NLS-1$
            tvShowSeasonPanel.setEnabled(tree.isEnabled());

            if (season.isNewlyAdded()) {
                tvShowSeasonTitle.setIcon(IconManager.NEW);
            } else {
                tvShowSeasonTitle.setIcon(null);
            }

            tvShowSeasonPanel.invalidate();
            returnValue = tvShowSeasonPanel;
        }
    }

    // paint tv show episode node
    if (value != null && value instanceof TvShowEpisodeTreeNode) {
        Object userObject = ((TvShowEpisodeTreeNode) value).getUserObject();
        if (userObject instanceof TvShowEpisode) {
            TvShowEpisode episode = (TvShowEpisode) userObject;
            if (episode.getEpisode() > 0) {
                tvShowEpisodeTitle.setText(episode.getEpisode() + ". " + episode.getTitle());
            } else {
                tvShowEpisodeTitle.setText(episode.getTitle());
            }
            if (StringUtils.isBlank(tvShowTitle.getText())) {
                tvShowEpisodeTitle.setText(BUNDLE.getString("tmm.unknowntitle")); //$NON-NLS-1$
            }

            if (episode.isNewlyAdded()) {
                tvShowEpisodeTitle.setIcon(IconManager.NEW);
            } else {
                tvShowEpisodeTitle.setIcon(null);
            }

            tvShowEpisodePanel.setEnabled(tree.isEnabled());

            tvShowEpisodeNfoLabel.setIcon(episode.getHasNfoFile() ? IconManager.CHECKMARK : IconManager.CROSS);
            tvShowEpisodeImageLabel.setIcon(episode.getHasImages() ? IconManager.CHECKMARK : IconManager.CROSS);
            tvShowEpisodeSubtitleLabel
                    .setIcon(episode.hasSubtitles() ? IconManager.CHECKMARK : IconManager.CROSS);

            tvShowEpisodePanel.invalidate();
            returnValue = tvShowEpisodePanel;
        }
    }

    if (returnValue == null) {
        returnValue = defaultRenderer.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row,
                hasFocus);
    }

    // paint background
    if (selected) {
        returnValue.setBackground(defaultRenderer.getBackgroundSelectionColor());
    } else {
        returnValue.setBackground(row % 2 == 0 ? EVEN_ROW_COLOR : Color.WHITE);
        // rendererPanel.setBackground(defaultRenderer.getBackgroundNonSelectionColor());
    }

    return returnValue;
}

From source file:self.philbrown.javaQuery.$.java

/**
 * Animate multiple view properties at the same time. Example:
 * <pre>/*from  www  .j a  v a2 s  . c  om*/
 * $.with(myView).animate(new QuickMap(QuickEntry.qe("alpha", .8f), QuickEntry.qe("width", 50%)), 400, Easing.LINEAR, null);
 * </pre>
 * @param properties mapping of property names and final values to animate
 * @param options the options for setting the duration, easing, etc of the animation
 * @return this
 */
public $ animate(Map<String, Object> properties, final AnimationOptions options) {
    List<Animator> animations = new ArrayList<Animator>();
    for (Entry<String, Object> entry : properties.entrySet()) {
        final String key = entry.getKey();
        //Java sometimes will interpret these Strings as Numbers, so some trickery is needed below
        Object value = entry.getValue();

        for (final Component view : this.views) {
            Animator anim = null;
            if (value instanceof String)
                value = getAnimationValue(view, key, (String) value);
            //final Object fValue = value;
            if (value != null) {
                //special color cases
                if (key.equals("alpha") || key.equals("red") || key.equals("green") || key.equals("blue")) {
                    if (key.equals("alpha") && view instanceof JComponent) {
                        ((JComponent) view).setOpaque(false);
                    }
                    try {
                        final Method getComponent = Color.class
                                .getMethod(Log.buildString("get", capitalize(key)));
                        final int colorComponent = (Integer) getComponent.invoke(view.getBackground());
                        final ColorHelper color = new ColorHelper(view.getBackground());
                        final Method setComponent = ColorHelper.class.getMethod(
                                Log.buildString("set", capitalize(key)), new Class<?>[] { int.class });
                        anim = new Animator();

                        //if integer - assume 0-255
                        if (value instanceof Integer || is(value, int.class)) {
                            anim.addTarget(PropertySetter.getTarget(color, key, colorComponent,
                                    Integer.parseInt(value.toString())));
                        }
                        //if float - assume 0.0-1.0
                        else if (value instanceof Float || is(value, float.class)) {
                            anim.addTarget(PropertySetter.getTarget(color, key, colorComponent,
                                    (int) (255 * Float.parseFloat(value.toString()))));
                        }
                        anim.addTarget(new TimingTargetAdapter() {

                            @Override
                            public void timingEvent(Animator source, double fraction) {
                                double d = source.getInterpolator().interpolate(fraction);
                                try {
                                    setComponent.invoke(color, (int) d);
                                    view.setBackground(color.getColor());
                                    //                              if (view instanceof JComponent)
                                    //                                 ((JComponent) view).revalidate();
                                    view.repaint();
                                } catch (Throwable t) {
                                    if (options.debug())
                                        t.printStackTrace();
                                }
                            }
                        });
                    } catch (Throwable t) {
                        if (options.debug())
                            t.printStackTrace();
                    }

                } else {
                    final Rectangle params = view.getBounds();
                    try {
                        final Field field = params.getClass().getField(key);
                        if (field != null) {
                            anim = new Animator();
                            anim.addTarget(PropertySetter.getTarget(params, key, field.get(params), value));

                            anim.addTarget(new TimingTargetAdapter() {

                                @Override
                                public void timingEvent(Animator source, double fraction) {
                                    Rectangle bounds = view.getBounds();
                                    double d = source.getInterpolator().interpolate(fraction);
                                    try {
                                        field.set(bounds, d);
                                    } catch (Throwable t) {
                                        if (options.debug())
                                            t.printStackTrace();
                                    }
                                    view.setBounds(bounds);
                                    view.repaint();
                                    if (options.progress() != null) {
                                        options.progress().invoke($.with(view), key, d,
                                                source.getDuration() - source.getTotalElapsedTime());
                                    }
                                }

                            });
                        }

                    } catch (Throwable t) {

                        if (options.debug())
                            Log.w("$", String.format(Locale.US, "%s is not a LayoutParams attribute.", key));
                    }

                    if (anim == null) {
                        anim = new Animator();
                        Object first;
                        try {
                            final Method getter = view.getClass()
                                    .getMethod(Log.buildString("get", capitalize(key)));
                            first = getter.invoke(view);
                        } catch (Throwable t) {
                            first = 0;
                        }

                        anim.addTarget(PropertySetter.getTarget(view, key, first, value));

                        if (options.progress() != null) {
                            anim.addTarget(new TimingTargetAdapter() {

                                @Override
                                public void timingEvent(Animator source, double fraction) {
                                    double d = source.getInterpolator().interpolate(fraction);
                                    if (options.progress() != null) {
                                        options.progress().invoke($.with(view), key, d,
                                                source.getDuration() - source.getTotalElapsedTime());
                                    }
                                }

                            });
                        }
                    }
                }

                if (options.repeatCount() >= 1)
                    anim.setRepeatCount(options.repeatCount());
                if (options.reverse())
                    anim.setRepeatBehavior(Animator.RepeatBehavior.REVERSE);
                animations.add(anim);
            }

        }
    }
    AnimatorSet animation = animationWithOptions(options, animations);
    animation.start();

    return this;
}

From source file:es.emergya.ui.plugins.AdminPanel.java

/**
 * //w  w  w.  ja v  a2s .  com
 * @param columnNames
 *            nombres de las columnas de la tabla
 * @param filterOptions
 *            lista de opciones de un combobox. Si esta vacio entonces es un
 *            textfield
 * @param noFiltrarAction
 * @param filtrarAction
 */
public void generateTable(String[] columnNames, Object[][] filterOptions,
        AdminPanel.NoFiltrarAction noFiltrarAction, AdminPanel.FiltrarAction filtrarAction) {

    if (columnNames == null) {
        columnNames = new String[] {};
    }
    if (filterOptions == null) {
        filterOptions = new Object[][] {};
    }

    String filterString = "[";
    for (Object[] o : filterOptions) {
        filterString += Arrays.toString(o) + " ";
    }
    filterString += "]";

    log.debug("generateTable( columnNames = " + Arrays.toString(columnNames) + ", filterOptions = "
            + filterString + ")");

    tablePanel.removeAll();
    int columnNamesLength = columnNames.length;
    if (!getCanDelete())
        columnNamesLength++;
    MyTableModel dataModel = new MyTableModel(1, columnNamesLength + 2) {

        private static final long serialVersionUID = 1348355328684460769L;

        @Override
        public boolean isCellEditable(int row, int column) {
            return column != 0 && !invisibleFilterCols.contains(column);
        }
    };
    filters = new JTable(dataModel) {

        private static final long serialVersionUID = -8266991359840905405L;

        @Override
        public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
            Component c = super.prepareRenderer(renderer, row, column);

            if (isCellEditable(row, column) && column != getColumnCount() - 1) {
                if (c instanceof JTextField) {
                    ((JTextField) c).setBorder(new MatteBorder(1, 1, 1, 1, Color.BLACK));
                } else if (c instanceof JComboBox) {
                    ((JComboBox) c).setBorder(new MatteBorder(1, 1, 1, 1, Color.BLACK));
                } else if (c instanceof JLabel) {
                    ((JLabel) c).setBorder(new MatteBorder(1, 1, 1, 1, Color.BLACK));
                }
            }
            return c;
        }
    };
    filters.setSurrendersFocusOnKeystroke(true);
    filters.setShowGrid(false);
    filters.setRowHeight(22);
    filters.setOpaque(false);

    for (Integer i = 0; i < filterOptions.length; i++) {
        final Object[] items = filterOptions[i];
        if (items != null && items.length > 1) {
            setComboBoxEditor(i, items);
        } else {
            final DefaultCellEditor defaultCellEditor = new DefaultCellEditor(new JTextField());
            defaultCellEditor.setClickCountToStart(1);
            filters.getColumnModel().getColumn(i + 1).setCellEditor(defaultCellEditor);
        }
    }

    filters.setRowSelectionAllowed(false);
    filters.setDragEnabled(false);
    filters.setColumnSelectionAllowed(false);
    filters.setDefaultEditor(JButton.class, new JButtonCellEditor());

    filters.setDefaultRenderer(Object.class, new DefaultTableRenderer() {
        private static final long serialVersionUID = -4811729559786534118L;

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
            if (invisibleFilterCols.contains(column))
                c = new JLabel("");
            return c;
        }

    });

    filters.setDefaultRenderer(JButton.class, new TableCellRenderer() {

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            JButton b = (JButton) value;
            b.setBorderPainted(false);
            b.setContentAreaFilled(false);
            return b;
        }
    });
    filters.setDefaultRenderer(JLabel.class, new TableCellRenderer() {

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            return (JLabel) value;
        }
    });
    filters.setDefaultEditor(JButton.class, new JButtonCellEditor());
    filters.getModel().setValueAt(new JLabel(""), 0, 0);
    JButton jButton2 = new JButton(noFiltrarAction);
    JButton jButton = new JButton(filtrarAction);
    jButton.setBorderPainted(false);
    jButton2.setBorderPainted(false);
    jButton.setContentAreaFilled(false);
    jButton2.setContentAreaFilled(false);
    if (jButton.getIcon() != null)
        jButton.setPreferredSize(
                new Dimension(jButton.getIcon().getIconWidth(), jButton.getIcon().getIconHeight()));
    if (jButton2.getIcon() != null)
        jButton2.setPreferredSize(
                new Dimension(jButton2.getIcon().getIconWidth(), jButton2.getIcon().getIconHeight()));

    filters.getModel().setValueAt(jButton, 0, columnNamesLength - 1);
    filters.getColumnModel().getColumn(columnNamesLength - 1).setMinWidth(jButton.getWidth() + 24);
    filters.getModel().setValueAt(jButton2, 0, columnNamesLength);
    filters.getColumnModel().getColumn(columnNamesLength).setMinWidth(jButton2.getWidth() + 14);
    cuenta.setHorizontalAlignment(JLabel.CENTER);
    cuenta.setText("?/?");
    filters.getModel().setValueAt(cuenta, 0, columnNamesLength + 1);

    tablePanel.add(filters, BorderLayout.NORTH);

    Vector<String> headers = new Vector<String>();
    headers.add("");
    headers.addAll(Arrays.asList(columnNames));
    MyTableModel model = new MyTableModel(headers, 0);
    table = new JTable(model) {

        private static final long serialVersionUID = 949284378605881770L;
        private int highLightedRow = -1;
        private Rectangle dirtyRegion = null;

        public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
            Component c = super.prepareRenderer(renderer, row, column);
            try {
                if (AdminPanel.this.myRendererColoring != null)
                    c.setBackground(AdminPanel.this.myRendererColoring
                            .getColor(AdminPanel.this.table.getValueAt(row, 1)));
            } catch (Throwable t) {
                log.error("Error al colorear la celda: " + t);
            }
            return c;
        }

        @Override
        protected void processMouseMotionEvent(MouseEvent e) {
            try {
                int row = rowAtPoint(e.getPoint());
                Graphics g = getGraphics();
                if (row == -1) {
                    highLightedRow = -1;
                }

                // row changed
                if (highLightedRow != row) {
                    if (null != dirtyRegion) {
                        paintImmediately(dirtyRegion);
                    }
                    for (int j = 0; j < getRowCount(); j++) {
                        if (row == j) {
                            // highlight
                            Rectangle firstRowRect = getCellRect(row, 0, false);
                            Rectangle lastRowRect = getCellRect(row, getColumnCount() - 1, false);
                            dirtyRegion = firstRowRect.union(lastRowRect);
                            g.setColor(new Color(0xff, 0xff, 0, 100));
                            g.fillRect((int) dirtyRegion.getX(), (int) dirtyRegion.getY(),
                                    (int) dirtyRegion.getWidth(), (int) dirtyRegion.getHeight());
                            highLightedRow = row;
                        }

                    }
                }
            } catch (Exception ex) {
            }
            super.processMouseMotionEvent(e);
        }
    };

    table.setRowHeight(22);

    table.setOpaque(false);
    // table.setAutoCreateRowSorter(true);

    table.setDragEnabled(false);
    table.getTableHeader().setReorderingAllowed(false);
    table.getTableHeader().setResizingAllowed(false);

    table.setDefaultEditor(JButton.class, new JButtonCellEditor());
    table.setDefaultRenderer(JButton.class, new TableCellRenderer() {

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            JButton b = (JButton) value;
            if (b != null) {
                b.setBorderPainted(false);
                b.setContentAreaFilled(false);
            }
            return b;
        }
    });

    JScrollPane jScrollPane = new JScrollPane(table);
    jScrollPane.setOpaque(false);
    jScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    jScrollPane.getViewport().setOpaque(false);
    tablePanel.add(jScrollPane, BorderLayout.CENTER);
}