public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column ) { String sText = (String)value; this.isSelected=isSelected; this.hasFocus=hasFocus; try{ File tmpfile = new File(sText); tmpfile.createNewFile(); icon = FileSystemView.getFileSystemView().getSystemIcon(tmpfile); tmpfile.delete(); setIcon(icon); }catch(IOException e){ System.out.println ("ups når vi prøvede at få en icon eller et eller andet"); } setText( sText ); return this; }
// This is a hack to paint the background. Normally a JLabel can // paint its own background, but due to an apparent bug or // limitation in the TreeCellRenderer, the paint method is // required to handle this. public void paint( Graphics g ) { Color bColor;
// Draw a rectangle in the background of the cell g.fillRect( 0, 0, getWidth() - 1, getHeight() - 1 );
super.paint( g ); } }
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.