我编写了一个代码,在选项卡式窗格中显示图像.我的代码看起来像这样
class tracker extends JPanel
{
String imageFile = "areal view.JPG";
public tracker()
{
super();
}
public tracker(String image)
{
super();
this.imageFile = image;
}
public tracker(LayoutManager layout)
{
super(layout);
}
public void paintComponent(Graphics g)
{
/*create image icon to get image*/
ImageIcon imageicon = new ImageIcon(getClass().getResource(imageFile));
Image image = imageicon.getImage();
/*Draw image on the panel*/
super.paintComponent(g);
if (image != null)
g.drawImage(image, 100, 50, 700, 600, this);
//g.drawImage(image, 100, 50, getWidth(), getHeight(), this);
}
}
Run Code Online (Sandbox Code Playgroud)
那么我需要在图像的某个位置放置一个标记..如何在其上放置标记..?
我尝试使用谷歌搜索,但后来才知道它只适用于Android和Web应用程序.这是真的吗?
我不相信它,因为Java做到了所有!!!!! ...
一旦我出现了这个 …