javax.swing.JTextPane.setBackground()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中javax.swing.JTextPane.setBackground()方法的一些代码示例,展示了JTextPane.setBackground()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextPane.setBackground()方法的具体详情如下:
包路径:javax.swing.JTextPane
类名称:JTextPane
方法名:setBackground

JTextPane.setBackground介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

JTextPane f = new JTextPane();
f.setContentType("text/html"); // let the text pane know this is what you want
f.setText("<html>Hello World</html>"); // showing off
f.setEditable(false); // as before
f.setBackground(null); // this is the same as a JLabel
f.setBorder(null); // remove the border

代码示例来源:origin: marytts/marytts

jTextPane_nextSentence.setBackground(new java.awt.Color(245, 245, 245));
jTextPane_nextSentence.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jTextPane_nextSentence.setEditable(false);

代码示例来源:origin: marytts/marytts

jTextPane_nextSentence.setBackground(new java.awt.Color(245, 245, 245));
jTextPane_nextSentence.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jTextPane_nextSentence.setFont(new java.awt.Font("Tahoma", 0, 24));

代码示例来源:origin: dboissier/mongo4idea

void notifyOnErrorForOperator(final JComponent component, Exception ex) {
  String message;
  if (ex instanceof JSONParseException) {
    message = StringUtils.removeStart(ex.getMessage(), "\n");
  } else {
    message = String.format("%s: %s", ex.getClass().getSimpleName(), ex.getMessage());
  }
  final NonOpaquePanel nonOpaquePanel = new NonOpaquePanel();
  JTextPane textPane = Messages.configureMessagePaneUi(new JTextPane(), message);
  textPane.setFont(COURIER_FONT);
  textPane.setBackground(MessageType.ERROR.getPopupBackground());
  nonOpaquePanel.add(textPane, BorderLayout.CENTER);
  nonOpaquePanel.add(new JLabel(MessageType.ERROR.getDefaultIcon()), BorderLayout.WEST);
  UIUtil.invokeLaterIfNeeded(() ->
      JBPopupFactory.getInstance().createBalloonBuilder(nonOpaquePanel)
          .setFillColor(MessageType.ERROR.getPopupBackground())
          .createBalloon()
          .show(new RelativePoint(component, new Point(0, 0)), Balloon.Position.above)
  );
}

代码示例来源:origin: apache/pdfbox

@Override
  public void actionPerformed(ActionEvent e)
  {
    if (showingDetails)
    {
      main.remove(details);
      main.validate();
      main.setPreferredSize(MESSAGE_SIZE);
    }
    else
    {
      if (details == null)
      {
        details = createDetailedMessage(error);
        StringBuilder buffer = new StringBuilder();
        stacktrace.setText(generateStackTrace(error, buffer).toString());
        stacktrace.setCaretPosition(0);
        stacktrace.setBackground(main.getBackground());
        stacktrace.setPreferredSize(STACKTRACE_SIZE);
      }
      main.add(details, BorderLayout.CENTER);
      main.validate();
      main.setPreferredSize(TOTAL_SIZE);
    }
    showingDetails = !showingDetails;
    showDetails.setText(showingDetails ? "<< Hide Details" : "Show Details >>");
    ErrorDialog.this.pack();
  }
});

代码示例来源:origin: eu.mihosoft.vrl/vrl

/**
 * At time of writing this method does not work as expected (Java 1.6.x).
 * Therefore use {@link #setBackgroundColor()} instead
 * @param background the background to set
 */
@Override
public final void setBackground(Color background) {
  super.setBackground(background);
}

代码示例来源:origin: sanity/tahrir

