本文整理了Java中javax.swing.JTextArea.setMinimumSize()
方法的一些代码示例,展示了JTextArea.setMinimumSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextArea.setMinimumSize()
方法的具体详情如下:
包路径:javax.swing.JTextArea
类名称:JTextArea
方法名:setMinimumSize
暂无
代码示例来源: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: pentaho/mondrian
cdataTextArea.setEditable(true);
cdataTextArea.setPreferredSize(new java.awt.Dimension(100, 300));
cdataTextArea.setMinimumSize(new java.awt.Dimension(100, 100));
代码示例来源:origin: pentaho/mondrian
cdataTextArea.setEditable(true);
cdataTextArea.setPreferredSize(new java.awt.Dimension(100, 300));
cdataTextArea.setMinimumSize(new java.awt.Dimension(100, 100));
代码示例来源:origin: winder/Universal-G-Code-Sender
consoleTextArea.setRows(5);
consoleTextArea.setMaximumSize(new java.awt.Dimension(32767, 32767));
consoleTextArea.setMinimumSize(new java.awt.Dimension(0, 0));
consoleScrollPane.setViewportView(consoleTextArea);
代码示例来源:origin: sing-group/GC4S
private JComponent getPreviewFontPanel() {
previewFontPanel = new JScrollPane();
previewFontPanel.setBorder(createTitledBorder(
createLoweredBevelBorder(), "Font preview"));
previewFontPanel.setViewportView(sampleText);
sampleText.setMinimumSize(new Dimension(100, 100));
sampleText.setPreferredSize(new Dimension(100, 100));
sampleText.setEditable(false);
return previewFontPanel;
}
代码示例来源:origin: stackoverflow.com
JTextArea ta = new JTextArea();
ta.setPreferredSize(new Dimension(310, 325));
ta.setMinimumSize(new Dimension(310, 325));
代码示例来源:origin: org.activecomponents.jadex/jadex-editor-bpmn
/**
* Helper method for creating a text area/button combination.
*
* @return The combined panel.
*/
protected JPanel createTextButtonPanel()
{
JPanel ret = new JPanel(new GridBagLayout());
JTextArea area = new JTextArea();
area.setLineWrap(true);
area.setWrapStyleWord(true);
area.setBorder(DEFAULT_TEXT_BORDER);
//FIXME: Hack for Icedtea...
area.setMinimumSize(new Dimension(0, 20));
GridBagConstraints gbc = new GridBagConstraints();
gbc.weightx = 1.0;
gbc.fill = GridBagConstraints.HORIZONTAL;
ret.add(area, gbc);
JButton button = new JButton();
gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.fill = GridBagConstraints.NONE;
ret.add(button, gbc);
return ret;
}
代码示例来源:origin: net.sf.taverna.t2.component/component-annotation
public static JPanel getPropertyPanel(String displayName,
Component inputComponent) {
JPanel result = new JPanel();
result.setLayout(new BorderLayout());
JPanel messagePanel = new JPanel(new BorderLayout());
messagePanel.setBorder(new EmptyBorder(5, 5, 0, 0));
messagePanel.setBackground(WHITE);
result.add(messagePanel, NORTH);
JLabel inputLabel = new JLabel("Enter a value for the annotation");
inputLabel.setBackground(WHITE);
Font baseFont = inputLabel.getFont();
inputLabel.setFont(baseFont.deriveFont(BOLD));
messagePanel.add(inputLabel, NORTH);
JTextArea messageText = new JTextArea(format(
"Enter a value for the annotation '%s'", displayName));
messageText.setMargin(new Insets(5, 10, 10, 10));
messageText.setMinimumSize(new Dimension(0, 30));
messageText.setFont(baseFont.deriveFont(11f));
messageText.setEditable(false);
messageText.setFocusable(false);
messagePanel.add(messageText, CENTER);
result.add(new JScrollPane(inputComponent), CENTER);
return result;
}
}
代码示例来源:origin: net.sf.taverna.t2.ui-activities/component-activity-ui
public static JPanel getPropertyPanel(String displayName,
Component inputComponent) {
JPanel result = new JPanel();
result.setLayout(new BorderLayout());
JPanel messagePanel = new JPanel(new BorderLayout());
messagePanel.setBorder(new EmptyBorder(5, 5, 0, 0));
messagePanel.setBackground(WHITE);
result.add(messagePanel, NORTH);
JLabel inputLabel = new JLabel("Enter a value for the annotation");
inputLabel.setBackground(WHITE);
Font baseFont = inputLabel.getFont();
inputLabel.setFont(baseFont.deriveFont(BOLD));
messagePanel.add(inputLabel, NORTH);
JTextArea messageText = new JTextArea(format(
"Enter a value for the annotation '%s'", displayName));
messageText.setMargin(new Insets(5, 10, 10, 10));
messageText.setMinimumSize(new Dimension(0, 30));
messageText.setFont(baseFont.deriveFont(11f));
messageText.setEditable(false);
messageText.setFocusable(false);
messagePanel.add(messageText, CENTER);
result.add(new JScrollPane(inputComponent), CENTER);
return result;
}
}
代码示例来源:origin: uk.org.mygrid.taverna.scufl.scufl-ui-components/workflow-input-panel
public JTextArea makeDescription() {
String descriptionTxt = port.getMetadata().getDescription();
JTextArea description = new JTextArea(descriptionTxt);
description.setEditable(false);
description.setLineWrap(true);
description.setOpaque(false);
description.setWrapStyleWord(true);
description.setFont(Font.getFont("Dialog"));
// Avoid stealing all width of the split pane
description.setMinimumSize(new Dimension(25, 10));
return description;
}
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_components
/**
* Create the JSON PATH task pane
*
* @return JSON PATH task pane
*/
private JPanel createJSonPathExtractorTasksPanel() {
JPanel jsonPathActionPanel = new JPanel();
jsonPathActionPanel.setLayout(new BoxLayout(jsonPathActionPanel, BoxLayout.X_AXIS));
Border margin = new EmptyBorder(5, 5, 0, 5);
jsonPathActionPanel.setBorder(margin);
jsonPathExpressionField = new JLabeledTextField(JMeterUtils.getResString("jsonpath_tester_field")); // $NON-NLS-1$
jsonPathActionPanel.add(jsonPathExpressionField, BorderLayout.WEST);
JButton xpathTester = new JButton(JMeterUtils.getResString("jsonpath_tester_button_test")); // $NON-NLS-1$
xpathTester.setActionCommand(JSONPATH_TESTER_COMMAND);
xpathTester.addActionListener(this);
jsonPathActionPanel.add(xpathTester, BorderLayout.EAST);
jsonPathResultField = new JTextArea();
jsonPathResultField.setEditable(false);
jsonPathResultField.setLineWrap(true);
jsonPathResultField.setWrapStyleWord(true);
jsonPathResultField.setMinimumSize(new Dimension(100, 150));
JPanel xpathTasksPanel = new JPanel(new BorderLayout(0, 5));
xpathTasksPanel.add(jsonPathActionPanel, BorderLayout.NORTH);
xpathTasksPanel.add(GuiUtils.makeScrollPane(jsonPathResultField), BorderLayout.CENTER);
return xpathTasksPanel;
}
代码示例来源:origin: org.boofcv/demonstrations
public DetectQrCodeMessagePanel(Listener listener ) {
this.listener = listener;
listDetected = new JList();
listDetected.setModel(new DefaultListModel());
listDetected.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
listDetected.setLayoutOrientation(JList.VERTICAL);
listDetected.setVisibleRowCount(-1);
listDetected.addListSelectionListener(this);
textArea.setEditable(false);
textArea.setWrapStyleWord(true);
textArea.setLineWrap(true);
// ensures that the split pane can be dragged
Dimension minimumSize = new Dimension(0, 0);
listDetected.setMinimumSize(minimumSize);
textArea.setMinimumSize(minimumSize);
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,new JScrollPane(listDetected),textArea);
splitPane.setDividerLocation(150);
splitPane.setPreferredSize(new Dimension(200,0));
addAlignCenter(new JLabel("QR-Codes"));
addAlignCenter(splitPane);
}
代码示例来源:origin: Exslims/MercuryTrade
@Override
protected JPanel getDataPanel() {
JPanel root = this.componentsFactory.getJPanel(new BorderLayout());
root.setBorder(BorderFactory.createLineBorder(AppThemeColor.ADR_PANEL_BORDER));
root.setBackground(AppThemeColor.ADR_BG);
JLabel header = this.componentsFactory.getTextLabel("Data (Ctrl + A for copy):", FontStyle.BOLD, 18);
header.setForeground(AppThemeColor.TEXT_NICKNAME);
root.add(header, BorderLayout.PAGE_START);
JPanel container = new VerticalScrollContainer();
container.setBackground(AppThemeColor.ADR_BG);
container.setLayout(new BoxLayout(container, BoxLayout.Y_AXIS));
JScrollPane verticalContainer = this.componentsFactory.getVerticalContainer(container);
this.jsonArea = this.componentsFactory.getSimpleTextArea("");
this.jsonArea.setBorder(BorderFactory.createLineBorder(AppThemeColor.ADR_DEFAULT_BORDER));
this.jsonArea.setMinimumSize(new Dimension(450, 550));
this.jsonArea.setBackground(AppThemeColor.ADR_TEXT_ARE_BG);
container.add(this.jsonArea, AppThemeColor.ADR_BG);
root.add(this.componentsFactory.wrapToSlide(verticalContainer, AppThemeColor.ADR_BG, 0, 5, 4, 0), BorderLayout.CENTER);
return this.componentsFactory.wrapToSlide(root);
}
代码示例来源:origin: uk.org.mygrid.taverna.scufl.scufl-ui-components/workflow-input-panel
public DescriptionAndDiagram() {
super(new BorderLayout());
// FIXME: make description wrap lines
JTextArea description = new JTextArea(model.getDescription().getText());
description.setEditable(false);
description.setLineWrap(true);
description.setOpaque(false);
description.setWrapStyleWord(true);
description.setFont(Font.getFont("Dialog"));
// Avoid stealing all width
description.setMinimumSize(new Dimension(25, 10));
// FIXME: detach from model when window is closed
diagram.attachToModel(model);
add(description, BorderLayout.NORTH);
add(diagram, BorderLayout.CENTER);
}
}
代码示例来源:origin: raydac/netbeans-mmd-plugin
public void updateEditorAfterResizing() {
if (this.lockIfNotDisposed()) {
try {
if (this.elementUnderEdit != null) {
final AbstractElement element = this.elementUnderEdit;
final Dimension textBlockSize = new Dimension((int) element.getBounds().getWidth(), (int) element.getBounds().getHeight());
this.textEditorPanel.setBounds((int) element.getBounds().getX(), (int) element.getBounds().getY(), textBlockSize.width, textBlockSize.height);
this.textEditor.setMinimumSize(textBlockSize);
this.textEditorPanel.setVisible(true);
this.textEditor.requestFocus();
}
} finally {
this.unlock();
}
}
}
代码示例来源:origin: Exslims/MercuryTrade
this.repaint();
});
this.jsonArea.setMinimumSize(new Dimension(450, 550));
this.jsonArea.setEditable(true);
this.jsonArea.setPreferredSize(new Dimension(450, 550));
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-mercurial
/** Creates new form CommitPanel */
public CommitPanel(QCreatePatchParameters parameters, String commitMessage, String patchName) {
this.parameters = parameters;
initComponents();
boolean skipTemplates = false;
if (patchName != null && !patchName.isEmpty()) {
txtPatchName.setText(patchName);
txtPatchName.setEditable(false);
skipTemplates = true;
}
messageTextArea.setColumns(60); //this determines the preferred width of the whole dialog
messageTextArea.setLineWrap(true);
messageTextArea.setRows(4);
messageTextArea.setTabSize(4);
messageTextArea.setWrapStyleWord(true);
messageTextArea.setMinimumSize(new Dimension(100, 18));
messageTextArea.getAccessibleContext().setAccessibleName(getMessage("ACSN_CommitForm_Message")); // NOI18N
messageTextArea.getAccessibleContext().setAccessibleDescription(getMessage("ACSD_CommitForm_Message")); // NOI18N
messageTextArea.addMouseListener(new CommitMessageMouseAdapter());
Spellchecker.register (messageTextArea);
initCommitMessage(commitMessage, skipTemplates);
cmbAuthor.setModel(parameters.createRecentUsersModel());
}
代码示例来源:origin: raydac/netbeans-mmd-plugin
public void startEdit(@Nullable final AbstractElement element) {
if (this.lockIfNotDisposed()) {
try {
if (element == null) {
this.elementUnderEdit = null;
this.textEditorPanel.setVisible(false);
} else {
this.elementUnderEdit = element;
element.fillByTextAndFont(this.textEditor);
final Dimension textBlockSize = new Dimension((int) element.getBounds().getWidth(), (int) element.getBounds().getHeight());
this.textEditorPanel.setBounds((int) element.getBounds().getX(), (int) element.getBounds().getY(), textBlockSize.width, textBlockSize.height);
this.textEditor.setMinimumSize(textBlockSize);
ensureVisibility(this.elementUnderEdit);
this.textEditorPanel.setVisible(true);
this.textEditor.requestFocus();
}
} finally {
this.unlock();
}
}
}
代码示例来源: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
代码示例来源:origin: sarahtattersall/PIPE
/**
* Initialize with an (x,y) location
* @param x coordinate
* @param y coordinate
*/
private void initialize(int x, int y) {
originalX = x;
originalY = y;
noteText.setAlignmentX(Component.CENTER_ALIGNMENT);
noteText.setAlignmentY(Component.CENTER_ALIGNMENT);
noteText.setOpaque(false);
noteText.setEditable(false);
noteText.setEnabled(false);
noteText.setLineWrap(true);
noteText.setWrapStyleWord(true);
// Set minimum size the preferred size for an empty string:
noteText.setText("");
noteText.setFont(
new Font(GUIConstants.ANNOTATION_DEFAULT_FONT, Font.PLAIN, GUIConstants.ANNOTATION_DEFAULT_FONT_SIZE));
noteText.setSize(noteText.getPreferredSize().width, noteText.getPreferredSize().height);
noteText.setMinimumSize(noteText.getPreferredSize());
noteText.setHighlighter(new DefaultHighlighter());
noteText.setDisabledTextColor(GUIConstants.NOTE_DISABLED_COLOUR);
noteText.setForeground(GUIConstants.NOTE_EDITING_COLOUR);
add(noteText);
setLocation(x - GUIConstants.RESERVED_BORDER / 2, y - GUIConstants.RESERVED_BORDER / 2);
}
内容来源于网络,如有侵权,请联系作者删除!