Get imports for program
Hi All,
My goal is know how are "imports"
at the top of a program discovered/obtained?
I can create a doc folder with my IDE.
TIA
bH
Given this demo program with no imports:
/**
*This class demonstrates how to load an Image from
* an external file
*/
@SuppressWarnings("serial")
public class LoadImageApp extends Component {
BufferedImage img;
public void paint(Graphics g) {
g.drawImage(img, 0, 0, null);
}
public LoadImageApp() {
try {
img = ImageIO.read(new File(
"image/GridImage.jpg"));
} catch (IOException e) {
}
}
public Dimension getPreferredSize() {
if (img == null) {
return new Dimension(100,100);
} else {
return new Dimension(img.getWidth(null),
img.getHeight(null));
}
}
public static void main(String[] args) {
JFrame f = new JFrame("Load Image Sample");
f.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
f.add(new LoadImageApp());
f.pack();
f.setVisible(true);
}
}