⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 titlebar.java

📁 定要上载质量高而定要上载质量高而定要上载质量高而定要上载质量高而定要上载质量高而
💻 JAVA
字号:
/*
 * Created on Jul 6, 2005
 */
package org.flexdock.demos.util;

import java.awt.Color;
import java.awt.Graphics;

import javax.swing.JLabel;
import javax.swing.border.EmptyBorder;

/**
 * @author Christopher Butler
 */
public class Titlebar extends JLabel {

	public Titlebar() {
		super();
		init();
	}

	public Titlebar(String text) {
		super(text);
		init();
	}
	
	public Titlebar(String text, Color bgColor) {
		super(text);
		init();
		setBackground(bgColor);
	}
	
	private void init() {
		setOpaque(true);
		setBorder(new EmptyBorder(2, 4, 2, 2));
	}
	
	protected void paintBorder(Graphics g) {
		int w = getWidth();
		int h = getHeight();

		g.setColor(getBackground().brighter());
		g.drawLine(0, 0, w, 0);
		g.drawLine(0, 0, 0, h);
		
		g.setColor(getBackground().darker());
		g.drawLine(0, h, w, h);
	}
	
	public void setTitle(String title) {
		if(title==null)
			title = "";
		title = title.trim();
		setText(title);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -