import javax.swing.JPanel; //导入方法依赖的package包/类
private JPanel createContainer(ProfilerFeature feature) {
JPanel container = new JPanel(new BorderLayout(0, 0));
container.putClientProperty(ProfilerFeature.class, feature);
JPanel results = feature.getResultsUI();
JPanel xresults = new JPanel(new BorderLayout()) {
public void paint(Graphics g) {
super.paint(g);
if (hintLabel != null) {
Dimension dim = hintLabel.getSize();
int x = (getWidth() - dim.width) / 2;
int y = (getHeight() - dim.height) / 2;
g.setColor(hintColor);
g.fillRect(x - XMAR, y - YMAR, dim.width + XMAR * 2, dim.height + YMAR * 2);
g.setColor(Color.LIGHT_GRAY);
g.drawRect(x - XMAR, y - YMAR, dim.width + XMAR * 2, dim.height + YMAR * 2);
g.translate(x, y);
hintLabel.paint(g);
g.translate(-x, -y);
}
}
};
xresults.add(results, BorderLayout.CENTER);
container.add(xresults, BorderLayout.CENTER);
JPanel settings = feature.getSettingsUI();
if (settings != null) {
JPanel pan = new JPanel(new BorderLayout(0, 0)) {
public void setVisible(boolean visible) {
super.setVisible(visible);
for (Component c : getComponents()) c.setVisible(visible);
}
};
pan.setOpaque(true);
pan.setBackground(UIUtils.getProfilerResultsBackground());
pan.add(settings, BorderLayout.CENTER);
JSeparator sep = UIUtils.createHorizontalLine(pan.getBackground());
pan.add(sep, BorderLayout.SOUTH);
pan.setVisible(settings.isVisible());
container.add(pan, BorderLayout.NORTH);
}
return container;
}