Mouad
Mouad

Reputation: 25

put a picture in the background of a JScrollPane and JTable

I want to use an image background in JScrollPane but the space I want to deal with the image is not available. it isn't a JScrollPane either a JTable, I used the red and blue colors in the image : enter link description here

http://www.4shared.com/download/YDzZc6EQ/test3.jpg?tsid=20130606-152249-f0c2375e

jTableUtilisateur.setBackground(Color.BLUE);
        jTableUtilisateur.setModel(new DefaultTableModel(data, header)
                {
                    boolean[] canEdit = new boolean [] {
                        false, false, false, false, false, false, false, false, false, false, false, false
                    };

                    public boolean isCellEditable(int rowIndex, int columnIndex) {
                        return canEdit [columnIndex];
                    }
                });
        jTableUtilisateur.setFont(new Font("Century Gothic", 0, 12));
        jTableUtilisateur.setForeground(new Color(0, 75, 138));
        jTableUtilisateur.setAutoCreateRowSorter(true);

        jScrollPaneUtilisateur = new JScrollPane(jTableUtilisateur);
        jScrollPaneUtilisateur.setBackground(Color.red);
        jScrollPaneUtilisateur.setBorder( new TitledBorder("Utilisateurs") );

Upvotes: 0

Views: 123

Answers (1)

mKorbel
mKorbel

Reputation: 109813

you can depends of requirement, (each of ways has different usages)

Upvotes: 1

Related Questions