1. Put image as
Icon / ImageIcon
to the JLabel
then- If
PreferedSize
is lower thanMaximumSize
size then callJFrame#pack()
- otherwise have to call
setSize()
2.Put image as
Icon / ImageIcon
by using Custom Painting
to theJComponent
, JPanel
, JLabel
e.i. then- then this
JComponen
t must to returnsPreferredSize
a) callJFrame#pack()
ifPreferedSize
is lower thanMaximumSize
,b) otherwise have to callJFrame#setSize()
c) by assume that you don't useImage#getScalledInstance
3.Use
Icon
in the JLabel
, there is only one issue that image can be smaller then expected size on the screen, but no issue with that, is pretty possible to centering image to the JLabel.CENTER
to the JLabel
No comments:
Post a Comment