![](/img/trans.png)
[英]hello,I would like to move my satellite menu from top right corner to the bottom left corner of the screen
[英]position ImageItem on top right corner of screen
我在將圖像添加到屏幕時遇到問題,我有以下代碼:
try {
Image cima = Image.createImage("/resources/cross.png");
} catch (IOException ex){
System.out.println("ERROR");
}
但是,它總是會引起異常。 我不知道出了什么問題,因為我已經將圖像放入了正確的文件夾中
還可以合並兩個布局設置嗎? 說我想要右上角? 我想結合兩個布局..這可能嗎?
更新:
關於布局,我想做類似的事情:
form.append(new ImageItem("Top Right", cima, ImageItem.LAYOUT_TOP, null));
但這只給了我TOP上的圖像。
該包的名稱不是“ res”,而是“資源”,正如我們從快照中看到的那樣。
Image cima = ImageIO.read(YourClass.class.getResource("/resources/cross.png"));
將捕獲體更改為此:
} catch (IOException ex){
System.out.println("ERROR");
ex.printStackTrace();
}
並告訴我們您有什么例外。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.