The Project        Download   Javadoc   SourceForge

TitlePanel

It is a panel with a title area.

Accepts customization for the following items:

  • Title text
  • Title icon
  • Title margin
  • Title gaps
  • Title foreground color
  • Title background color (solid or gradient)
  • Title components
  • Separator line color
  • Separator line thickness
Example 1

 ImageIcon iconRefresh = new ImageIcon(urlRefresh); 
 ImageIcon iconHelp = new ImageIcon(urlHelp); 
 ImageIcon iconBuy = new ImageIcon(urlBuy); 
  
 JLabel lRefresh = new JLabel(iconRefresh); 
 JLabel lHelp = new JLabel(iconHelp); 
 JComponent comps[] = new JComponent[] { lRefresh, lHelp }; 
  
 TitlePanel titlePanel = new TitlePanel(iconBuy, "List", comps); 
  
 DefaultListModel model = new DefaultListModel(); 
  
 model.addElement("Apple"); 
 model.addElement("Banana"); 
 model.addElement("Lemon"); 
 model.addElement("Orange"); 
 model.addElement("Pear"); 
 model.addElement("Tomato"); 
  
 JList list = new JList(model); 
 titlePanel.add(list); 


Example 2

 ImageIcon iconRefresh = new ImageIcon(urlRefresh); 
 ImageIcon iconHelp = new ImageIcon(urlHelp); 
 ImageIcon iconBuy = new ImageIcon(urlBuy); 
  
 JLabel lRefresh = new JLabel(iconRefresh); 
 JLabel lHelp = new JLabel(iconHelp); 
 JComponent comps[] = new JComponent[] { lRefresh, lHelp }; 
  
 TitlePanel titlePanel = new TitlePanel(iconBuy, "List", comps); 
  
 titlePanel.setSeparatorColor(Color.ORANGE); 
 titlePanel.setSeparatorThickness(6); 
 titlePanel.setBorder(BorderFactory.createLineBorder(Color.RED, 2)); 
  
 DefaultListModel model = new DefaultListModel(); 
  
 model.addElement("Apple"); 
 model.addElement("Banana"); 
 model.addElement("Lemon"); 
 model.addElement("Orange"); 
 model.addElement("Pear"); 
 model.addElement("Tomato"); 
  
 JList list = new JList(model); 
 titlePanel.add(list); 


Example 3

 ImageIcon iconFind = new ImageIcon(urlFind); 
  
 TitlePanel titlePanel = new TitlePanel(iconFind, "Search"); 
 titlePanel.setTitleBackground(Color.LIGHT_GRAY); 
 titlePanel.setSeparatorColor(Color.BLACK); 
 titlePanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); 
  
 JTextField field = new JTextField(15); 
 field.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); 
 titlePanel.add(field); 

 

Partners