|
JList and a bad programming example
The image file names are stored in the ARRAY img[i].names (or what should I call it else, Sukatoa?). Since I cannot get img.names into JList I did the following:
String[] help = new String[numberpic];
for (int i = 0; i < numberpic; i++)
help[i] = img[i].name;
Piclist = new JList(help);
….. etc
And, funny enough, all picture names now appear in the list.
Of course Hardwired this is a good example of bad java programming!
But it works (I wonder what you have to say to it)!
And I still do not know why java does not allow me to do the most simple and obvious thing, which is:
Piclist = new JList(img.name);
(Sukatoa, I am looking into this model thing of PList and I might need some time to understand its concept).
Saludos willemjav
By the way,
window.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
is the default code to close a gui application.
What would be the way to terminate an application according the following condition:
if (path == null)
….??? Code that exits application
else
…..
|