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

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

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

JTextArea.setMaximumSize介绍

暂无

代码示例

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

int h = (int) (lines * ta.getFontMetrics(ta.getFont()).getHeight());
ta.setPreferredSize(new Dimension(w, h));
ta.setMaximumSize(new Dimension(w, 2 * h));
ta.setText(text);
JScrollPane sp = new JScrollPane(ta);

代码示例来源:origin: winder/Universal-G-Code-Sender

private void initComponents() {
  consoleTextArea.setEditable(false);
  consoleTextArea.setColumns(20);
  consoleTextArea.setDocument(new LengthLimitedDocument(CONSOLE_SIZE));
  consoleTextArea.setRows(5);
  consoleTextArea.setMaximumSize(new java.awt.Dimension(32767, 32767));
  consoleTextArea.setMinimumSize(new java.awt.Dimension(0, 0));
  scrollPane.setViewportView(consoleTextArea);
  commandLabel.setEnabled(backend.isIdle());
  scrollWindowMenuItem.addActionListener(e -> checkScrollWindow());
  setLayout(new MigLayout("inset 0 0 5 0, fill, wrap 1", "", "[][min!]"));
  add(scrollPane, "grow, growy");
  add(commandLabel, "gapleft 5, al left, split 2");
  add(commandTextField, "gapright 5, r, grow");
  menu.add(showVerboseMenuItem);
  menu.add(scrollWindowMenuItem);
  SwingHelpers.traverse(this, (comp) -> comp.setComponentPopupMenu(menu));
}

代码示例来源:origin: winder/Universal-G-Code-Sender

consoleTextArea.setDocument(new LengthLimitedDocument(consoleSize));
consoleTextArea.setRows(5);
consoleTextArea.setMaximumSize(new java.awt.Dimension(32767, 32767));
consoleTextArea.setMinimumSize(new java.awt.Dimension(0, 0));
consoleScrollPane.setViewportView(consoleTextArea);

代码示例来源:origin: org.boofcv/demonstrations

private JTextArea createTextInfo() {
  JTextArea comp = new JTextArea(1,6);
  comp.setMaximumSize(comp.getPreferredSize());
  comp.setEditable(false);
  return comp;
}

代码示例来源:origin: org.boofcv/demonstrations

private JTextArea createTextInfo() {
  JTextArea comp = new JTextArea(1,6);
  comp.setMaximumSize(comp.getPreferredSize());
  comp.setEditable(false);
  return comp;
}

代码示例来源:origin: org.boofcv/demonstrations

private JTextArea createTextInfo() {
  JTextArea comp = new JTextArea(1,6);
  comp.setMaximumSize(comp.getPreferredSize());
  comp.setEditable(false);
  return comp;
}

代码示例来源:origin: org.boofcv/demonstrations

private JTextArea createTextInfo() {
    JTextArea comp = new JTextArea(1,6);
    comp.setMaximumSize(comp.getPreferredSize());
    comp.setEditable(false);
    return comp;
  }
}

代码示例来源:origin: org.boofcv/demonstrations

private JTextArea createErrorComponent() {
  JTextArea comp = new JTextArea(1,6);
  comp.setMaximumSize(comp.getPreferredSize());
  comp.setEditable(false);
  return comp;
}

代码示例来源:origin: org.boofcv/visualize

private JTextArea createErrorComponent() {
  JTextArea comp = new JTextArea(1,6);
  comp.setMaximumSize(comp.getPreferredSize());
  comp.setEditable(false);
  return comp;
}

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

JTextArea createErrorComponent(int numRows) {
  JTextArea comp = new JTextArea(numRows,6);
  comp.setMaximumSize(comp.getPreferredSize());
  comp.setEditable(false);
  comp.setBorder(BorderFactory.createEmptyBorder(0,0,4,0));
  return comp;
}

代码示例来源:origin: us.ihmc/ImageProcessing

private JTextArea createTextInfo() {
  JTextArea comp = new JTextArea(1,6);
  comp.setMaximumSize(comp.getPreferredSize());
  comp.setEditable(false);
  return comp;
}

代码示例来源:origin: org.boofcv/demonstrations

private JTextArea createTextComponent() {
  JTextArea comp = new JTextArea(1,6);
  comp.setMaximumSize(comp.getPreferredSize());
  comp.setEditable(false);
  return comp;
}

代码示例来源:origin: org.boofcv/demonstrations

