titledseparator.java
来自「这是linux下ssl vpn的实现程序」· Java 代码 · 共 42 行
JAVA
42 行
package com.sshtools.ui.swing;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.UIManager;
/**
* Swing component that provides a horziontal separator that is preceeded by some text.
*
* @author $Author: lee $
* @version $Revision: 1.2 $
*/
public class TitledSeparator
extends JPanel {
// Private instance variables
/**
* Construct a titled separtor with some text
*
* @param text text
*/
public TitledSeparator(String text) {
super(new GridBagLayout());
GridBagConstraints gbc2 = new GridBagConstraints();
gbc2.fill = GridBagConstraints.HORIZONTAL;
gbc2.anchor = GridBagConstraints.WEST;
gbc2.weightx = 0.0;
gbc2.insets = new Insets(4, 0, 2, 2);
JLabel l = new JLabel(text);
l.setFont(UIManager.getFont("ToolTip.font"));
UIUtil.jGridBagAdd(this, l, gbc2,
GridBagConstraints.RELATIVE);
gbc2.weightx = 1.0;
UIUtil.jGridBagAdd(this, new JSeparator(JSeparator.HORIZONTAL), gbc2,
GridBagConstraints.REMAINDER);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?