have a little question concerning image icons in java and how to put a restriction on what image icon can be choosen from a drop down menu in my swing application.
I am developing a multi platform java program and for the life of cant work out how to restrict the icon you may select from a drop down menu according to the operatin system in use.
For eg. If I select a linux icon on say a Windows based PC the user should get a litte message saying this is not linux but windows select again.
My code so far works in that it will load the icon no errors etc
private String img[] = {
"default.png",
"window.png",
"linix.png",
"macos.png",
"solaris.png"};
private ImgIcon[] icon = {
new ImageIcon(getClass().getResource(img[0])),
new ImageIcon(getClass().getResource(img[1])),
new ImageIcon(getClass().getResource(img[2])),
new ImageIcon(getClass().getResource(img[3])),
new ImageIcon(getClass().getResource(img[4]))};
private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt)
{
if (IsWin()) {
jTextArea1.setText("Detected OS : " + os);
}
else if (IsMac()) {
jTextArea1.setText("Detected OS : " + os);
}
else if (IsLin()) {
jTextArea1.setText("Detected OS : " + os);
}
else if(IsSol()) {
jTextArea1.setText("\Detected OS : " + os);
}
}

So far so good it works when you select the icon it displays and you get a little message in the JTextArea telling you what your Operating system is…just need to somehow alert the user they have choosen the wrong operating system icon if they are on another operating system!
Any suggestions would be appreciated!
You can get a more complete list of those values here
Seems to me that your combobox is unnecessary if you don’t want the user to select the wrong value and you know which OS you are on.