|
|
|
@ -12,6 +12,7 @@ import javax.swing.JPanel;
|
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
import java.awt.Color; |
|
|
|
|
import java.awt.Dimension; |
|
|
|
|
import java.awt.Font; |
|
|
|
|
import java.awt.event.MouseAdapter; |
|
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
|
|
|
|
|
@ -19,11 +20,13 @@ import java.awt.event.MouseEvent;
|
|
|
|
|
public class TemplateResourcePanel extends JPanel { |
|
|
|
|
|
|
|
|
|
private JPanel northPane; |
|
|
|
|
private JPanel southPane; |
|
|
|
|
private JPanel centerPane; |
|
|
|
|
private TemplateResource templateResource; |
|
|
|
|
|
|
|
|
|
private static final Color PANEL_BORDER_COLOR = new Color(0xe8e8e9); |
|
|
|
|
private static final Color DEMO_LABEL_FOREGROUND = new Color(0x419bf9); |
|
|
|
|
private static final Font RESOURCE_NAME_FONT = new Font("PingFang SC", Font.PLAIN, 12); |
|
|
|
|
private static final Color RESOURCE_NAME_COLOR = new Color(0x5c5c5d); |
|
|
|
|
|
|
|
|
|
protected TemplateResourcePanel() { |
|
|
|
|
|
|
|
|
@ -35,7 +38,7 @@ public class TemplateResourcePanel extends JPanel {
|
|
|
|
|
this.setLayout(new BorderLayout()); |
|
|
|
|
this.setBorder(BorderFactory.createLineBorder(PANEL_BORDER_COLOR, 1)); |
|
|
|
|
this.add(northPane, BorderLayout.NORTH); |
|
|
|
|
this.add(southPane, BorderLayout.SOUTH); |
|
|
|
|
this.add(centerPane, BorderLayout.CENTER); |
|
|
|
|
addAction(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -60,8 +63,8 @@ public class TemplateResourcePanel extends JPanel {
|
|
|
|
|
public JPanel getNorthPane() { |
|
|
|
|
return northPane; |
|
|
|
|
} |
|
|
|
|
public JPanel getSouthPane() { |
|
|
|
|
return southPane; |
|
|
|
|
public JPanel getCenterPane() { |
|
|
|
|
return centerPane; |
|
|
|
|
} |
|
|
|
|
public TemplateResource getTemplateResource() { |
|
|
|
|
return templateResource; |
|
|
|
@ -71,8 +74,8 @@ public class TemplateResourcePanel extends JPanel {
|
|
|
|
|
this.northPane = northPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setSouthPane(JPanel southPane) { |
|
|
|
|
this.southPane = southPane; |
|
|
|
|
public void setCenterPane(JPanel centerPane) { |
|
|
|
|
this.centerPane = centerPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setTemplateResource(TemplateResource templateResource) { |
|
|
|
@ -81,15 +84,17 @@ public class TemplateResourcePanel extends JPanel {
|
|
|
|
|
|
|
|
|
|
private void initComponent() { |
|
|
|
|
createNorthPane(); |
|
|
|
|
createSouthPane(); |
|
|
|
|
createCenterPane(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void createNorthPane() { |
|
|
|
|
northPane = new TemplateResourceImagePanel(templateResource); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void createSouthPane() { |
|
|
|
|
private void createCenterPane() { |
|
|
|
|
JLabel nameLabel = new JLabel(templateResource.getName()); |
|
|
|
|
nameLabel.setFont(RESOURCE_NAME_FONT); |
|
|
|
|
nameLabel.setForeground(RESOURCE_NAME_COLOR); |
|
|
|
|
nameLabel.setBackground(Color.WHITE); |
|
|
|
|
nameLabel.setBorder(BorderFactory.createEmptyBorder()); |
|
|
|
|
|
|
|
|
@ -109,10 +114,10 @@ public class TemplateResourcePanel extends JPanel {
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
southPane = new JPanel(new BorderLayout()); |
|
|
|
|
southPane.setBackground(Color.WHITE); |
|
|
|
|
southPane.add(nameLabel, BorderLayout.WEST); |
|
|
|
|
southPane.add(demoLabel, BorderLayout.EAST); |
|
|
|
|
centerPane = new JPanel(new BorderLayout()); |
|
|
|
|
centerPane.setBackground(Color.WHITE); |
|
|
|
|
centerPane.add(nameLabel, BorderLayout.WEST); |
|
|
|
|
centerPane.add(demoLabel, BorderLayout.EAST); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|