diff --git a/designer_base/src/com/fr/design/foldablepane/HeaderPane.java b/designer_base/src/com/fr/design/foldablepane/HeaderPane.java index 8e99896bc1..31cc290324 100644 --- a/designer_base/src/com/fr/design/foldablepane/HeaderPane.java +++ b/designer_base/src/com/fr/design/foldablepane/HeaderPane.java @@ -22,10 +22,15 @@ public class HeaderPane extends JPanel { private int headHeight; private Color bgColor; private boolean isShow; + private boolean isPressed = false; private String title; private Image image; private int fontSize; + public void setPressed(boolean pressed) { + this.isPressed = pressed; + } + public void setShow(boolean isShow) { this.isShow = isShow; } @@ -60,7 +65,8 @@ public class HeaderPane extends JPanel { private BufferedImage createPanelImage() { BufferedImage panelImage = new BufferedImage(getWidth(), headHeight, BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = panelImage.createGraphics(); - g2d.setColor(UIConstants.COMPONENT_BACKGROUND_COLOR); + + g2d.setColor(isPressed ? UIConstants.POPUP_TITLE_BACKGROUND : UIConstants.COMPONENT_BACKGROUND_COLOR); headWidth = this.getWidth(); g2d.fillRect(0, 0, headWidth, headHeight); g2d.setFont(new Font("SimSun", 0, fontSize)); diff --git a/designer_base/src/com/fr/design/foldablepane/UIExpandablePane.java b/designer_base/src/com/fr/design/foldablepane/UIExpandablePane.java index 924415aea3..9ed2d9757b 100644 --- a/designer_base/src/com/fr/design/foldablepane/UIExpandablePane.java +++ b/designer_base/src/com/fr/design/foldablepane/UIExpandablePane.java @@ -58,7 +58,8 @@ public class UIExpandablePane extends JPanel { } class PanelAction extends MouseAdapter { - public void mousePressed(MouseEvent e) { + @Override + public void mouseClicked(MouseEvent e) { HeaderPane hp = (HeaderPane) e.getSource(); if (contentPanel.isShowing()) { contentPanel.setVisible(false); @@ -67,9 +68,23 @@ public class UIExpandablePane extends JPanel { contentPanel.setVisible(true); hp.setShow(true); } + hp.setPressed(false); hp.getParent().validate(); hp.getParent().repaint(); } + + public void mousePressed(MouseEvent e) { + HeaderPane hp = (HeaderPane) e.getSource(); + hp.setPressed(true); + hp.getParent().repaint(); + } + + @Override + public void mouseExited(MouseEvent e) { + HeaderPane hp = (HeaderPane) e.getSource(); + hp.setPressed(false); + hp.getParent().repaint(); + } }