|
It is a panel with a title area.
Accepts customization for the following items:
- Title text
- Title icon
- Title foreground color
- Title background color (solid or gradient)
- Separator line color
- Separator line thickness
- Extra buttons
|
|
public static TitlePanel buildMarketPanel() {
Class<?> cls = ...
URL uRefresh = cls.getResource("refresh.png");
URL uHelp = cls.getResource("help.png");
URL uBuy = cls.getResource("buy.png");
Icon iRefresh = new ImageIcon(uRefresh);
Icon iHelp = new ImageIcon(uHelp);
Icon iBuy = new ImageIcon(uBuy)
JLabel lRefresh = new JLabel(iRefresh);
JLabel lHelp = new JLabel(iHelp);
JComponent comps[] = new JComponent[] { lRefresh, lHelp };
DefaultListModel model = new DefaultListModel();
model.addElement("Apple");
model.addElement("Lemon");
model.addElement("Orange");
model.addElement("Pear");
model.addElement("Tomato");
JList list = new JList(model);
list.setVisibleRowCount(5);
TitlePanel tp = new TitlePanel(iBuy, "List", comps);
tp.add(new JScrollPane(list));
return tp;
}
TitlePanel tp1 = buildMarketPanel();
TitlePanel tp2 = buildMarketPanel();
tp2.setSeparatorColor(Color.ORANGE);
tp2.setSeparatorThickness(6);
tp2.setBorder(BorderFactory.createLineBorder(Color.RED, 2));
|
|
|
|