javax.swing.JTextArea.getBackground()方法的使用及代码示例

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

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

JTextArea.getBackground介绍

暂无

代码示例

代码示例来源:origin: JetBrains/ideavim

private ExOutputPanel(@NotNull Editor editor) {
 myEditor = editor;
 // Create a text editor for the text and a label for the prompt
 BorderLayout layout = new BorderLayout(0, 0);
 setLayout(layout);
 add(myScrollPane, BorderLayout.CENTER);
 add(myLabel, BorderLayout.SOUTH);
 setFontForElements();
 myText.setBorder(null);
 myScrollPane.setBorder(null);
 myLabel.setForeground(myText.getForeground());
 myLabel.setBackground(myText.getBackground());
 setForeground(myText.getForeground());
 setBackground(myText.getBackground());
 myText.setEditable(false);
 setBorder(BorderFactory.createEtchedBorder());
 myAdapter = new ComponentAdapter() {
  public void componentResized(ComponentEvent e) {
   positionPanel();
  }
 };
 // Setup some listeners to handle keystrokes
 MoreKeyListener moreKeyListener = new MoreKeyListener(this);
 addKeyListener(moreKeyListener);
 myText.addKeyListener(moreKeyListener);
}

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

private JComponent createEmptyContent() {
  JButton res = new JButton(I18n.getMessage("NoProjectOpen")); // NOI18N
  res.setEnabled(false);
  res.setBorder(BorderFactory.createEmptyBorder());
  res.setBackground(new JTextArea().getBackground());
  return res;
}

代码示例来源:origin: senbox-org/snap-desktop

public void careForEmptyLines(Object value, JTextArea textArea) {
    if (StringUtils.isNullOrEmpty(value.toString())) {
      // imbecile code, but necessary in order to show empty lines
      textArea.setText("____");
      textArea.setForeground(textArea.getBackground());
    }
  }
};

代码示例来源:origin: bcdev/beam

public void careForEmptyLines(Object value, JTextArea textArea) {
    if (StringUtils.isNullOrEmpty(value.toString())) {
      // imbecile code, but necessary in order to show empty lines
      textArea.setText("____");
      textArea.setForeground(textArea.getBackground());
    }
  }
};

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

/** 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() {
  jButton1 = new javax.swing.JButton();
  setLayout(new java.awt.BorderLayout());
  jButton1.setBackground(new JTextArea().getBackground());
  org.openide.awt.Mnemonics.setLocalizedText(jButton1, org.openide.util.NbBundle.getMessage(HierarchyTopComponent.class, "NoViewAvailable")); // NOI18N
  jButton1.setBorderPainted(false);
  jButton1.setEnabled(false);
  add(jButton1, java.awt.BorderLayout.CENTER);
}// </editor-fold>//GEN-END:initComponents

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-editor

/** 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() {
  jButton1 = new javax.swing.JButton();
  setLayout(new java.awt.BorderLayout());
  jButton1.setBackground(new JTextArea().getBackground());
  org.openide.awt.Mnemonics.setLocalizedText(jButton1, org.openide.util.NbBundle.getMessage(PhpHierarchyTopComponent.class, "NoViewAvailable")); // NOI18N
  jButton1.setBorderPainted(false);
  jButton1.setEnabled(false);
  add(jButton1, java.awt.BorderLayout.CENTER);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables

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

textArea.append("new text here");
JPanel panel = new JPanel(new BorderLayout());
panel.setBackground(textArea.getBackground());
panel.setBorder(textArea.getBorder());
textArea.setBorder(null);

代码示例来源:origin: triplea-game/triplea

label.setWrapStyleWord(true);
label.setLocation(0, 0);
dialog.setBackground(label.getBackground());
dialog.setLayout(new BorderLayout());
final JScrollPane pane = new JScrollPane();

代码示例来源:origin: triplea-game/triplea

label.setWrapStyleWord(true);
label.setLocation(0, 0);
dialog.setBackground(label.getBackground());
dialog.setLayout(new BorderLayout());
final JScrollPane pane = new JScrollPane();

代码示例来源:origin: org.tentackle/tentackle-swing

Color background = c.getBackground();
if (background instanceof UIResource) {
 String prefix = getPropertyPrefix();

代码示例来源:origin: pentaho/pentaho-reporting

@Test
public void testInitializeErrorFormattedValue() throws Exception {
 final CountDownLatch latch = new CountDownLatch( 1 );
 doReturn( "error value" ).when( updateContext ).getParameterValue( ENTRY_NAME );
 comp.initialize();
 SwingUtilities.invokeLater( () -> latch.countDown() );
 latch.await( 100, TimeUnit.MILLISECONDS );
 JTextArea textArea = findTextArea( comp );
 assertThat( textArea, is( notNullValue() ) );
 assertThat( textArea.getText(), is( equalTo( "error value" ) ) );
 assertThat( textArea.getBackground(), is( equalTo( Color.RED ) ) );
 assertThat( comp.getBackground(), is( equalTo( ParameterReportControllerPane.ERROR_COLOR ) ) );
}

代码示例来源:origin: GoldenGnu/jeveassets

importColor = new Color(jText.getBackground().getRGB());

代码示例来源:origin: otros-systems/otroslogviewer

public static RSyntaxTextArea propertiesTextArea(Theme theme) {
  final RSyntaxTextArea editorPane = new RSyntaxTextArea();
  editorPane.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_PROPERTIES_FILE);
  SyntaxScheme scheme = editorPane.getSyntaxScheme();
  scheme.getStyle(Token.RESERVED_WORD).foreground = theme.getColor(ThemeKey.LOG_DETAILS_PROPERTY_KEY);
  scheme.getStyle(Token.OPERATOR).foreground = theme.getColor(ThemeKey.LOG_DETAILS_PROPERTY_KEY);
  scheme.getStyle(Token.VARIABLE).foreground = theme.getColor(ThemeKey.LOG_DETAILS_PROPERTY_VALUE);
  scheme.getStyle(Token.LITERAL_STRING_DOUBLE_QUOTE).foreground = theme.getColor(ThemeKey.LOG_DETAILS_PROPERTY_VALUE);
  scheme.getStyle(Token.COMMENT_EOL).foreground = theme.getColor(ThemeKey.LOG_DETAILS_STACKTRACE_COMMENT);
  editorPane.setBackground(new JTextArea().getBackground());

  Color highlightColor;
  if (theme.themeType().equals(Theme.Type.Light)){
   highlightColor = editorPane.getBackground().darker();
  } else {
   highlightColor = editorPane.getBackground().brighter();
  }
  editorPane.setCurrentLineHighlightColor(highlightColor);
  editorPane.revalidate();
  return editorPane;
 }
}

相关文章

JTextArea类方法