本文整理了Java中javax.swing.JEditorPane.setOpaque()
方法的一些代码示例,展示了JEditorPane.setOpaque()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JEditorPane.setOpaque()
方法的具体详情如下:
包路径:javax.swing.JEditorPane
类名称:JEditorPane
方法名:setOpaque
暂无
代码示例来源:origin: libgdx/libgdx
pane.setOpaque(false);
pane.setAlignmentX(Component.CENTER_ALIGNMENT);
panel.add(pane);
代码示例来源:origin: stackoverflow.com
HtmlImageGenerator imageGenerator = new HtmlImageGenerator() {
protected JEditorPane createJEditorPane() {
JEditorPane editor = super.createJEditorPane();
editor.setOpaque(false);
return editor;
}
};
imageGenerator.loadHtml("<font size=\"6\">Schriftgröße 6</font>");
imageGenerator.saveAsImage("hello-world.png");
代码示例来源:origin: stackoverflow.com
public class TestPane extends JPanel {
public TestPane() {
JEditorPane field = new JEditorPane();
field.setContentType("text/html");
field.setText("<html><a href='https://google.com'>Google it</a></html>");
field.setEditable(false);
field.setBorder(null);
field.setOpaque(false);
setLayout(new GridBagLayout());
add(field);
}
}
代码示例来源:origin: aterai/java-swing-tips
private static Component makeUrlPanel(String title, String href) {
JPanel p = new JPanel(new GridBagLayout());
p.setBorder(BorderFactory.createTitledBorder(title));
JEditorPane editor = new JEditorPane("text/html", href);
editor.setOpaque(false);
editor.setEditable(false);
editor.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
GridBagConstraints c = new GridBagConstraints();
c.insets = new Insets(5, 5, 5, 0);
c.gridx = 0;
c.anchor = GridBagConstraints.LINE_END;
p.add(new JLabel("JLabel:"), c);
p.add(new JLabel("JEditorPane:"), c);
c.gridx = 1;
c.weightx = 1d;
c.anchor = GridBagConstraints.LINE_START;
p.add(new JLabel(href), c);
p.add(editor, c);
return p;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui
public void setOpaque(boolean o) {
super.setOpaque(o);
if (UIUtils.isNimbusLookAndFeel() && !o)
setBackground(new Color(0, 0, 0, 0));
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui
public void setOpaque(boolean o) {
super.setOpaque(o);
if (UIUtils.isNimbusLookAndFeel() && !o)
setBackground(new Color(0, 0, 0, 0));
}
代码示例来源:origin: GoldenGnu/jeveassets
private static JEditorPane getMessage(File file) {
JLabel jLabel = new JLabel();
JEditorPane jEditorPane = new JEditorPane("text/html", "");
jEditorPane.setEditable(false);
jEditorPane.setFocusable(false);
jEditorPane.setOpaque(false);
jEditorPane.setText("<html><body style=\"font-family: " + jLabel.getFont().getName() + "; font-size: " + jLabel.getFont().getSize() + "pt\">"
+ General.get().fileLockMsg(file.getName())
+ "</body></html>");
jEditorPane.addHyperlinkListener(DesktopUtil.getHyperlinkListener(null));
return jEditorPane;
}
}
代码示例来源:origin: GoldenGnu/jeveassets
private JEditorPane createEditorPane(final boolean addBorder, final String text) {
JEditorPane jEditorPane = new JEditorPane("text/html",
"<html><div style=\"font-family: Arial, Helvetica, sans-serif; font-size: 11pt;\">"
+ text
+ "</div>"
);
jEditorPane.setEditable(false);
jEditorPane.setOpaque(false);
jEditorPane.addHyperlinkListener(DesktopUtil.getHyperlinkListener(getDialog()));
if (addBorder) {
jEditorPane.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(jPanel.getBackground().darker(), 1),
BorderFactory.createEmptyBorder(10, 10, 10, 10)));
}
return jEditorPane;
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui
private void updateHtml() {
if (message instanceof String && ((String) message).startsWith("<html>")) {
final JEditorPane pane = new JEditorPane();
pane.setOpaque(false);
pane.setEditable(false);
pane.setEditorKit(new HTMLEditorKit());
pane.setText((String) message);
pane.addHyperlinkListener(new HyperlinkListener() {
public void hyperlinkUpdate(final HyperlinkEvent _evt) {
if (_evt.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
linkActivated(_evt.getURL() == null ? null : _evt.getURL().toString());
}
}
});
setMessage(pane);
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-dlight-util
public static JEditorPane createJEditorPane(String text, boolean needHTMLTags){
JEditorPane editorPane = new JEditorPane("text/html", needHTMLTags || !text.startsWith("<html>") ? "<html><center>" + text + "</center></html>" : text);//NOI18N
editorPane.addHyperlinkListener(new HyperlinkListener() {
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED){
HtmlBrowser.URLDisplayer.getDefault().showURL(e.getURL());
}
}
});
Font font = UIManager.getFont("Label.font");//NOI18N
String bodyRule = "body { font-family: " + font.getFamily() + "; " +//NOI18N
"font-size: " + font.getSize() + "pt; }";//NOI18N
((HTMLDocument)editorPane.getDocument()).getStyleSheet().addRule(bodyRule);
editorPane.setOpaque(false);
editorPane.setEditable(false);
return editorPane;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-dlight-util
public static JEditorPane createJEditorPane(String text, boolean needHTMLTags, Color color){
JEditorPane editorPane = new JEditorPane("text/html", needHTMLTags || !text.startsWith("<html>") ? "<html><center>" + text + "</center></html>" : text);//NOI18N
editorPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
editorPane.addHyperlinkListener(new HyperlinkListener() {
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED){
HtmlBrowser.URLDisplayer.getDefault().showURL(e.getURL());
}
}
});
Font font = UIManager.getFont("Label.font");//NOI18N
String bodyRule = "body { font-family: " + font.getFamily() + "; " + //NOI18N
"font-size: " + font.getSize() + "pt; color: " + Integer.toHexString( color.getRGB() & 0x00ffffff )+ "; }"; //NOI18N
((HTMLDocument)editorPane.getDocument()).getStyleSheet().addRule(bodyRule);
editorPane.setOpaque(false);
editorPane.setEditable(false);
return editorPane;
}
代码示例来源:origin: stefanhaustein/nativehtml
void configureEditor(JEditorPane editor) {
final Dictionary<URL, Image> imageCache = ((SwingPlatform) document.getPlatform()).imageCache;
editor.setEditorKit(new HTMLEditorKit() {
@Override
public javax.swing.text.Document createDefaultDocument() {
HTMLDocument result = (HTMLDocument) super.createDefaultDocument();
try {
result.setBase(document.getUrl().toURL());
} catch (MalformedURLException e) {
e.printStackTrace();
}
result.putProperty("imageCache", imageCache);
return result;
}
});
editor.setMargin(new Insets(0,0,0,0));
editor.setOpaque(false);
editor.setEditable(false);
}
代码示例来源:origin: onyxbits/dummydroid
public CheckinForm(NavigateAction forward, NavigateAction backward) {
super(forward, backward);
result = new HypertextPane("");
result.setPreferredSize(new Dimension(300, 200));
result.setOpaque(false);
progress = new JProgressBar();
progress.setIndeterminate(true);
progress.setVisible(false);
setLayout(new BorderLayout());
add(result, BorderLayout.CENTER);
add(progress, BorderLayout.NORTH);
}
代码示例来源:origin: triplea-game/triplea
private static void doShowSuccessConfirmation(final URI reportLinkCreated) {
final JEditorPane editorPane = new JEditorPane("text/html",
String.format("Upload success, report created:<br/><br/><a href='%s'>%s</a>",
reportLinkCreated, reportLinkCreated));
editorPane.setEditable(false);
editorPane.setOpaque(false);
editorPane.addHyperlinkListener(e -> {
if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) {
OpenFileUtility.openUrl(e.getURL().toString());
}
});
final JPanel messageToShow = JPanelBuilder.builder()
.borderEmpty(10)
.add(editorPane)
.build();
// parentComponent == null to avoid pop-up from appearing behind other windows
JOptionPane.showMessageDialog(null, messageToShow, "Report Uploaded Successfully", JOptionPane.INFORMATION_MESSAGE);
}
}
代码示例来源:origin: protegeproject/protege
/**
* Creates a JEditorPane suitable for showing HTML content
* @param hyperlinkListener an optional hyperlink listener
*/
public static JEditorPane createHTMLPane(HyperlinkListener hyperlinkListener) {
JEditorPane editorPane = new JEditorPane(new HTMLEditorKit().getContentType(), "");
// set the font to the same as a normal label
Font font = UIManager.getFont("Label.font");
String bodyRule = "body { font-family: " + font.getFamily() + "; " +
"font-size: " + font.getSize() + "pt; }";
((HTMLDocument) editorPane.getDocument()).getStyleSheet().addRule(bodyRule);
editorPane.setEditable(false);
editorPane.setOpaque(false);
if (hyperlinkListener != null){
editorPane.addHyperlinkListener(hyperlinkListener);
}
return editorPane;
}
代码示例来源:origin: edu.stanford.protege/org.protege.editor.core.application
/**
* Creates a JEditorPane suitable for showing HTML content
* @param hyperlinkListener an optional hyperlink listener
*/
public static JEditorPane createHTMLPane(HyperlinkListener hyperlinkListener) {
JEditorPane editorPane = new JEditorPane(new HTMLEditorKit().getContentType(), "");
// set the font to the same as a normal label
Font font = UIManager.getFont("Label.font");
String bodyRule = "body { font-family: " + font.getFamily() + "; " +
"font-size: " + font.getSize() + "pt; }";
((HTMLDocument) editorPane.getDocument()).getStyleSheet().addRule(bodyRule);
editorPane.setEditable(false);
editorPane.setOpaque(false);
if (hyperlinkListener != null){
editorPane.addHyperlinkListener(hyperlinkListener);
}
return editorPane;
}
代码示例来源:origin: org.protege/protege-editor-core-application
/**
* Creates a JEditorPane suitable for showing HTML content
* @param hyperlinkListener an optional hyperlink listener
*/
public static JEditorPane createHTMLPane(HyperlinkListener hyperlinkListener) {
JEditorPane editorPane = new JEditorPane(new HTMLEditorKit().getContentType(), "");
// set the font to the same as a normal label
Font font = UIManager.getFont("Label.font");
String bodyRule = "body { font-family: " + font.getFamily() + "; " +
"font-size: " + font.getSize() + "pt; }";
((HTMLDocument) editorPane.getDocument()).getStyleSheet().addRule(bodyRule);
editorPane.setEditable(false);
editorPane.setOpaque(false);
if (hyperlinkListener != null){
editorPane.addHyperlinkListener(hyperlinkListener);
}
return editorPane;
}
代码示例来源:origin: org.swinglabs.swingx/swingx-core
disclaimerText.setVisible(false);
disclaimerText.setEditable(false);
disclaimerText.setOpaque(false);
disclaimerText.putClientProperty(JXEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
if (f != null) {
代码示例来源:origin: org.swinglabs.swingx/swingx-all
disclaimerText.setVisible(false);
disclaimerText.setEditable(false);
disclaimerText.setOpaque(false);
disclaimerText.putClientProperty(JXEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
if (f != null) {
代码示例来源:origin: com.tourapp.tour/com.tourapp.tour.booking.entry
/**
* Set up all the screen fields.
*/
public void setupSFields()
{
ScreenLocation itsLocation = null;
itsLocation = this.getNextLocation(ScreenConstants.FLUSH_LEFT, ScreenConstants.FILL_REMAINDER);
// NOTE NOTE NOTE. fieldConverter is only used to create the control, since the actual text is created from reading the URL
BaseField fieldConverter = this.getScreenRecord().getField(BookingItineraryScreenRecord.ITINERARY_TEXT);
m_sHtmlView = new SHtmlView(itsLocation, this, fieldConverter, ScreenConstants.DONT_DISPLAY_FIELD_DESC, null);
ScreenFieldView sView = m_sHtmlView.getScreenFieldView();
if (sView instanceof org.jbundle.base.screen.view.swing.VScreenField)
{ // Swing - get rid of scrollers and make transparent and get rid of the border.
javax.swing.JEditorPane htmlPane = (javax.swing.JEditorPane)sView.getControl();
htmlPane.setEditable(false);
((org.jbundle.base.screen.view.swing.VHtmlView)sView).setupHyperLinkListener(this);
htmlPane.setOpaque(false);
java.awt.Component component = (java.awt.Component)sView.getControl(DBConstants.CONTROL_TOP);
((javax.swing.JScrollPane)component).setBorder(null);
((javax.swing.JScrollPane)component).setOpaque(false);
((javax.swing.JScrollPane)component).getViewport().setOpaque(false);
}
fieldConverter.removeComponent(m_sHtmlView);
m_sHtmlView.setConverter(null);
}
/**
内容来源于网络,如有侵权,请联系作者删除!