📄 titlepanel.java
字号:
package net.aetherial.gis2.surface.systemtools;
import javax.swing.JPanel;
import javax.swing.JLabel;
import java.awt.BorderLayout;
import java.awt.*;
import net.aetherial.gis2.publicuse.SystemItem;
import javax.swing.ImageIcon;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2004</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class TitlePanel
extends JPanel {
public TitlePanel() {
try {
jbInit();
}
catch (Exception ex) {
ex.printStackTrace();
}
}
private void jbInit() throws Exception {
title.setText("TitlePanel");
this.setLayout(borderLayout1);
icon_Hide.setToolTipText("隐藏窗口");
icon_Hide.setText(" ");
jPanelIcon.setLayout(flowLayout1);
icon_Size.setToolTipText("放大缩小窗口");
icon_Size.setText(" ");
this.add(jPanelIcon, java.awt.BorderLayout.EAST);
this.add(title, java.awt.BorderLayout.CENTER);
jPanelIcon.add(icon_Size, null);
jPanelIcon.add(icon_Hide, null);
this.initShow();
}
public void setTitle(String title) {
this.title.setText(title);
}
/**
* 当面板放大缩小时要改动Icon
*/
public void setIconChanged() {
if ((this.icon_Size.getIcon()).equals(this.icon_to_full_Size)) {
this.icon_Size.setIcon(icon_to_normal_Size);
}else{
this.icon_Size.setIcon(icon_to_full_Size);
}
}
public void setIcon(ImageIcon icon){
this.icon = icon;
this.title.setIcon(icon);
}
private void initShow() {
this.setBackground(SystemItem.TitleBackGroundColor);
this.jPanelIcon.setBackground(SystemItem.TitleBackGroundColor);
this.icon_Hide.setIcon(icon_to_hide_H);
this.icon_Size.setIcon(icon_to_full_Size);
this.title.setFont(new java.awt.Font("Dialog", Font.BOLD, 12));
this.title.setForeground(Color.white);
this.title.setIcon(icon);
this.setPreferredSize(new Dimension(44, 15));
this.jPanelIcon.setPreferredSize(new Dimension(44, 15));
System.out.println(""+ this.jPanelIcon.getHeight());
}
public int getIconPanleHeight(){
return this.jPanelIcon.getHeight();
}
private JLabel title = new JLabel();
private BorderLayout borderLayout1 = new BorderLayout();
private JPanel jPanelIcon = new JPanel();
private JLabel icon_Hide = new JLabel();
private JLabel icon_Size = new JLabel();
private FlowLayout flowLayout1 = new FlowLayout();
private final ImageIcon icon_to_full_Size = new ImageIcon(SystemItem.getImage(
"file\\icon\\sizeToFull.gif"));
private final ImageIcon icon_to_normal_Size = new ImageIcon(SystemItem.getImage(
"file\\icon\\sizeToNormal.gif"));
private final ImageIcon icon_to_hide_H = new ImageIcon(SystemItem.getImage(
"file\\icon\\Hide_H.gif"));
private final ImageIcon icon_to_hide_V = new ImageIcon(SystemItem.getImage(
"file\\icon\\Hide_V.gif"));
private ImageIcon icon = new ImageIcon(SystemItem.getImage(
"file\\icon\\message.gif"));
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -