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

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

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

JEditorPane.setBackground介绍

暂无

代码示例

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

private void handleError(String name, Throwable t) {
  StringWriter writer = new StringWriter();
  writer.append("Apache Tika was unable to parse the document\n");
  writer.append("at " + name + ".\n\n");
  writer.append("The full exception stack trace is included below:\n\n");
  t.printStackTrace(new PrintWriter(writer));
  JEditorPane editor =
    new JEditorPane("text/plain", writer.toString());
  editor.setEditable(false);
  editor.setBackground(Color.WHITE);
  editor.setCaretPosition(0);
  editor.setPreferredSize(new Dimension(600, 400));
  JDialog dialog = new JDialog(this, "Apache Tika error");
  dialog.add(new JScrollPane(editor));
  dialog.pack();
  dialog.setVisible(true);
}

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

private void addWelcomeCard(JPanel panel, String name) {
  try {
    JEditorPane editor =
      new JEditorPane(TikaGUI.class.getResource("welcome.html"));
    editor.setContentType("text/html");
    editor.setEditable(false);
    editor.setBackground(Color.WHITE);
    editor.setTransferHandler(new ParsingTransferHandler(
        editor.getTransferHandler(), this));
    panel.add(new JScrollPane(editor), name);
  } catch (IOException e) {
    e.printStackTrace();
  }
}

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

private void textDialog(String title, URL resource) {
  try {
    JDialog dialog = new JDialog(this, title);
    JEditorPane editor = new JEditorPane(resource);
    editor.setContentType("text/html");
    editor.setEditable(false);
    editor.setBackground(Color.WHITE);
    editor.setPreferredSize(new Dimension(400, 250));
    editor.addHyperlinkListener(this);
    dialog.add(editor);
    dialog.pack();
    dialog.setVisible(true);
  } catch (IOException e) {
    e.printStackTrace();
  }
}

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

public void hyperlinkUpdate(HyperlinkEvent e) {
  if (e.getEventType() == EventType.ACTIVATED) {
    try {
      URL url = e.getURL();
      try (InputStream stream = url.openStream()) {
        JEditorPane editor =
          new JEditorPane("text/plain", IOUtils.toString(stream, UTF_8));
        editor.setEditable(false);
        editor.setBackground(Color.WHITE);
        editor.setCaretPosition(0);
        editor.setPreferredSize(new Dimension(600, 400));
        String name = url.toString();
        name = name.substring(name.lastIndexOf('/') + 1);
        JDialog dialog = new JDialog(this, "Apache Tika: " + name);
        dialog.add(new JScrollPane(editor));
        dialog.pack();
        dialog.setVisible(true);
      }
    } catch (IOException exception) {
      exception.printStackTrace();
    }
  }
}

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

private JEditorPane addCard(JPanel panel, String type, String name) {
  JEditorPane editor = new JTextPane();
  editor.setBackground(Color.WHITE);
  editor.setContentType(type);
  editor.setTransferHandler(new ParsingTransferHandler(
      editor.getTransferHandler(), this));
  panel.add(new JScrollPane(editor), name);
  return editor;
}

代码示例来源:origin: Nilhcem/FakeSMTP

ep.setBackground(label.getBackground());

代码示例来源:origin: magefree/mage

cardInfoPane.setBackground(new Color(0, 0, 0, 0));

代码示例来源:origin: bobbylight/RSyntaxTextArea

textArea.setBackground(TipUtil.getToolTipBackground());

代码示例来源:origin: org.apache.airavata/airavata-xbaya-gui

/**
 * Creates a ComponentViewer.
 */
public ComponentViewer() {
  super();
  this.currentComponent = null;
  this.editorPane = new JEditorPane();
  this.editorPane.setEditable(false);
  this.editorPane.setBackground(Color.WHITE);
  this.editorPane.setContentType(XmlConstants.CONTENT_TYPE_HTML);
  this.editorPane.setText(DEFAULT_HTML_MESSAGE);
}

代码示例来源:origin: org.apache.airavata/airavata-xbaya-gui

private JEditorPane createEditorPane() {
  JEditorPane editorPane = new JEditorPane();
  editorPane.setMinimumSize(SwingUtil.MINIMUM_SIZE);
  editorPane.setEditable(false);
  editorPane.setBackground(Color.WHITE);
  editorPane.setContentType(XmlConstants.CONTENT_TYPE_HTML);
  return editorPane;
}

代码示例来源:origin: sing-group/GC4S

private JEditorPane getTestsInfo() {
  JEditorPane testsInfo = new JEditorPane();
  testsInfo.setContentType("text/html");
  testsInfo.setEditable(false);
  testsInfo.setText(getTestsText());
  testsInfo.setBorder(createEmptyBorder(10, 5, 10, 5));
  testsInfo.setBackground(getColor("Panel.background"));
  return testsInfo;
}

代码示例来源:origin: org.jvnet.hudson.plugins.hudsontrayapp/client-common

/**
 * This method initializes descriptionEditorPane    
 *     
 * @return javax.swing.JEditorPane    
 */
private JEditorPane getDescriptionEditorPane() {
  if (descriptionEditorPane == null) {
    descriptionEditorPane = new JEditorPane();
    descriptionEditorPane.setSize(new Dimension(546, 128));
    descriptionEditorPane.setBackground(SystemColor.control);
    descriptionEditorPane.setPreferredSize(new Dimension(48, 48));
    descriptionEditorPane.setText("");
    descriptionEditorPane.setEditable(false);
    descriptionEditorPane.setContentType("text/html");
    descriptionEditorPane.setFont(new Font("SansSerif", Font.PLAIN, 12));
  }
  return descriptionEditorPane;
}

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

JEditorPane area = new JEditorPane();
Color bgColor = Color.BLACK;
UIDefaults defaults = new UIDefaults();
defaults.put("EditorPane[Enabled].backgroundPainter", bgColor);
area.putClientProperty("Nimbus.Overrides", defaults);
area.putClientProperty("Nimbus.Overrides.InheritDefaults", true);
area.setBackground(bgColor);

代码示例来源:origin: org.nuiton/nuiton-widgets

public SDocEditor() {
  syntaxSupport = SyntaxSupport.getInstance();
  
  // fix background to white (fix bug in nimbus)
  editor.setBackground(Color.WHITE);
  
  // if you want line numbering
  scrollPane.setRowHeaderView(new Gutter(editor, scrollPane));
}

代码示例来源:origin: io.ultreia.java4all.jaxx/jaxx-widgets-extra

public SDocEditor() {
  syntaxSupport = SyntaxSupport.getInstance();
  // fix background to white (fix bug in nimbus)
  editor.setBackground(Color.WHITE);
  // if you want line numbering
  scrollPane.setRowHeaderView(new Gutter(editor, scrollPane));
}

代码示例来源:origin: org.bitbucket.goalhub.simpleide/jedit

PluginDetailPanel()
{
  setLayout(new BorderLayout());
  pluginDetail = new JEditorPane();
  pluginDetail.setEditable(false);
  pluginDetail.setContentType("text/html");
  pluginDetail.setBackground(jEdit.getColorProperty("view.bgColor"));
  pluginDetail.setForeground(jEdit.getColorProperty("view.fgColor"));
  pluginDetail.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, true);
  title = new JLabel();
  add(title, BorderLayout.NORTH);
  JScrollPane scroll = new JScrollPane(pluginDetail);
  scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  add(scroll);
} //}}}

代码示例来源:origin: UNIVALI-LITE/Portugol-Studio

@Override
public void configurarCores() {
  setBackground(ColorController.FUNDO_MEDIO);
  if(Configuracoes.getInstancia().isTemaDark()){
    rotulo.setForeground(ColorController.AMARELO);
  }else{
    rotulo.setForeground(ColorController.FUNDO_ESCURO);
  }
  
  rotuloVAtual.setForeground(ColorController.COR_LETRA);
  rotuloNovaV.setForeground(ColorController.COR_LETRA);
  labelAba.setForeground(ColorController.COR_LETRA);
  labelAba.setBackground(ColorController.FUNDO_CLARO);
  jEditorPane1.setBackground(ColorController.FUNDO_CLARO);
  jEditorPane1.setForeground(ColorController.COR_LETRA);
  
  if(WeblafUtils.weblafEstaInstalado())
  {
    WeblafUtils.configurarBotao(botaoBaixar, ColorController.AMARELO, ColorController.FUNDO_ESCURO, ColorController.FUNDO_CLARO, ColorController.COR_LETRA, 5, true);            
    WeblafUtils.configuraWebLaf(jScrollPane1);
  }
}

代码示例来源:origin: igniterealtime/Spark

/**
 * Construct the RetryPanel.
 */
public ReconnectPanel() {
  setLayout(new GridBagLayout());
  // Init Components
  pane = new JEditorPane();
  pane.setBackground(Color.white);
  pane.setEditorKit(new HTMLEditorKit());
  pane.setEditable(false);
  _icon = new JLabel(SparkRes.getImageIcon(SparkRes.SMALL_CHECK));
  layoutComponents();
  setBackground(Color.white);
  _icon.setText(Res.getString("button.reconnect2"));
  SparkManager.getConnection().addConnectionListener(this);
}

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

JEditorPane dtrpnTypeTextHere = new JEditorPane();
   dtrpnTypeTextHere.setContentType("type/normal");
   dtrpnTypeTextHere.setToolTipText("");
   dtrpnTypeTextHere.setFont(new Font("Arial", Font.PLAIN, 16));
   dtrpnTypeTextHere.setForeground(Color.GREEN);
   dtrpnTypeTextHere.setBackground(Color.BLACK);
   dtrpnTypeTextHere.setBounds(10, 23, 1152, 671);
   contentPane.add(dtrpnTypeTextHere);
   int length = dtrpnTypeTextHere.getDocument().getLength();
   String text = dtrpnTypeTextHere.getDocument().getText(0, length);

代码示例来源:origin: UNIVALI-LITE/Portugol-Studio

@Override
public void configurarCores() {
  painelSelecionadorPlugins.setBackground(ColorController.FUNDO_MEDIO);
  painelPluginsDisponiveis.setBackground(ColorController.FUNDO_MEDIO);
  editorStyleSet(painelEditorTutorial);
  painelEditorTutorial.setBackground(ColorController.FUNDO_CLARO);
  painelEditorTutorial.setForeground(ColorController.COR_LETRA);
  setBackground(ColorController.FUNDO_MEDIO);
  if (WeblafUtils.weblafEstaInstalado()) {
    WeblafUtils.configuraWebLaf(scrollPlugins);
    WeblafUtils.configuraWebLaf(scrollTutorial);
    WeblafUtils.configurarBotao(botaoInstalarPlugins, ColorController.FUNDO_ESCURO, ColorController.COR_LETRA_TITULO, ColorController.FUNDO_CLARO, ColorController.COR_LETRA, 7, true);            
    WeblafUtils.configurarBotao(botaoSelecionarTodos, ColorController.FUNDO_ESCURO, ColorController.COR_LETRA_TITULO, ColorController.FUNDO_CLARO, ColorController.COR_LETRA, 7, true);
  }
}
/**

相关文章

JEditorPane类方法