📄 imageborder.java
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package com.hadeslee.yoyoplayer.player.ui;import java.awt.Component;import java.awt.Graphics;import java.awt.Image;import java.awt.Insets;import javax.swing.border.Border;/** * * @author hadeslee */public class ImageBorder implements Border { private Insets insets = new Insets(0, 0, 0, 0); private Image image = null; public ImageBorder() { super(); } public void setImage(Image image) { this.image = image; } public boolean isBorderOpaque() { return true; } public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { if (image != null) { int x0 = x + (width - image.getWidth(null)) / 2; int y0 = y + (height - image.getHeight(null)) / 2; g.drawImage(image, x0, y0, null); } } public Insets getBorderInsets(Component c) { return insets; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -