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

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

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

JTextArea.setBounds介绍

暂无

代码示例

代码示例来源:origin: lingfengsan/MillionHero

/**
 *
 * @param panel 创建图片存放路径
 */
private static void addResultTextArea(JPanel panel) {
  resultTextArea = new JTextArea();
  resultTextArea.setBounds(10, 195, 400, 400);
  panel.add(resultTextArea);
}

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

panel.setLayout(null);
 JTextArea txtQuery = new JTextArea ();
 txtQuery.setBounds(10, 10, 365, 45);        
 JScrollPane scroll = new JScrollPane (txtQuery, 
   JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
 //scroll.setPreferredSize(new Dimension(100, 50));
 panel.add(scroll);
 panel.add(txtQuery);

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

setLayout(null); //change jpanel layout to null
JTextArea name_field=new JTextArea(1,10);
name_field.setBackground(color);
name_field.setBounds(100,100,600,420);
name_field.setLineWrap(true);
add(name_field);

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

final JTextArea textArea = new JTextArea();
textArea.setBounds(10, 11, 831, 393);
JScrollPane scroll = new JScrollPane(textArea);

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

final JTextArea textArea = new JTextArea();
   textArea.setFont(new Font("MS UI Gothic", Font.PLAIN, 13));
   textArea.setLineWrap(true);
   textArea.setBounds(77, 310, 474, 136);
   JScrollPane sbrText = new JScrollPane(textArea);
   sbrText.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
   frame.getContentPane().add(sbrText);//contentPane.add(sbrText);
   frame.setVisible(true);

代码示例来源:origin: cytoscape.coreplugins/attribute-browser

public void setBounds(int x, int y, int width, int height) {
  if (Boolean.TRUE.equals(getClientProperty(UPDATE_BOUNDS)))
    super.setBounds(x, y, width, height);
}

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

JTextArea textArea = new JTextArea(text);
textArea.setFont(g.getFont().deriveFont(30f));
textArea.setOpaque(false);
textArea.setWrapStyleWord(true);
textArea.setLineWrap(true);
textArea.setBounds(0, 0, image.getWidth(), image.getHeight());
textArea.paint(g);

代码示例来源:origin: thorikawa/GlassRemote

public InfoPanel() {
  setPreferredSize(new Dimension(WIDTH, HEIGHT));
  GroupLayout layout = new GroupLayout(this);
  layout.setAutoCreateContainerGaps(true);
  layout.setAutoCreateGaps(true);
  setLayout(layout);
  textArea = new JTextArea();
  textArea.setBounds(5, 5, 630, 30);
  textArea.setEditable(false);
  textArea.setFocusable(false);
  layout.setHorizontalGroup(layout.createParallelGroup().addComponent(textArea));
  layout.setVerticalGroup(layout.createSequentialGroup().addComponent(textArea));
}

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

resultsTA.setBounds(10, 10, 150, 30);

代码示例来源:origin: apache/axis2-java

protected void initDescription(String desc) {
  this.descriptionLabel = new JTextArea(desc);
  this.descriptionLabel.setOpaque(false);
  this.descriptionLabel.setEditable(false);
  this.descriptionLabel.setAutoscrolls(true);
  this.descriptionLabel.setBounds(0, 0, descWidth, descHeight);
  this.add(this.descriptionLabel);
}

代码示例来源:origin: robo-code/robocode

public JTextArea getTextPane() {
  if (textArea == null) {
    textArea = new JTextArea();
    textArea.setEditable(false);
    textArea.setTabSize(4);
    textArea.setBackground(Color.DARK_GRAY);
    textArea.setForeground(Color.WHITE);
    textArea.setBounds(0, 0, 1000, 1000);
    textArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
    // Make sure the caret is not reset every time text is updated, meaning that
    // the view will not reset it's position until we want it to.
    ((DefaultCaret) textArea.getCaret()).setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
  }
  return textArea;
}

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

public static void main(String[] args) {
  EventQueue.invokeLater(new Runnable() {
    @Override
    public void run() {
      buildGUI();
    }
  });
}

private static void buildGUI() {
  JFrame f = new JFrame("Test");
  f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

  ComponentResizer cr = new ComponentResizer();
  JPanel mainPanel = new JPanel(null);
  f.add(mainPanel);

  JTextArea textArea = new JTextArea("Some text\nSome other text");
  cr.registerComponent(textArea);

  mainPanel.add(textArea);
  textArea.setBounds(50, 50, 150, 150);

  f.setSize(400, 400);
  f.setLocationRelativeTo(null);
  f.setVisible(true);
}

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

singlePageTextArea.setBounds(getBounds());

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

public class Main Frame extends J Frame {
private static final long serialVersionUID = 1L;
  public MainFrame(String title) {
  super(title);
  setLayout(new BorderLayout());
  JTextArea textArea = new JTextArea("test");
  textArea.setBounds(10, 10, 50, 20);
  JButton button = new JButton("Click me");
  button.setBounds(10, 20, 50, 20);
  Container c = getContentPane();
  c.add(textArea, BorderLayout.CENTER);
  c.add(button, BorderLayout.SOUTH);
}

public static void main(String args[]) {
  MainFrame frame = new MainFrame("Title");
  frame.setSize(500, 400);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.setVisible(true);
}

代码示例来源:origin: Slowpoke101/FTBLaunch

filler.setEditable(false);
filler.setForeground(LauncherStyle.getCurrentStyle().tabPaneForeground);
filler.setBounds(58, 6, 378, 42);
filler.setBackground(LauncherStyle.getCurrentStyle().tabPaneBackground);

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

/**
 * @see org.apache.airavata.xbaya.ui.graph.NodeGUI#paint(java.awt.Graphics2D)
 */
@Override
protected void paint(Graphics2D g) {
  Point position = this.node.getPosition();
  this.textArea.setText(this.node.getMemo());
  Dimension preferredSize = this.textArea.getPreferredSize();
  Rectangle bounds = new Rectangle(position.x, position.y, preferredSize.width, preferredSize.height);
  this.textArea.setBounds(bounds);
  Graphics graphics = g.create(position.x, position.y, preferredSize.width, preferredSize.height);
  this.textArea.paint(graphics);
}

代码示例来源:origin: robward-scisys/sldeditor

/**
 * Creates the UI.
 *
 * @param noOfRows the no of rows
 */
private void createUI(int noOfRows) {
  setLayout(new BorderLayout());
  int xPos = 0;
  int width = BasePanel.FIELD_PANEL_WIDTH - xPos - 20;
  int height = BasePanel.WIDGET_HEIGHT * (noOfRows - 1);
  this.setBounds(0, 0, width, height);
  textField = new JTextArea();
  textField.setBounds(xPos, BasePanel.WIDGET_HEIGHT, width, height);
  Font font = textField.getFont();
  // Create a new, smaller font from the current font
  Font updatedFont = new Font(font.getFontName(), font.getStyle(), FONT_SIZE);
  // Set the new font in the editing area
  textField.setFont(updatedFont);
  textField.setEditable(true);
  // Wrap the text field with a scroll pane
  JScrollPane scroll = new JScrollPane(textField);
  scroll.setAutoscrolls(true);
  add(scroll, BorderLayout.CENTER);
}

代码示例来源:origin: robward-scisys/sldeditor

/** Creates the ui. */
/*
 * (non-Javadoc)
 *
 * @see com.sldeditor.ui.detail.config.FieldConfigBase#createUI()
 */
@Override
public void createUI() {
  if (textField == null) {
    int xPos = getXPos();
    int height = getRowY(SAMPLE_TEXT_LINES);
    int width = BasePanel.WIDGET_EXTENDED_WIDTH * 2;
    textField = new JTextArea();
    textField.setBounds(xPos + BasePanel.WIDGET_X_START, 0, width, height);
    textField.setWrapStyleWord(true);
    textField.setLineWrap(false);
    textField.setText(SAMPLE_TEXT);
    textField.setRows(SAMPLE_TEXT_LINES);
    JScrollPane scrollPane = new JScrollPane(textField);
    scrollPane.setBounds(xPos + BasePanel.WIDGET_X_START, 0, width, height);
    FieldPanel fieldPanel = createFieldPanel(xPos, height, getLabel());
    fieldPanel.add(scrollPane);
  }
}

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

public class AddWordWindow extends JFrame{

public AddWordWindow(){
  getContentPane().setLayout(null);

  JTextPane wordText = new JTextPane();
  wordText.setBounds(10, 21, 82, 20);
  getContentPane().add(wordText);

  JTextArea descriptionText = new JTextArea();
  descriptionText.setBounds(10, 66, 143, 57);
  getContentPane().add(descriptionText);
  descriptionText.setEnabled(false);

  wordText.addKeyListener(new KeyAdapter() {

    @Override
    public void keyTyped(KeyEvent e) {              
      if(wordText.getText().length()>2){
        descriptionText.setEnabled(true);                   
      }
    }           
  });
}

代码示例来源:origin: net.sf.ingenias/editor

((DefaultGraphCell)this.getCell()).setAttributes(m);
jta.setBounds(rec);
jta.setMargin(new Insets(3, 3, 3, 3));
jta.setWrapStyleWord(true);

相关文章

JTextArea类方法