また、Netbeansを使用してJPanelにImageを配置するにはどうすればよいですか?
60849 次
4 に答える
7
このチュートリアルをご覧ください: Java GUI アプリケーションでの画像の処理
同時に、次のようにコーディングすることもできます。
JPanel panel = new JPanel();
ImageIcon icon = new ImageIcon("image.jpg");
JLabel label = new JLabel();
label.setIcon(icon);
panel.add(label);
于 2011-03-13T04:56:16.080 に答える
3
ImageIcon と JLabel を使用できます。
ImageIcon icon = createImageIcon("image.gif", "sample image");
// Label with text and icon
JLabel label1 = new JLabel("Image and Text", icon, JLabel.CENTER);
// Label with icon only
JLabel label2 = new JLabel(icon);
// Add to your JPanel
panel.add(label1);
panel.add(label2);
于 2011-03-13T04:53:50.157 に答える
2
1) 最初に画像をアプリケーション フォルダに貼り付けます 2) パネルにラベルを追加します 3) ラベルを右クリック -> プロパティ 4) アイコンを選択 -> その他のオプション 5) パッケージとファイルを選択して [OK] をクリックします 6) 完了 :)
于 2013-09-01T15:23:57.560 に答える
1
icon プロパティを画像に設定して JLabel を設定する必要があります。特定の問題に対するより詳細な解決策については、次の Web サイトにアクセスしてください。
http://www.netbeanstutorials.com/p/handling-images.html
あなたがそれを必要とする場合に備えて、そこにそれを行う方法のビデオさえあります.
于 2012-02-03T00:50:40.893 に答える