📄 skin.java
字号:
spline.setBarImage(splineBarImage);
int[] pixels = new int[1 * h];
PixelGrabber pg = new PixelGrabber(imFullEqualizer, 115, 294, 1, h, pixels, 0, 1);
try
{
pg.grabPixels();
}
catch (InterruptedException e)
{
log.debug(e);
}
Color[] colors = new Color[h];
for (int i = 0; i < h; i++)
{
int c = pixels[i];
int red = (c & 0x00ff0000) >> 16;
int green = (c & 0x0000ff00) >> 8;
int blue = c & 0x000000ff;
colors[i] = new Color(red, green, blue);
}
spline.setGradient(colors);
spline.setConstraints(new AbsoluteConstraints(panelSplineLocation[0], panelSplineLocation[1], panelSplineLocation[2], panelSplineLocation[3]));
}
}
/**
* Instantiate playlist panel.
*/
public void setPlaylistPanel()
{
playlist = new PlaylistUIDelegate();
Image titleCenter = new BufferedImage(100, 20, BufferedImage.TYPE_INT_RGB);
titleCenter.getGraphics().drawImage(imPlaylist, 0, 0, 100, 20, 26, 0, 126, 20, null);
playlist.setTitleCenterImage(titleCenter);
Image titleLeft = new BufferedImage(25, 20, BufferedImage.TYPE_INT_RGB);
titleLeft.getGraphics().drawImage(imPlaylist, 0, 0, 25, 20, 0, 0, 25, 20, null);
playlist.setTitleLeftImage(titleLeft);
Image titleStretch = new BufferedImage(25, 20, BufferedImage.TYPE_INT_RGB);
titleStretch.getGraphics().drawImage(imPlaylist, 0, 0, 25, 20, 127, 0, 152, 20, null);
playlist.setTitleStretchImage(titleStretch);
Image titleRight = new BufferedImage(25, 20, BufferedImage.TYPE_INT_RGB);
titleRight.getGraphics().drawImage(imPlaylist, 0, 0, 25, 20, 153, 0, 178, 20, null);
playlist.setTitleRightImage(titleRight);
Image btmLeft = new BufferedImage(125, 38, BufferedImage.TYPE_INT_RGB);
btmLeft.getGraphics().drawImage(imPlaylist, 0, 0, 125, 38, 0, 72, 125, 110, null);
playlist.setBottomLeftImage(btmLeft);
Image btmRight = new BufferedImage(150, 38, BufferedImage.TYPE_INT_RGB);
btmRight.getGraphics().drawImage(imPlaylist, 0, 0, 150, 38, 126, 72, 276, 110, null);
playlist.setBottomRightImage(btmRight);
Image bodyLeft = new BufferedImage(12, 28, BufferedImage.TYPE_INT_RGB);
bodyLeft.getGraphics().drawImage(imPlaylist, 0, 0, 12, 28, 0, 42, 12, 70, null);
playlist.setLeftImage(bodyLeft);
Image bodyRight = new BufferedImage(20, 28, BufferedImage.TYPE_INT_RGB);
bodyRight.getGraphics().drawImage(imPlaylist, 0, 0, 20, 28, 31, 42, 51, 70, null);
playlist.setRightImage(bodyRight);
// Parse color
plEdit = plEdit.toLowerCase();
ByteArrayInputStream in = new ByteArrayInputStream(plEdit.getBytes());
BufferedReader lin = new BufferedReader(new InputStreamReader(in));
try
{
for (;;)
{
String line = lin.readLine();
if (line == null) break;
if ((line.toLowerCase()).startsWith("normalbg")) playlist.setBackgroundColor(parsePlEditColor(line));
else if ((line.toLowerCase()).startsWith("normal")) playlist.setNormalColor(parsePlEditColor(line));
else if ((line.toLowerCase()).startsWith("current")) playlist.setCurrentColor(parsePlEditColor(line));
else if ((line.toLowerCase()).startsWith("selectedbg")) playlist.setSelectedBackgroundColor(parsePlEditColor(line));
}
}
catch (Exception e)
{
log.debug(e);
}
finally
{
try
{
if (in != null) in.close();
}
catch (IOException e)
{
}
}
// Playlist slider.
acPlSlider = new ActiveJSlider();
acPlSlider.setOrientation(JSlider.VERTICAL);
acPlSlider.setMinimum(0);
acPlSlider.setMaximum(100);
acPlSlider.setValue(100);
ActiveSliderUI sUI = new ActiveSliderUI(acPlSlider);
Image scrollBarReleased = new BufferedImage(8, 18, BufferedImage.TYPE_INT_RGB);
scrollBarReleased.getGraphics().drawImage(imPlaylist, 0, 0, 8, 18, 52, 53, 52 + 8, 53 + 18, null);
sUI.setThumbImage(scrollBarReleased);
Image scrollBarClicked = new BufferedImage(8, 18, BufferedImage.TYPE_INT_RGB);
scrollBarClicked.getGraphics().drawImage(imPlaylist, 0, 0, 8, 18, 61, 53, 61 + 8, 53 + 18, null);
sUI.setThumbPressedImage(scrollBarClicked);
Image sliderBackground = new BufferedImage(20, 58, BufferedImage.TYPE_INT_RGB);
sliderBackground.getGraphics().drawImage(bodyRight, 0, 0, null);
sliderBackground.getGraphics().drawImage(bodyRight, 0, 28, null);
sliderBackground.getGraphics().drawImage(bodyRight, 0, 30, null);
Image[] background = { sliderBackground };
sUI.setBackgroundImages(background);
sUI.setThumbXOffset(5);
acPlSlider.setUI(sUI);
acPlSlider.setConstraints(new AbsoluteConstraints(plSliderLocation[0], plSliderLocation[1], 20, 58));
// Up/Down scroll buttons
acPlUp = new ActiveJButton();
Image upScrollButton = new BufferedImage(8, 4, BufferedImage.TYPE_INT_RGB);
upScrollButton.getGraphics().drawImage(imPlaylist, 0, 0, 8, 4, 261, 75, 269, 79, null);
acPlUp.setIcon(new ImageIcon(upScrollButton));
acPlUp.setPressedIcon(new ImageIcon(upScrollButton));
acPlUp.setConstraints(new AbsoluteConstraints(WinWidth - 15, WinHeight - 35, 8, 4));
acPlUp.setActionCommand(PlayerActionEvent.ACPLUP);
acPlDown = new ActiveJButton();
Image downScrollButton = new BufferedImage(8, 4, BufferedImage.TYPE_INT_RGB);
downScrollButton.getGraphics().drawImage(imPlaylist, 0, 0, 8, 4, 261, 80, 269, 84, null);
acPlDown.setIcon(new ImageIcon(downScrollButton));
acPlDown.setPressedIcon(new ImageIcon(downScrollButton));
acPlDown.setConstraints(new AbsoluteConstraints(WinWidth - 15, WinHeight - 30, 8, 4));
acPlDown.setActionCommand(PlayerActionEvent.ACPLDOWN);
// Playlist AddFile/AddDir/AddURL buttons
int w = 22;
int h = 18;
Image addButtonImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
addButtonImage.getGraphics().drawImage(imPlaylist, 0, 0, w, h, 14, 80, 14 + w, 80 + h, null);
acPlAdd = new ActiveJButton();
acPlAdd.setIcon(new ImageIcon(addButtonImage));
acPlAdd.setPressedIcon(new ImageIcon(addButtonImage));
acPlAdd.setActionCommand(PlayerActionEvent.ACPLADDPOPUP);
acPlAdd.setConstraints(new AbsoluteConstraints(plAddLocation[0], plAddLocation[1], w, h));
ActiveJButton acPlAddFile = createPLButton(0, 149);
acPlAddFile.setActionCommand(PlayerActionEvent.ACPLADDFILE);
ActiveJButton acPlAddDir = createPLButton(0, 130);
acPlAddDir.setActionCommand(PlayerActionEvent.ACPLADDDIR);
ActiveJButton acPlAddURL = createPLButton(0, 111);
acPlAddURL.setActionCommand(PlayerActionEvent.ACPLADDURL);
acPlAddPopup = new ActiveJPopup();
ActiveJButton[] addbuttons = { acPlAddURL, acPlAddDir, acPlAddFile };
acPlAddPopup.setItems(addbuttons);
acPlAddPopup.setConstraints(new AbsoluteConstraints(plAddPopupArea[0], plAddPopupArea[1], plAddPopupArea[2], plAddPopupArea[3]));
// Playlist RemoveMisc/RemoveSelection/Crop/RemoveAll buttons
Image removeButtonImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
removeButtonImage.getGraphics().drawImage(imPlaylist, 0, 0, w, h, 14 + 30, 80, 14 + 30 + w, 80 + h, null);
acPlRemove = new ActiveJButton();
acPlRemove.setIcon(new ImageIcon(removeButtonImage));
acPlRemove.setPressedIcon(new ImageIcon(removeButtonImage));
acPlRemove.setActionCommand(PlayerActionEvent.ACPLREMOVEPOPUP);
acPlRemove.setConstraints(new AbsoluteConstraints(plRemoveLocation[0], plRemoveLocation[1], w, h));
ActiveJButton acPlRemoveMisc = createPLButton(54, 168);
acPlRemoveMisc.setActionCommand(PlayerActionEvent.ACPLREMOVEMISC);
ActiveJButton acPlRemoveSel = createPLButton(54, 149);
acPlRemoveSel.setActionCommand(PlayerActionEvent.ACPLREMOVESEL);
ActiveJButton acPlRemoveCrop = createPLButton(54, 130);
acPlRemoveCrop.setActionCommand(PlayerActionEvent.ACPLREMOVECROP);
ActiveJButton acPlRemoveAll = createPLButton(54, 111);
acPlRemoveAll.setActionCommand(PlayerActionEvent.ACPLREMOVEALL);
acPlRemovePopup = new ActiveJPopup();
ActiveJButton[] rembuttons = { acPlRemoveMisc, acPlRemoveAll, acPlRemoveCrop, acPlRemoveSel };
acPlRemovePopup.setItems(rembuttons);
acPlRemovePopup.setConstraints(new AbsoluteConstraints(plRemovePopupArea[0], plRemovePopupArea[1], plRemovePopupArea[2], plRemovePopupArea[3]));
// Playlist SelAll/SelZero/SelInv buttons
Image selButtonImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
selButtonImage.getGraphics().drawImage(imPlaylist, 0, 0, w, h, 14 + 60, 80, 14 + 60 + w, 80 + h, null);
acPlSelect = new ActiveJButton();
acPlSelect.setIcon(new ImageIcon(selButtonImage));
acPlSelect.setPressedIcon(new ImageIcon(selButtonImage));
acPlSelect.setActionCommand(PlayerActionEvent.ACPLSELPOPUP);
acPlSelect.setConstraints(new AbsoluteConstraints(plSelectLocation[0], plSelectLocation[1], w, h));
ActiveJButton acPlSelectAll = createPLButton(104, 149);
acPlSelectAll.setActionCommand(PlayerActionEvent.ACPLSELALL);
ActiveJButton acPlSelectZero = createPLButton(104, 130);
acPlSelectZero.setActionCommand(PlayerActionEvent.ACPLSELZERO);
ActiveJButton acPlSelectInv = createPLButton(104, 111);
acPlSelectInv.setActionCommand(PlayerActionEvent.ACPLSELINV);
acPlSelectPopup = new ActiveJPopup();
ActiveJButton[] selbuttons = { acPlSelectInv, acPlSelectZero, acPlSelectAll };
acPlSelectPopup.setItems(selbuttons);
acPlSelectPopup.setConstraints(new AbsoluteConstraints(plSelectPopupArea[0], plSelectPopupArea[1], plSelectPopupArea[2], plSelectPopupArea[3]));
// Playlist MiscOpts/MiscFile/MiscSort buttons
Image miscButtonImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
miscButtonImage.getGraphics().drawImage(imPlaylist, 0, 0, w, h, 14 + 89, 80, 14 + 89 + w, 80 + h, null);
acPlMisc = new ActiveJButton();
acPlMisc.setIcon(new ImageIcon(miscButtonImage));
acPlMisc.setPressedIcon(new ImageIcon(miscButtonImage));
acPlMisc.setActionCommand(PlayerActionEvent.ACPLMISCPOPUP);
acPlMisc.setConstraints(new AbsoluteConstraints(plMiscLocation[0], plMiscLocation[1], w, h));
ActiveJButton acPlMiscOpts = createPLButton(154, 149);
acPlMiscOpts.setActionCommand(PlayerActionEvent.ACPLMISCOPTS);
ActiveJButton acPlMiscFile = createPLButton(154, 130);
acPlMiscFile.setActionCommand(PlayerActionEvent.ACPLMISCFILE);
ActiveJButton acPlMiscSort = createPLButton(154, 111);
acPlMiscSort.setActionCommand(PlayerActionEvent.ACPLMISCSORT);
acPlMiscPopup = new ActiveJPopup();
ActiveJButton[] miscbuttons = { acPlMiscSort, acPlMiscFile, acPlMiscOpts };
acPlMiscPopup.setItems(miscbuttons);
acPlMiscPopup.setConstraints(new AbsoluteConstraints(plMiscPopupArea[0], plMiscPopupArea[1], plMiscPopupArea[2], plMiscPopupArea[3]));
// Playlist ListLoad/ListSave/ListNew buttons
Image listButtonImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
listButtonImage.getGraphics().drawImage(imPlaylist, 0, 0, w, h, 14 + 215, 80, 14 + 215 + w, 80 + h, null);
acPlList = new ActiveJButton();
acPlList.setIcon(new ImageIcon(listButtonImage));
acPlList.setPressedIcon(new ImageIcon(listButtonImage));
acPlList.setActionCommand(PlayerActionEvent.ACPLLISTPOPUP);
acPlList.setConstraints(new AbsoluteConstraints(plListLocation[0], plListLocation[1], w, h));
ActiveJButton acPlListLoad = createPLButton(204, 149);
acPlListLoad.setActionCommand(PlayerActionEvent.ACPLLISTLOAD);
ActiveJButton acPlListSave = createPLButton(204, 130);
acPlListSave.setActionCommand(PlayerActionEvent.ACPLLISTSAVE);
ActiveJButton acPlListNew = createPLButton(204, 111);
acPlListNew.setActionCommand(PlayerActionEvent.ACPLLISTNEW);
acPlListPopup = new ActiveJPopup();
ActiveJButton[] listbuttons = { acPlListNew, acPlListSave, acPlListLoad };
acPlListPopup.setItems(listbuttons);
acPlListPopup.setConstraints(new AbsoluteConstraints(plListPopupArea[0], plListPopupArea[1], plListPopupArea[2], plListPopupArea[3]));
}
/**
* Create Playlist buttons.
* @param sx
* @param sy
* @return
*/
private ActiveJButton createPLButton(int sx, int sy)
{
Image normal = new BufferedImage(22, 18, BufferedImage.TYPE_INT_RGB);
Image clicked = new BufferedImage(22, 18, BufferedImage.TYPE_INT_RGB);
Graphics g = normal.getGraphics();
g.drawImage(imPlaylist, 0, 0, 22, 18, sx, sy, sx + 22, sy + 18, null);
sx += 23;
g = clicked.getGraphics();
g.drawImage(imPlaylist, 0, 0, 22, 18, sx, sy, sx + 22, sy + 18, null);
ActiveJButton comp = new ActiveJButton();
comp.setIcon(new ImageIcon(normal));
comp.setPressedIcon(new ImageIcon(clicked));
comp.setRolloverIcon(new ImageIcon(clicked));
comp.setRolloverEnabled(true);
return comp;
}
/**
* Parse playlist colors.
* @param line
* @return
* @throws Exception
*/
private Color parsePlEditColor(String line) throws Exception
{
int pos = line.indexOf("#");
if (pos == -1)
{
pos = line.indexOf("=");
if (pos == -1) throw new Exception("Can not parse color!");
}
line = line.substring(pos + 1);
int r = Integer.parseInt(line.substring(0, 2), 16);
int g = Integer.parseInt(line.substring(2, 4), 16);
int b = Integer.parseInt(line.substring(4), 16);
return new Color(r, g, b);
}
/**
* Crop Panel Features from image file.
* @param releasedImage
* @param releasedPanel
* @param pressedImage
* @param pressedPanel
* @param imPanel
*/
public void readPanel(Image[] releasedImage, int[] releasedPanel, Image[] pressedImage, int[] pressedPanel, Image imPanel)
{
int xul, yul, xld, yld;
int j = 0;
if (releasedImage != null)
{
for (int i = 0; i < releasedImage.length; i++)
{
releasedImage[i] = new BufferedImage(releasedPanel[j + 2], releasedPanel[j + 3], BufferedImage.TYPE_INT_RGB);
xul = releasedPanel[j];
yul = releasedPanel[j + 1];
xld = releasedPanel[j] + releasedPanel[j + 2];
yld = releasedPanel[j + 1] + releasedPanel[j + 3];
(releasedImage[i].getGraphics()).drawImage(imPanel, 0, 0, releasedPanel[j + 2], releasedPanel[j + 3], xul, yul, xld, yld, null);
j = j + 4;
}
}
j = 0;
if (pressedImage != null)
{
for (int i = 0; i < pressedImage.length; i++)
{
pressedImage[i] = new BufferedImage(pressedPanel[j + 2], pressedPanel[j + 3], BufferedImage.TYPE_INT_RGB);
xul = pressedPanel[j];
yul = pressedPanel[j + 1];
xld = pressedPanel[j] + pressedPanel[j + 2];
yld = pressedPanel[j + 1] + pressedPanel[j + 3];
(pressedImage[i].getGraphics()).drawImage(imPanel, 0, 0, pressedPanel[j + 2], pressedPanel[j + 3], xul, yul, xld, yld, null);
j = j + 4;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -