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

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

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

JTextArea.setBorder介绍

暂无

代码示例

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

JTextArea tarea = new JTextArea("program info etc.");
Border border = BorderFactory.createLineBorder(Color.BLACK);
tarea.setBorder(BorderFactory.createCompoundBorder(border, 
      BorderFactory.createEmptyBorder(10, 10, 10, 10)));

代码示例来源:origin: stanfordnlp/CoreNLP

private Box makeTSurgeonScriptArea() {
 Box tsurgeonBox = Box.createHorizontalBox();
 scriptLabel = new JLabel("Tsurgeon script: ");
 tsurgeonScript = new JTextArea();
 tsurgeonScript.setBorder(BorderFactory.createEmptyBorder());
 tsurgeonScript.setFocusTraversalKeysEnabled(true);
 JScrollPane scriptScroller = new JScrollPane(tsurgeonScript);
 scriptScroller.setBorder(BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
 //scriptScroller.setEnabled(tsurgeonEnabled);
 tsurgeonBox.add(scriptLabel);
 tsurgeonBox.add(scriptScroller);
 //tsurgeonBox.setBorder(BorderFactory.createEtchedBorder());
 return tsurgeonBox;
}

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

private JPanel createXPathQueryPanel() {
  JPanel p = new JPanel();
  p.setLayout(new BorderLayout());
  xpathQueryArea.setBorder(BorderFactory.createLineBorder(Color.black));
  makeTextComponentUndoable(xpathQueryArea);
  JScrollPane scrollPane = new JScrollPane(xpathQueryArea);
  scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
  final JButton b = createGoButton();
  JPanel topPanel = new JPanel();
  topPanel.setLayout(new BorderLayout());
  topPanel.add(new JLabel("XPath Query (if any):"), BorderLayout.WEST);
  topPanel.add(createXPathVersionPanel(), BorderLayout.EAST);
  p.add(topPanel, BorderLayout.NORTH);
  p.add(scrollPane, BorderLayout.CENTER);
  p.add(b, BorderLayout.SOUTH);
  return p;
}

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

descriptionText.setWrapStyleWord(true);
descriptionText.setLineWrap(true);
descriptionText.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
descriptionText.setEditable(false);

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

descriptionText.setWrapStyleWord(true);
descriptionText.setLineWrap(true);
descriptionText.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
descriptionText.setEditable(false);

代码示例来源:origin: chewiebug/GCViewer

/**
 * @param gcResource resource to be tracked
 */
public GCModelLoaderView(GCResource gcResource) {
  super(new BorderLayout());
  setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
  JPanel parserInfo = new JPanel(new FlowLayout(FlowLayout.LEFT));
  progressBar = new JProgressBar(0, 100);
  progressBar.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
  progressBar.setVisible(true);
  progressBar.setValue(0);
  progressBar.setStringPainted(true);
  cancelButton = new JButton(new SquareIcon());
  cancelButton.setActionCommand(CMD_CANCEL);
  cancelButton.addActionListener(this);
  messageLabel = new JLabel();
  messageLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
  messageLabel.setVisible(false);
  parserInfo.add(progressBar);
  parserInfo.add(cancelButton);
  parserInfo.add(messageLabel);
  add(parserInfo, BorderLayout.NORTH);
  JTextArea textArea = textAreaLogHandler.getTextArea();
  textArea.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  JScrollPane textAreaScrollPane = new JScrollPane(textArea);
  textAreaScrollPane.setPreferredSize(new Dimension(700, 500));
  add(textAreaScrollPane, BorderLayout.CENTER);
  setGCResource(gcResource);
}

代码示例来源:origin: redwarp/9-Patch-Resizer

public AboutDialog(JFrame parent) {
  this.setResizable(false);
  this.setSize(new Dimension(400, 250));
  this.getContentPane().setLayout(new BorderLayout(0, 0));
  JLabel lblResizer = new JLabel(Localization.get("app_name") + " "
      + Configuration.getVersion());
  lblResizer.setBorder(new EmptyBorder(10, 10, 10, 10));
  lblResizer.setVerticalTextPosition(SwingConstants.BOTTOM);
  lblResizer.setIconTextGap(10);
  lblResizer.setFont(lblResizer.getFont().deriveFont(
      lblResizer.getFont().getStyle() | Font.BOLD, 16f));
  lblResizer.setIcon(new ImageIcon(AboutDialog.class
      .getResource("/img/icon_64.png")));
  this.getContentPane().add(lblResizer, BorderLayout.NORTH);
  JTextArea txtrResizerIsA = new JTextArea();
  txtrResizerIsA.setEditable(false);
  txtrResizerIsA.setWrapStyleWord(true);
  txtrResizerIsA.setBorder(new EmptyBorder(0, 10, 10, 10));
  txtrResizerIsA.setFont(UIManager.getFont("Label.font"));
  txtrResizerIsA.setLineWrap(true);
  txtrResizerIsA.setText(Localization.get("about_text"));
  txtrResizerIsA.setBackground(new Color(0, 0, 0, 0));
  this.getContentPane().add(txtrResizerIsA, BorderLayout.CENTER);
  this.setLocationRelativeTo(parent);
}

代码示例来源: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: tomighty/tomighty

private Component text() {
  license = new JTextArea();
  license.setFont(getFont());
  license.setBackground(getBackground());
  license.setEditable(false);
  license.setBorder(BorderFactory.createCompoundBorder(
      BorderFactory.createLineBorder(Color.GRAY), 
      emptyBorder()));
  return license;
}

代码示例来源: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() {
  popupText = new javax.swing.JTextArea();
  setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
  setLayout(new java.awt.BorderLayout());
  popupText.setBackground(new java.awt.Color(204, 204, 204));
  popupText.setColumns(20);
  popupText.setEditable(false);
  popupText.setLineWrap(true);
  popupText.setRows(1);
  popupText.setWrapStyleWord(true);
  popupText.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2));
  add(popupText, java.awt.BorderLayout.PAGE_START);
}// </editor-fold>//GEN-END:initComponents

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