private JTextArea createTextInfo() {
    JTextArea comp = new JTextArea(1,6);
    comp.setMaximumSize(comp.getPreferredSize());
    comp.setEditable(false);
    return comp;
  }
}

代码示例来源:origin: org.boofcv/demonstrations

private JTextArea createTextInfo() {
  JTextArea comp = new JTextArea(1,6);
  comp.setMaximumSize(comp.getPreferredSize());
  comp.setEditable(false);
  return comp;
}

代码示例来源:origin: nativelibs4java/JNAerator

public void run() {
    ByteArrayOutputStream bout = new ByteArrayOutputStream();
    PrintStream pout = new PrintStream(bout);
    DebugUtils.println(SimpleGUI.this.config, pout);
    JTextArea ta = new JTextArea();
    ta.setWrapStyleWord(true);
    ta.setLineWrap(true);
    ta.setText(new String(bout.toByteArray()));
    JScrollPane sp = new JScrollPane(ta);
    Dimension s = new Dimension(500, 400);
    ta.setMaximumSize(new Dimension(s.width, Integer.MAX_VALUE));
    sp.setMaximumSize(s);
    sp.setMinimumSize(s);
    sp.setPreferredSize(s);
    JOptionPane.showMessageDialog(frame, sp, ftitle, JOptionPane.INFORMATION_MESSAGE);
  }
}));

代码示例来源:origin: com.nativelibs4java/jnaerator

public void run() {
    ByteArrayOutputStream bout = new ByteArrayOutputStream();
    PrintStream pout = new PrintStream(bout);
    DebugUtils.println(SimpleGUI.this.config, pout);
    JTextArea ta = new JTextArea();
    ta.setWrapStyleWord(true);
    ta.setLineWrap(true);
    ta.setText(new String(bout.toByteArray()));
    JScrollPane sp = new JScrollPane(ta);
    Dimension s = new Dimension(500, 400);
    ta.setMaximumSize(new Dimension(s.width, Integer.MAX_VALUE));
    sp.setMaximumSize(s);
    sp.setMinimumSize(s);
    sp.setPreferredSize(s);
    JOptionPane.showMessageDialog(frame, sp, ftitle, JOptionPane.INFORMATION_MESSAGE);
  }
}));

代码示例来源:origin: edu.illinois.cs.cogcomp/DatalessClassification

public void result_panel(HashMap<Integer, List<LabelKeyValuePair>> labelResultsInDepth){
  m= new JFrame("Customized Tree");
  m.setSize(500, 300);
  panel3 = new JPanel();
  JTextArea text3 = new JTextArea();
  text3.setSize(400,200);
  text3.setLocation(30, 30);
  text3.setLineWrap(true);
  text3.setMaximumSize( text3.getPreferredSize() );
  int size=labelResultsInDepth.size()-1;
  for(int j=0;j<labelResultsInDepth.get(size).size();j++){
    text3.append("The label name is "+labelResultsInDepth.get(size).get(j).labelName+"\n");
    
  }
  panel3.add(text3);
  m.setContentPane(panel3);
  m.setVisible(true);
}

代码示例来源:origin: edu.illinois.cs.cogcomp/DatalessClassification

public void cTree_panel(final Controller controller){
  m= new JFrame("Customized Tree");
  m.setSize(700, 400);
  panel3 = new JPanel();
  panel3.setPreferredSize(new Dimension(400,400));
  panel3.setLayout(null);
  JButton dump_tree=new JButton("Dump Tree");
  dump_tree.setBounds(30,50,150,30);
  dump_tree.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {     
        String text = text1.getText();
        controller.costumized_tree(text);
        m.dispose();
      }
    });
  panel3.add(dump_tree);
  text1 = new JTextArea("Enter Text");
  text1.setSize(400,200);
  text1.setLocation(200, 50);
  text1.setLineWrap(true);
  text1.setMaximumSize( text1.getPreferredSize() );
  panel3.add(text1);
  m.setContentPane(panel3);
  m.setVisible(true);
}

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

private void jPanel1ComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jPanel1ComponentResized
  // this is needed to override the size of the TextArea with text already present
  taMemoryView.setMinimumSize(jPanel1.getMinimumSize());
  taMemoryView.setMaximumSize(jPanel1.getMaximumSize());
  RefreshMemory();
}//GEN-LAST:event_jPanel1ComponentResized

相关文章

JTextArea类方法