Browse Source

REPORT-4186 [代码质量]设计器属性分类标题,代码实现最好用基本控件实现

master
momeak 7 years ago
parent
commit
372ae835da
  1. 17
      designer_base/src/com/fr/design/foldablepane/HeaderPane.java

17
designer_base/src/com/fr/design/foldablepane/HeaderPane.java

@ -1,5 +1,6 @@
package com.fr.design.foldablepane;
import com.fr.base.GraphHelper;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxUtilities;
@ -53,6 +54,7 @@ public class HeaderPane extends JPanel {
RenderingHints.VALUE_ANTIALIAS_ON);
BufferedImage panelImage = createPanelImage();
g2d.drawImage(panelImage, null, 0, 0);
GraphHelper.drawString(g2d, this.title, TITLE_X, headHeight - fontSize / 2 - 1);
}
private BufferedImage createPanelImage() {
@ -67,7 +69,6 @@ public class HeaderPane extends JPanel {
if (desktopHints != null) {
g2d.setRenderingHints(desktopHints);
}
g2d.drawString(this.title, TITLE_X, headHeight - fontSize / 2 - 1);
int leftWdith = headWidth - LEFT_X;
if (this.isShow) {
image = UIConstants.DRAG_DOWN_SELECTED_SMALL;
@ -103,13 +104,13 @@ public class HeaderPane extends JPanel {
}
public static void main(String[] args) {
// JFrame mainFrame = new JFrame("UI Demo - Gloomyfish");
// mainFrame.getContentPane().setLayout(new BorderLayout());
// mainFrame.getContentPane().add(new HeaderPane(Color.black, "基本", 24), BorderLayout.CENTER);
// mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// mainFrame.pack();
// mainFrame.setSize(300, 400);
// mainFrame.setVisible(true);
JFrame mainFrame = new JFrame("UI Demo - Gloomyfish");
mainFrame.getContentPane().setLayout(new BorderLayout());
mainFrame.getContentPane().add(new HeaderPane(Color.black, "基本", 24), BorderLayout.CENTER);
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainFrame.pack();
mainFrame.setSize(300, 400);
mainFrame.setVisible(true);
}
}

Loading…
Cancel
Save