import javax.swing. * ؛
import java.awt.*;
class صورة تمتد JFrame {
الفراغ العام الثابت الرئيسي (سلسلة [] args) يلقي استثناء {
JFrame.setDefaultLookAndFeelDecorated(true);
إطار JFrame = JFrame جديد ();
String src = Image.class.getClassLoader().
getSystemResource("image.jpg").toString();
frame.getContentPane().add(new JEditorPane("text/html",
" < IMG src = '"+ SRC +"' العرض = 280 الارتفاع = 400> "));
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack ();
frame.setVisible (صحيح) ؛
}
}
< / pre> الإخراج:
Java
Commentaires (12)
Connectez-vous pour commenter
Rejoignez la discussion et partagez vos connaissances avec la communauté
Excellent tutoriel !
N'hésitez pas si vous avez des questions.