processSeek((e.x - playPosThumbRec.x)
/ (float) playPosLineRec.width);
}
}
});
shell.addMouseMoveListener(new MouseMoveListener()
{
public void mouseMove(MouseEvent e)
{
// 调节音量thumb的滑动控制
if (offset[0] != null)
{
if (e.x >= volumeLineRec.x - 2
&& e.x < volumeLineRec.x + volumeLineRec.width - 3
&& e.y >= volumeLineRec.y)
{
volumeThumbLbl.setLocation(e.x, offset[0].y);
try
{
volumeValue = (e.x - volumeThumbRec.x)
/ (float) volumeLineRec.width;
theSoundPlayer.setGain(volumeValue);
}
catch (BasicPlayerException bep)
{
bep.printStackTrace();
}
}
}
// 设置各按钮激活状态与普通状态的皮肤切换
setLblSkinStatus(e.x, playRec.x, playRec.width, e.y, playRec.y,
playRec.height, playLbl, playIm, playActIm);
setLblSkinStatus(e.x, pauseRec.x, pauseRec.width, e.y,
pauseRec.y, pauseRec.height, pauseLbl, pauseIm,
pauseActIm);
setLblSkinStatus(e.x, stopRec.x, stopRec.width, e.y, stopRec.y,
stopRec.height, stopLbl, stopIm, stopActIm);
setLblSkinStatus(e.x, prevRec.x, prevRec.width, e.y, prevRec.y,
prevRec.height, prevLbl, prevIm, prevActIm);
setLblSkinStatus(e.x, nextRec.x, nextRec.width, e.y, nextRec.y,
nextRec.height, nextLbl, nextIm, nextActIm);
setLblSkinStatus(e.x, openRec.x, openRec.width, e.y, openRec.y,
openRec.height, openLbl, openIm, openActIm);
setLblSkinStatus(e.x, lstRec.x, lstRec.width, e.y, lstRec.y,
lstRec.height, lstLbl, lstIm, lstActIm);
setLblSkinStatus(e.x, lrcRec.x, lrcRec.width, e.y, lrcRec.y,
lrcRec.height, lrcLbl, lrcIm, lrcActIm);
setLblSkinStatus(e.x, minimizeRec.x, minimizeRec.width, e.y,
minimizeRec.y, minimizeRec.height, minimizeLbl,
minimizeIm, minimizeActIm);
setLblSkinStatus(e.x, closeRec.x, closeRec.width, e.y,
closeRec.y, closeRec.height, closeLbl, closeIm,
closeActIm);
setLblSkinStatus(e.x, volumeThumbLbl.getLocation().x,
volumeThumbRec.width, e.y,
volumeThumbLbl.getLocation().y, volumeThumbRec.height,
volumeThumbLbl, volumeThumbIm, volumeThumbActIm);
setLblSkinStatus(e.x, playPosThumbLbl.getLocation().x,
playPosThumbRec.width, e.y, playPosThumbLbl
.getLocation().y, playPosThumbRec.height,
playPosThumbLbl, playPosThumbIm, playPosThumbActIm);
}
});
shell.setBounds(playerRec);
closeLbl = new Label(shell, SWT.NONE);
closeLbl.setImage(closeIm);
closeLbl.addMouseListener(new MouseAdapter()
{
public void mouseDown(MouseEvent e)
{
processStop();
lrcShowPanelUI.showLyricsStop(); // 结束歌词显示线程
shell.dispose();
}
});
// 当鼠标从关闭按钮上移动到最小化按钮的时候可能不会经过主窗口shell,
// 所以应该在关闭按钮上也增加鼠标移动监听
closeLbl.addMouseMoveListener(new MouseMoveListener()
{
public void mouseMove(MouseEvent e)
{
// 最小化按钮激活状态与普通状态的皮肤切换
if (e.x - minimizeRec.x >= minimizeRec.width - minimizeRec.x
- 2
&& e.x - minimizeRec.x <= minimizeRec.width
&& e.y - minimizeRec.y >= -1
&& e.y - minimizeRec.y <= minimizeRec.height)
{
minimizeLbl.setImage(minimizeActIm);
}
else
{
minimizeLbl.setImage(minimizeIm);
}
}
});
closeLbl.setBounds(closeRec);
minimizeLbl = new Label(shell, SWT.NONE);
minimizeLbl.setImage(minimizeIm);
minimizeLbl.addMouseListener(new MouseAdapter()
{
public void mouseDown(MouseEvent e)
{
shell.setMinimized(true);
}
});
// 当鼠标从最小化按钮上移动到关闭按钮的时候可能不会经过主窗口shell,
// 所以应该在最小化按钮上也增加鼠标移动监听
minimizeLbl.addMouseMoveListener(new MouseMoveListener()
{
public void mouseMove(MouseEvent e)
{
// 关闭按钮激活状态与普通状态的皮肤切换
if (e.x - closeRec.x >= (closeRec.width - closeRec.x - 2)