/** {@inheritDoc} */
@Override
public JPanel createControlPanel() {
  JPanel panel = new JPanel(new BorderLayout());
  categoryList = new JList(new CategoryListModel());
  categoryList.setPreferredSize(new Dimension(LIST_WIDTH, DEFAULT_HEIGHT));
  categoryList.setBorder(BorderFactory.createTitledBorder("Categories"));
  categoryList.addListSelectionListener(
      new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
          showInfo(categoryList.getSelectedIndex());
        }
      });
  panel.add(categoryList, BorderLayout.WEST);
  textArea = new JTextArea();
  textArea.setPreferredSize(new Dimension(TEXT_AREA_WIDTH, DEFAULT_HEIGHT));
  textArea.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
  textArea.setLineWrap(true);
  textArea.setEditable(false);
  panel.add(textArea, BorderLayout.CENTER);
  categoryList.setSelectedIndex(0);
  return panel;
}

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

/**
 * Retourne une étiquette pour la composante spécifiée. Le texte de l'étiquette pourra
 * éventuellement être distribué sur plusieurs lignes.
 *
 * @param owner Composante pour laquelle on construit une étiquette. L'étiquette aura la même
 *     largeur que {@code owner}.
 * @param text Texte à placer dans l'étiquette.
 */
public static JComponent getMultilineLabelFor(final JComponent owner, final String text) {
  final JTextArea label = new JTextArea(text);
  final Dimension size = owner.getPreferredSize();
  size.height = label.getMaximumSize().height;
  label.setMaximumSize(size);
  label.setWrapStyleWord(true);
  label.setLineWrap(true);
  label.setEditable(false);
  label.setFocusable(false);
  label.setOpaque(false);
  label.setBorder(null); // Certains L&F placent une bordure.
  LookAndFeel.installColorsAndFont(
      label, "Label.background", "Label.foreground", "Label.font");
  return label;
}

代码示例来源:origin: org.netbeans.api/org-openide-dialogs

area.setPreferredSize(new Dimension(SIZE_PREFERRED_WIDTH, SIZE_PREFERRED_HEIGHT));
area.setBackground(UIManager.getColor("Label.background")); // NOI18N
area.setBorder(BorderFactory.createEmptyBorder());
area.setLineWrap(true);
area.setWrapStyleWord(true);

代码示例来源:origin: ron190/jsql-injection

/**
 * Build new instance of JTextArea to decorate.
 */
public JPopupTextArea(JTextArea proxy) {
  super(proxy);
  this.getProxy().addFocusListener(new FocusAdapter() {
    @Override
    public void focusGained(FocusEvent arg0) {
      JPopupTextArea.this.getProxy().getCaret().setVisible(true);
      JPopupTextArea.this.getProxy().getCaret().setSelectionVisible(true);
    }
  });
  this.getProxy().setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
  this.getProxy().setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
}

代码示例来源:origin: org.netbeans.api/org-openide-dialogs

ta.setFont(UIManager.getFont("Label.font")); // NOI18N
ta.getAccessibleContext().setAccessibleDescription(""); // NOI18N
ta.setBorder(BorderFactory.createEmptyBorder());

代码示例来源:origin: ron190/jsql-injection

this.textToTranslate[0].setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
this.textToTranslate[0].setDragEnabled(true);

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

JTextArea area = new JTextArea();
area.setColumns(50);
area.setWrapStyleWord(true);
area.setEditable(false);
area.setBorder(null);
panel.add(new JScrollPane(area)); // probably without scroll pane if all messages are short

代码示例来源:origin: Exslims/MercuryTrade

public JTextArea getSimpleTextArea(String text) {
  JTextArea area = new JTextArea(text);
  area.setEditable(false);
  area.setWrapStyleWord(true);
  area.setLineWrap(true);
  area.setBackground(AppThemeColor.TRANSPARENT);
  area.setBorder(null);
  area.setFont(REGULAR_FONT.deriveFont(scale * 16f));
  area.setForeground(AppThemeColor.TEXT_DEFAULT);
  return area;
}

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

JTextArea textArea = new JTextArea();
textArea.setEditable(false);
textArea.setLineWrap(true);
textArea.setOpaque(false);
textArea.setBorder(BorderFactory.createEmptyBorder());
add(textArea, BorderLayout.CENTER);

代码示例来源:origin: protegeproject/protege

public TextForegroundPreviewPanel(JColorChooser chooser) {
  chooser.getSelectionModel().addChangeListener(this);
  setForeground(color);
  setBackground(Color.WHITE);
  setOpaque(true);
  setFont(new Font("monospaced", Font.PLAIN, 12));
  text.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
  add(text);
}

相关文章

JTextArea类方法