private JTextPane setTextPane(final JTextPane messageTextPane)
{
  messageTextPane.setBackground(Color.WHITE);
  messageTextPane.setEditable(false);
  return messageTextPane;
}
private void addTextPane(final BroadcastMessage bm, TrUI mainWindow) {

代码示例来源:origin: zgqq/mah

private void applyBackgroundToMiddlePanel(Color color) {
  this.text.setBackground(color);
  this.container.setBackground(color);
  this.middlePanel.setBackground(color);
}

代码示例来源:origin: stackoverflow.com

JTextPane jtp = new JTextPane();
jtp.setBackground(Color.white);
jtp.setText("text to print");
boolean show = true;
try {
  jtp.print(null, null, show, null, null, show);
} catch (java.awt.print.PrinterException ex) {
  ex.printStackTrace();
}

代码示例来源:origin: org.apache.jmeter/ApacheJMeter_components

private JTextPane getBaseTextPane() {
  base = new JTextPane();
  base.setEditable(false);
  base.setBackground(getBackground());
  return base;
}

代码示例来源:origin: stackoverflow.com

JTextPane jtp = new JTextPane();
jtp.setBackground(Color.white);
jtp.setText(text);//Set text to print.
try {
  jtp.print(null, null, true, null, null, true);
} catch (java.awt.print.PrinterException ex) {
  ex.printStackTrace();
}

代码示例来源:origin: stackoverflow.com

JTextPane f = new JTextPane();
f.setContentType("text/html"); // let the text pane know this is what you want
f.setEditable(false); // as before
f.setBackground(null); // this is the same as a JLabel
f.setBorder(null); // remove the border

代码示例来源:origin: org.owasp.jbrofuzz/jbrofuzz

JTextPane createSimplePane() {
  JTextPane textPane = new JTextPane();
  textPane.setMargin(new Insets(1, 1, 1, 1));
  textPane.setBackground(Color.WHITE);
  textPane.setForeground(Color.BLACK);
  return textPane;
}

代码示例来源:origin: org.onebusaway/onebusaway-quickstart-mains

/**
 * Create the panel.
 */
public WelcomePanel() {
 setLayout(new MigLayout("", "[450px]", "[grow]"));
 
 JTextPane welcomeText = new JTextPane();
 welcomeText.setEditable(false);
 welcomeText.setBackground(UIManager.getColor("control"));
 welcomeText.setText("Welcome to the OneBusAway Quick-Start wizard.  This wizard will walk you through configuring the OneBusAway application with your transit data and starting the application.");
 add(welcomeText, "cell 0 0,grow");
}

代码示例来源:origin: OneBusAway/onebusaway-application-modules

/**
 * Create the panel.
 */
public WelcomePanel() {
 setLayout(new MigLayout("", "[450px]", "[grow]"));
 
 JTextPane welcomeText = new JTextPane();
 welcomeText.setEditable(false);
 welcomeText.setBackground(UIManager.getColor("control"));
 welcomeText.setText("Welcome to the OneBusAway Quick-Start wizard.  This wizard will walk you through configuring the OneBusAway application with your transit data and starting the application.");
 add(welcomeText, "cell 0 0,grow");
}

代码示例来源:origin: zgqq/mah

private void decorateContent(SwingLayoutTheme layoutTheme) {
    String contentColor = layoutTheme.findProperty("text-foreground-color");
    String contentBackgroundColor = layoutTheme.findProperty("text-background-color");
    this.content.setForeground(Color.decode(contentColor));
    this.content.setBackground(Color.decode(contentBackgroundColor));
  }
}

代码示例来源:origin: zgqq/mah

private void decorateDescription(SwingLayoutTheme layoutTheme) {
  String descriptionColor = layoutTheme.findProperty("text-foreground-color");
  this.description.setForeground(Color.decode(descriptionColor));
  String descriptionBackgroundColor = layoutTheme.findProperty("text-background-color");
  this.description.setBackground(Color.decode(descriptionBackgroundColor));
}

代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij

public CloudSdkPanel() {
 warningMessage.setVisible(false);
 warningMessage.setBackground(cloudSdkPanel.getBackground());
 warningMessage.addHyperlinkListener(new BrowserOpeningHyperLinkListener());
 warningIcon.setVisible(false);
 warningIcon.setIcon(RunConfigurations.ConfigurationWarning);
 checkManagedSdkFeatureStatus();
 initEvents();
}

代码示例来源:origin: dboissier/jenkins-control-plugin

private void initDebugTextPane() {
  HTMLEditorKit htmlEditorKit = new HTMLEditorKit();
  HTMLDocument htmlDocument = new HTMLDocument();
  debugTextPane.setEditable(false);
  debugTextPane.setBackground(Color.WHITE);
  debugTextPane.setEditorKit(htmlEditorKit);
  htmlEditorKit.install(debugTextPane);
  debugTextPane.setDocument(htmlDocument);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-makeproject

/** Creates new form SelectModePanel */
public SelectModePanel(SelectModeDescriptorPanel controller) {
  this.controller = controller;
  initComponents();
  instructions.setEditorKit(new HTMLEditorKit());
  instructions.setBackground(instructionPanel.getBackground());
  disableHostSensitiveComponents();
  refreshRunnable = new RefreshRunnable();
  refreshSourceFolderTask = RP2.create(refreshRunnable);
  addListeners();
}

相关文章

JTextPane类方法