本文整理了Java中javax.swing.JTextPane.setOpaque()
方法的一些代码示例,展示了JTextPane.setOpaque()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextPane.setOpaque()
方法的具体详情如下:
包路径:javax.swing.JTextPane
类名称:JTextPane
方法名:setOpaque
暂无
代码示例来源:origin: magefree/mage
lblMessage.setCursor(null);
lblMessage.setFocusable(false);
lblMessage.setOpaque(false);
jScrollPane1.setViewportView(lblMessage);
代码示例来源:origin: magefree/mage
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
text = new javax.swing.JTextPane();
setMinimumSize(getPreferredSize());
setOpaque(false);
setPreferredSize(new Dimension(dimension.frameWidth, dimension.frameHeight));
setLayout(null);
jScrollPane1.setBorder(null);
jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPane1.setFocusable(false);
jScrollPane1.setOpaque(false);
text.setBorder(null);
text.setEditable(false);
text.setFont(new java.awt.Font("Arial", 0, 9));
text.setFocusable(false);
text.setOpaque(false);
jScrollPane1.setViewportView(text);
add(jScrollPane1);
jScrollPane1.setBounds(20, 110, 130, 100);
jScrollPane1.setBounds(new Rectangle(dimension.contentXOffset, dimension.textYOffset, dimension.textWidth, dimension.textHeight));
}// </editor-fold>//GEN-END:initComponents
代码示例来源:origin: magefree/mage
/**
* This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
scrollPane = new javax.swing.JScrollPane();
text = new javax.swing.JTextPane();
setFocusable(false);
setMinimumSize(new Dimension(FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT));
setName("bigCardPanel"); // NOI18N
setOpaque(false);
setPreferredSize(getMinimumSize());
setLayout(null);
scrollPane.setBorder(null);
scrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane.setOpaque(false);
text.setEditable(false);
text.setFocusable(false);
text.setOpaque(false);
scrollPane.setViewportView(text);
add(scrollPane);
scrollPane.setBounds(20, 230, 210, 120);
scrollPane.setBounds(new Rectangle(CONTENT_MAX_XOFFSET, TEXT_MAX_YOFFSET, TEXT_MAX_WIDTH, TEXT_MAX_HEIGHT));
}// </editor-fold>//GEN-END:initComponents
代码示例来源:origin: stackoverflow.com
JTextPane text = new JTextPane();
SimpleAttributeSet attributes = new SimpleAttributeSet();
StyleConstants.setAlignment(attributes, StyleConstants.ALIGN_RIGHT);
StyleConstants.setFontFamily(attributes, "Default");
text.setParagraphAttributes(attributes, true);
text.setEditable(false);
text.setOpaque(false);
text.setText("Search\nBy:");
代码示例来源:origin: stackoverflow.com
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
JFrame mainFrame = new JFrame("test");
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Opaque (default behaviour)
Container pane = mainFrame.getContentPane();
JTextPane jtp1 = new JTextPane();
jtp1.setOpaque(true);
jtp1.setText("this JTextPane is not transparent");
jtp1.setEditable(false);
//Not opaque (ie transparent)
JTextPane jtp2 = new JTextPane();
jtp2.setOpaque(false);
jtp2.setText("this JTextPane is transparent");
jtp2.setEditable(false);
pane.setLayout(new FlowLayout());
pane.setBackground(Color.LIGHT_GRAY);
pane.add(jtp1);
pane.add(jtp2);
mainFrame.pack();
mainFrame.setVisible(true);
}
});
}
代码示例来源:origin: eu.mihosoft.vrl/vrl
/**
* Constructor.
*/
public VTextPane() {
setBackground(VSwingUtil.TRANSPARENT_COLOR);
setBorder(new EmptyBorder(3, 3, 3, 5));
super.setOpaque(false);
// setTabs(4);
setFont(new Font("SansSerif", Font.PLAIN, 11));
}
代码示例来源:origin: com.metsci.glimpse/glimpse-wizard
public DescriptionWizardPage( Object id, Object parentId, String title, String descriptionFile )
{
super( id, parentId, title );
this.descriptionFile = descriptionFile;
this.container.setLayout( new MigLayout( ) );
JTextPane descriptionArea = new JTextPane( );
descriptionArea.setEditable( false );
descriptionArea.setOpaque( false );
URL url = getDescriptionResource( descriptionFile );
try
{
descriptionArea.setPage( url );
}
catch ( IOException e )
{
descriptionArea.setText( String.format( "Error: Unable to load page description from: %s", descriptionFile ) );
}
this.container.add( descriptionArea, "split, span, pushx, growx, wrap" );
this.container.add( new JSeparator( SwingConstants.HORIZONTAL ), "split, span, gap 0 0 10 10, pushx, growx, wrap" );
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-mobility-cldcplatform
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
jTextPane1 = new javax.swing.JTextPane();
setLayout(new java.awt.GridBagLayout());
jTextPane1.setEditable(false);
jTextPane1.setOpaque(false);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.insets = new java.awt.Insets(12, 0, 12, 12);
add(jTextPane1, gridBagConstraints);
}
// </editor-fold>//GEN-END:initComponents
代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij
/**
* Initializes some UI components in this panel that require special set-up.
*
* <p>This is automatically called by the IDEA SDK and should not be directly invoked.
*/
private void createUIComponents() {
descriptionTextPane = new JTextPane();
descriptionTextPane.setOpaque(false);
linksTextPane = new JTextPane();
linksTextPane.setOpaque(false);
linksTextPane.addHyperlinkListener(new BrowserOpeningHyperLinkListener());
apiManagementPanel = new JPanel();
apiManagementPanel.setBorder(
IdeBorderFactory.createTitledBorder(
GoogleCloudApisMessageBundle.message("cloud.apis.management.section.title")));
managementWarningTextPane = new JTextPane();
managementWarningTextPane.setOpaque(false);
warningLabel = new JLabel();
warningLabel.setIcon(General.Information);
enableApiCheckbox = new JCheckBox();
enableApiCheckbox.addActionListener(
event ->
currentCloudApiManagementSpec.setShouldEnable(
((JCheckBox) event.getSource()).isSelected()));
}
代码示例来源:origin: eu.mihosoft.vrl/vrl
private void enableHTML() {
messageField.setContentType("text/html");
messageField.setOpaque(false);
messageField.setEditable(false);
messageField.setEditorKit(new VHTMLEditorKit());
}
代码示例来源:origin: net.sf.ingenias/ingeniasjgraphmod
/**
* Constructs a new vertex renderer.
*/
public MultiLineVertexRenderer() {
textPane.setOpaque(false);
textPane.setBorder(BorderFactory.createEmptyBorder(INSET, INSET, INSET,
INSET));
// Makes sure the heavyweights is never returned directly,
// so that the real component is never touched directly.
wrapperRenderer = new JComponent() {
public void paint(Graphics g) {
if (showHeavyweight) {
valueComponent.setSize(getSize());
if (!isEditing)
valueComponent.paint(g);
} else {
g.drawRect(0, 0, getWidth() - 1, getHeight() - 1);
g.drawLine(0, 0, getWidth() - 1, getHeight() - 1);
g.drawLine(getWidth() - 1, 0, 0, getHeight() - 1);
}
}
};
wrapperRenderer.setDoubleBuffered(false);
}
代码示例来源:origin: MegaMek/megamek
private void setupReportTabs(Client c) {
JTabbedPane tabs = new JTabbedPane();
int numRounds = c.getGame().getRoundCount();
for (int round = 1; round < numRounds; round++) {
String text = c.receiveReport(c.getGame().getReports(round));
JTextPane ta = new JTextPane();
setupStylesheet(ta);
ta.setText("<pre>" + text + "</pre>");
ta.setEditable(false);
ta.setOpaque(false);
tabs.add("Round " + round, new JScrollPane(ta));
}
// add the new current phase tab
JTextPane ta = new JTextPane();
setupStylesheet(ta);
ta.setText("<pre>" + c.roundReport + "</pre>");
ta.setEditable(false);
ta.setOpaque(false);
JScrollPane sp = new JScrollPane(ta);
tabs.add("Phase", sp);
tabs.setSelectedComponent(sp);
getContentPane().add(BorderLayout.CENTER, tabs);
}
代码示例来源:origin: org.languagetool/languagetool-gui-commons
static void showRuleInfoDialog(Component parent, String title, String message, Rule rule, URL matchUrl, ResourceBundle messages, String lang) {
int dialogWidth = 320;
JTextPane textPane = new JTextPane();
textPane.setEditable(false);
textPane.setContentType("text/html");
textPane.setBorder(BorderFactory.createEmptyBorder());
textPane.setOpaque(false);
textPane.setBackground(new Color(0, 0, 0, 0));
Tools.addHyperlinkListener(textPane);
textPane.setSize(dialogWidth, Short.MAX_VALUE);
String messageWithBold = message.replaceAll("<suggestion>", "<b>").replaceAll("</suggestion>", "</b>");
String exampleSentences = getExampleSentences(rule, messages);
String url = "http://community.languagetool.org/rule/show/" + encodeUrl(rule)
+ "?lang=" + lang + "&ref=standalone-gui";
boolean isExternal = rule.getCategory().getLocation() == Category.Location.EXTERNAL;
String ruleDetailLink = rule instanceof FalseFriendPatternRule || isExternal ?
"" : "<a href='" + url + "'>" + messages.getString("ruleDetailsLink") +"</a>";
textPane.setText("<html>"
+ messageWithBold + exampleSentences + formatURL(matchUrl)
+ "<br><br>"
+ ruleDetailLink
+ "</html>");
JScrollPane scrollPane = new JScrollPane(textPane);
scrollPane.setPreferredSize(
new Dimension(dialogWidth, textPane.getPreferredSize().height));
scrollPane.setBorder(BorderFactory.createEmptyBorder());
String cleanTitle = title.replace("<suggestion>", "'").replace("</suggestion>", "'");
JOptionPane.showMessageDialog(parent, scrollPane, cleanTitle,
JOptionPane.INFORMATION_MESSAGE);
}
代码示例来源:origin: edu.stanford.protege/org.protege.editor.owl
textPane.setOpaque(false);
代码示例来源:origin: tinyMediaManager/tinyMediaManager
private void initComponents() {
setLayout(new FormLayout(
new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("50dlu"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("50dlu"),
FormSpecs.RELATED_GAP_COLSPEC, },
new RowSpec[] { FormSpecs.LINE_GAP_ROWSPEC, RowSpec.decode("50dlu"), FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("50dlu"),
RowSpec.decode("default:grow"), FormSpecs.PARAGRAPH_GAP_ROWSPEC, }));
final JTextPane tpGreetingHeader = new JTextPane();
tpGreetingHeader.setEditable(false);
tpGreetingHeader.setOpaque(false);
tpGreetingHeader.setEditorKit(new HTMLEditorKit());
tpGreetingHeader.setText(BUNDLE.getString("wizard.greeting.header")); //$NON-NLS-1$
add(tpGreetingHeader, "2, 2, 7, 1, center, bottom");
JLabel lblLogo = new JLabel("");
lblLogo.setIcon(new Logo(96));
add(lblLogo, "4, 5, default, top");
JTextPane tpGreetingText = new JTextPane();
tpGreetingText.setEditable(false);
tpGreetingText.setText(BUNDLE.getString("wizard.greeting.text")); //$NON-NLS-1$
tpGreetingText.setOpaque(false);
add(tpGreetingText, "6, 5, fill, fill");
}
}
代码示例来源:origin: tinyMediaManager/tinyMediaManager
tpMessage.setOpaque(false);
tpMessage.setEditable(false);
innerPanel.add(tpMessage, "4, 4, fill, fill");
代码示例来源:origin: protegeproject/protege
OWLCellRenderer(OWLEditorKit owlEditorKit, boolean renderExpression, boolean renderIcon, OWLCellRenderer tmp) {
this.owlEditorKit = owlEditorKit;
this.renderExpression = renderExpression;
this.renderIcon = renderIcon;
this.equivalentObjects = new HashSet<>();
iconComponent.setOpaque(false);
textPane = new JTextPane();
textPane.setOpaque(false);
renderingComponent = new OWLCellRendererPanel(new OWLCellRendererLayoutManager());
renderingComponent.add(iconComponent);
renderingComponent.add(textPane);
entityColorProviders = new ArrayList<>();
OWLEntityColorProviderPluginLoader loader = new OWLEntityColorProviderPluginLoader(getOWLModelManager());
for (OWLEntityColorProviderPlugin plugin : loader.getPlugins()) {
try {
OWLEntityColorProvider prov = plugin.newInstance();
prov.initialise();
entityColorProviders.add(prov);
} catch (Exception e) {
logger.error("An error occurred whilst trying to load an OWLEntityColorProviderPlugin", e);
}
}
crossedOutEntities = new HashSet<>();
unsatisfiableNames = new HashSet<>();
boxedNames = new HashSet<>();
prepareStyles();
setupFont();
this.tmp = tmp;
}
代码示例来源:origin: edu.stanford.protege/protege-editor-owl
public OWLCellRenderer(OWLEditorKit owlEditorKit, boolean renderExpression, boolean renderIcon) {
this.owlEditorKit = owlEditorKit;
this.renderExpression = renderExpression;
this.renderIcon = renderIcon;
this.equivalentObjects = new HashSet<>();
iconComponent.setOpaque(false);
textPane = new JTextPane();
textPane.setOpaque(false);
renderingComponent = new OWLCellRendererPanel(new OWLCellRendererLayoutManager());
renderingComponent.add(iconComponent);
renderingComponent.add(textPane);
entityColorProviders = new ArrayList<>();
OWLEntityColorProviderPluginLoader loader = new OWLEntityColorProviderPluginLoader(getOWLModelManager());
for (OWLEntityColorProviderPlugin plugin : loader.getPlugins()) {
try {
OWLEntityColorProvider prov = plugin.newInstance();
prov.initialise();
entityColorProviders.add(prov);
}
catch (Exception e) {
logger.error("An error occurred whilst trying to load an OWLEntityColorProviderPlugin", e);
}
}
crossedOutEntities = new HashSet<>();
unsatisfiableNames = new HashSet<>();
boxedNames = new HashSet<>();
prepareStyles();
setupFont();
}
代码示例来源:origin: eu.mihosoft.vrl/vrl
private void disableHTML() {
messageField.setContentType("text/plain");
final Color color = getStyle().
getBaseValues().getColor(TEXT_COLOR_KEY);
messageField.setForeground(color);
messageField.setOpaque(false);
messageField.setEditable(false);
messageField.setEditorKit(new StyledEditorKit());
}
代码示例来源:origin: omegat-org/omegat
MultilineCellRenderer() {
// textArea.setLineWrap(true);
// textArea.setWrapStyleWord(true);
textArea.setOpaque(true);
checkBox.setHorizontalAlignment(JLabel.CENTER);
checkBox.setBorderPainted(true);
SimpleAttributeSet sas = new SimpleAttributeSet();
StyleConstants.setBackground(sas, Styles.EditorColor.COLOR_ALIGNER_HIGHLIGHT.getColor());
highlight = sas;
}
内容来源于网络,如有侵权,请联系作者删除!