forked from fanruan/design
Browse Source
* commit 'e7be389f97308a1026107e47c3e405d6b8fc1c36': REPORT-38688 设计器在双屏下拖动会有卡屏的现象 REPORT-38688 设计器在双屏下拖动会有卡屏的现象 REPORT-40027 NPE REPORT-40027 代码修改 REPORT-40646 去掉无用的代码 REPORT-40646 远程设计对接平台密码策略 REPORT-40027 缓存模板的组件树展开路径,在切换模板的时候保证组件树的展开bugfix/10.0
superman
4 years ago
9 changed files with 382 additions and 102 deletions
@ -0,0 +1,55 @@
|
||||
package com.fr.design.dialog.link; |
||||
|
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.stable.StringUtils; |
||||
import java.awt.Color; |
||||
import java.awt.Desktop; |
||||
import java.awt.Font; |
||||
import java.net.URI; |
||||
import javax.swing.JEditorPane; |
||||
import javax.swing.event.HyperlinkEvent; |
||||
|
||||
/** |
||||
* 用来构建JOptionPane带超链的消息提示 |
||||
* |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/10/23 |
||||
*/ |
||||
public class MessageWithLink extends JEditorPane { |
||||
|
||||
public MessageWithLink(String message, String linkName, String link) { |
||||
super("text/html", "<html><body style=\"" + getStyle() + "\">" + message + "<a href=\"" + link + "\">" + linkName + "</a>" + "</body></html>"); |
||||
addHyperlinkListener(e -> { |
||||
if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) { |
||||
try { |
||||
Desktop.getDesktop().browse(URI.create(link)); |
||||
} catch (Exception exception) { |
||||
FineLoggerFactory.getLogger().error(exception.getMessage(), exception); |
||||
} |
||||
} |
||||
}); |
||||
setEditable(false); |
||||
setBorder(null); |
||||
} |
||||
|
||||
public MessageWithLink(String linkName, String link ) { |
||||
this(StringUtils.EMPTY, linkName, link); |
||||
} |
||||
|
||||
private static StringBuilder getStyle() { |
||||
// 构建和相同风格样式
|
||||
UILabel label = new UILabel(); |
||||
Font font = label.getFont(); |
||||
Color color = label.getBackground(); |
||||
|
||||
StringBuilder style = new StringBuilder("font-family:" + font.getFamily() + ";"); |
||||
style.append("font-weight:").append(font.isBold() ? "bold" : "normal").append(";"); |
||||
style.append("font-size:").append(font.getSize()).append("pt;"); |
||||
style.append("background-color: rgb(").append(color.getRed()).append(",").append(color.getGreen()).append(",").append(color.getBlue()).append(");"); |
||||
|
||||
return style; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,22 @@
|
||||
package com.fr.design.mainframe; |
||||
|
||||
/** |
||||
* @Author: Yuan.Wang |
||||
* @Date: 2020/10/27 |
||||
*/ |
||||
public class JTemplateActionListenerAdapter implements JTemplateActionListener { |
||||
@Override |
||||
public void templateOpened(JTemplate<?, ?> jt) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void templateSaved(JTemplate<?, ?> jt) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void templateClosed(JTemplate<?, ?> jt) { |
||||
|
||||
} |
||||
} |
Loading…
Reference in new issue