public void paint
(Graphics g)
{
if
(views.size==0)
{//mdiFrame是对下述的JMDIFrame类型的对象引用
g.setColor
(mdiFrame.getDesktopBackGround())
;
g.fillRect
(0,0,this.getWidth()
,this.getHeight
())
;
}
else
{
super.paint
(g)
;
}
}
protectedvoidadjustDeskSize()
{
int xMax=0;
int yMax=0;
JScrollPanescrollPane=getScrollPane()
InsetsscrollInsets=getScrollPaneInsets()
;
if
(scrollPane!=null
)
//防止忘记把桌面窗格添加到滚动
窗格中而导致异常
{
//deskPane是对下述JMDIDeskPane类型对象的引用
JInternalFrameframes[] =deskPane.getAllFrames()
;
for
(
int i =0; i <frames.length; i++)
{
if
(
frames[
i
]
.getX() +frames[
i
]
.getWidth() >xMax)
{
xMax=frames[
i
]
.getX() +frames[
i