After
I am trying to remove a Edit: I already have full permission to use ShellFolder Update:. You should be told that code work I already have it. I have already started to change '/' with >>, but I do not understand that it is still saying this error. To work well, given that This seems to allow the execution of private package here is an example that works on JDK 6 :. ArrayList icon images from a folder , but I The time is coming from a NullPointerException I can already extract smaller versions, but they are very small. The icons I am trying to achieve are regular icons of size, the
file path icon keeps a list of locations. .
iconBIG.add (...) is the place where
NullPointerException is pointing to error
// Global Private ArrayList & Lt; Symbols & gt; IconBIG = New Arrestist & lt; Symbols & gt; (); // Extract sign () ... within (string target: file path) {try {shellfolder shell = ShellFolder.getShellFolder (new file (target)); IconBIG.add (New ImageIcon (shell.getIcon (true)); } Hold (FileNotFoundException e) {e.printStackTrace (); }}
new file (target) (which only holds complete paths of applications), if I change
getShellFolder (new file (target )
getShellFolder (new file (c: /foo/bar.lnk) ,
import java.awt .event.ActionEvent; import java.awt.event.ActionListener; Import java.io.FileNotFoundException; import javax.swing * ;. import sun.awt.shell.ShellFolder; public square ShowShellIcon {private static void createAndShowUI () {final JFrame frame = new Jefrem ( "load Image"); frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); Jebton Load Button = New Pocket ("Display Image"); loadButton.addActionListener (new ActionListener () {@Override public void actionPerformed (ActionEvent e) {JFileChooser fc = new JFileChooser (System.getProperty ( "user.home")); if (fc.showOpenDialog (zero) == JFileChooser.APPROVE_OPTION ) {try {ShellFolder shell = ShellFolder.getShellFolder (FC .getSelectedFile ()); JOptionPane.showMessageDialog (zero, new ImageIcon (shell.getIcon (right)));} catch (FileNotFoundException ex) {ex.printStackTrace ();} }}}); Frame.add (loadButton); Frame.pack (); Frame.setLocationByPlatform (true); Frame.setVisible (true); } Public static void (String [] args) {SwingUtilities.invokeLater (new Runnable () {public void run () {try {UIManager.setLookAndFeel (UIManager.getSystemLookAndFeelClassName ());} catch (Exception ex) {ex.printStackTrace ( );} Create and showIi ();}}}}}}
No comments:
Post a Comment