1 package com.sshtools.ui.swing; 2 3 import java.awt.GridBagConstraints ; 4 import java.awt.GridBagLayout ; 5 import java.awt.Insets ; 6 import javax.swing.JLabel ; 7 import javax.swing.JPanel ; 8 import javax.swing.JSeparator ; 9 import javax.swing.UIManager ; 10 11 16 public class TitledSeparator 17 extends JPanel { 18 19 21 26 public TitledSeparator(String text) { 27 super(new GridBagLayout ()); 28 GridBagConstraints gbc2 = new GridBagConstraints (); 29 gbc2.fill = GridBagConstraints.HORIZONTAL; 30 gbc2.anchor = GridBagConstraints.WEST; 31 gbc2.weightx = 0.0; 32 gbc2.insets = new Insets (4, 0, 2, 2); 33 JLabel l = new JLabel (text); 34 l.setFont(UIManager.getFont("ToolTip.font")); 35 UIUtil.jGridBagAdd(this, l, gbc2, 36 GridBagConstraints.RELATIVE); 37 gbc2.weightx = 1.0; 38 UIUtil.jGridBagAdd(this, new JSeparator (JSeparator.HORIZONTAL), gbc2, 39 GridBagConstraints.REMAINDER); 40 } 41 } | Popular Tags |