本文整理汇总了Java中javax.swing.JTextArea.setBorder方法的典型用法代码示例。如果您正苦于以下问题:Java JTextArea.setBorder方法的具体用法?Java JTextArea.setBorder怎么用?Java JTextArea.setBorder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JTextArea
的用法示例。
在下文中一共展示了JTextArea.setBorder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDataDisplay
import javax.swing.JTextArea; //导入方法依赖的package包/类
private void createDataDisplay() {
dataDisplay = new JPanel(new BorderLayout());
dataDisplay.setBorder( BorderFactory.createEmptyBorder(1, 1, 1, 1));
kountLabel = new JLabel("<html>0 events<br> 0 shown</html>");
kountLabel.setForeground( Color.black);
kountLabel.setFont( new Font( "SansSerif", Font.PLAIN, 12));
kountLabel.setBorder(BorderFactory.createLineBorder(Color.GRAY, 2));
dataDisplay.add(kountLabel, BorderLayout.WEST);
dataTextArea = new JTextArea(" ");
dataTextArea.setEditable(false);
dataTextArea.setRows(2);
dataTextArea.setBorder( BorderFactory.createEmptyBorder(1, 4, 1, 1));
dataTextArea.setFont(dataTextArea.getFont().deriveFont(10f));
dataDisplay.add(dataTextArea);
}
示例2: createOthersPanel
import javax.swing.JTextArea; //导入方法依赖的package包/类
void createOthersPanel() {
othersPanel = new JPanel(new BorderLayout(10, 10));
othersPanel.setBackground(Color.WHITE);
othersPanel.setBorder(new EmptyBorder(0, 20, 0, 20));
JTextArea txt1 = new JTextArea(StringResource.getString("BI_LBL_6"));
txt1.setBorder(new EmptyBorder(20, 20, 20, 20));
txt1.setBackground(bgColor);
txt1.setOpaque(false);
txt1.setWrapStyleWord(true);
txt1.setEditable(false);
txt1.setLineWrap(true);
othersPanel.add(txt1, BorderLayout.NORTH);
JPanel biPanel = new JPanel(new GridLayout(2, 1, 20, 20));
biPanel.setBorder(new EmptyBorder(20, 20, 20, 20));
biPanel.add(btn1);
biPanel.add(btn2);
biPanel.setBackground(Color.WHITE);
othersPanel.add(biPanel);
othersPanel.add(autoStart, BorderLayout.SOUTH);
}
示例3: setMessage
import javax.swing.JTextArea; //导入方法依赖的package包/类
/**
* Define a descriptive message to be reported. In the most common
* usage, the message is just a <code>String</code>. However, the type
* of this parameter is actually <code>Object</code>. Its interpretation depends on
* its type:
* <dl compact>
* <dt><code>Object[]</code><dd> A recursively interpreted series of messages.
* <dt>{@link Component}<dd> The <code>Component</code> is displayed in the dialog.
* <dt>{@link javax.swing.Icon}<dd> The <code>Icon</code> is wrapped in a {@link JLabel} and displayed in the dialog.
* <dt>anything else<dd> The {@link Object#toString string representation} of the object.
* </dl>
*
* @param newMessage the <code>Object</code> to report
* @see #getMessage
*/
public void setMessage(Object newMessage) {
checkMessageValidity(newMessage);
Object oldMessage = message;
if (newMessage instanceof String) {
// bugfix #25457, use JTextArea for word-wrapping
JTextArea area = new JTextArea((String) newMessage);
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);
area.setEditable(false);
area.setFocusable(true);
area.getAccessibleContext().setAccessibleName(NbBundle.getMessage(NotifyDescriptor.class, "ACN_NotifyDescriptor_MessageJTextArea")); // NOI18N
area.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(NotifyDescriptor.class, "ACD_NotifyDescriptor_MessageJTextArea")); // NOI18N
newMessage = area;
}
message = newMessage;
firePropertyChange(PROP_MESSAGE, oldMessage, newMessage);
}
示例4: createChromePanel
import javax.swing.JTextArea; //导入方法依赖的package包/类
void createChromePanel() {
chromePanel = new JPanel(new BorderLayout());
chromePanel.setBackground(Color.WHITE);
JLabel lbl = new JLabel(XDMIconMap.getIcon("CI_ICON"), JLabel.LEFT);
lbl.setBorder(new EmptyBorder(20, 20, 20, 20));
chromePanel.add(lbl, BorderLayout.NORTH);
JTextArea text3 = new JTextArea();
text3.setBackground(bgColor);
text3.setOpaque(false);
text3.setWrapStyleWord(true);
text3.setEditable(false);
text3.setLineWrap(true);
text3.setBorder(new EmptyBorder(0, 20, 20, 20));
String txt = new File(System.getProperty("user.home"), "xdm-helper")
.getAbsolutePath();
text3.setText(StringResource.getString("BI_LBL_17").replace("<FOLDER>",
txt));
chromePanel.add(text3);
}
示例5: createWarningPanel
import javax.swing.JTextArea; //导入方法依赖的package包/类
/**
* Creates the panel to be shown when the table is empty
* @param msg message to be shown on the panel
* @return created warning panel
*/
protected JPanel createWarningPanel(String msg) {
JPanel warning = new JPanel(new GridBagLayout());
JPanel innerPanel = new JPanel(new BorderLayout());
// Adds image
JLabel icon = new JLabel("");
icon.setIcon(JMTImageLoader.loadImage("Triangle"));
icon.setHorizontalAlignment(SwingConstants.CENTER);
icon.setBorder(BorderFactory.createEmptyBorder(BORDERSIZE, BORDERSIZE, BORDERSIZE, BORDERSIZE));
innerPanel.add(icon, BorderLayout.NORTH);
// Adds Text Area
JTextArea text = new JTextArea();
text.setEditable(false);
text.setWrapStyleWord(true);
text.setLineWrap(true);
text.setText(msg);
text.setBorder(BorderFactory.createEmptyBorder(BORDERSIZE, BORDERSIZE, BORDERSIZE, BORDERSIZE));
text.setBackground(icon.getBackground());
innerPanel.add(text, BorderLayout.CENTER);
innerPanel.setBorder(BorderFactory.createEtchedBorder());
innerPanel.setPreferredSize(warningBoxSize);
warning.add(innerPanel);
return warning;
}
示例6: computeEditorComponent
import javax.swing.JTextArea; //导入方法依赖的package包/类
/** Computes a new editor component. */
private JTextArea computeEditorComponent() {
final JTextArea result = new JTextArea();
result.setBorder(UIManager.getBorder("Tree.editorBorder"));
result.setWrapStyleWord(true);
// substitute a JTextArea's VK_ENTER action with our own that will
// stop an edit.
InputMap focusedInputMap = result.getInputMap(JComponent.WHEN_FOCUSED);
focusedInputMap.put(STOP_EDIT_KEY_1, STOP_EDIT_STRING);
focusedInputMap.put(STOP_EDIT_KEY_2, STOP_EDIT_STRING);
focusedInputMap.put(NEWLINE_KEY_1, NEWLINE_STRING);
focusedInputMap.put(NEWLINE_KEY_2, NEWLINE_STRING);
focusedInputMap.put(AUTOCOMPLETE_KEY, AUTOCOMPLETE_STRING);
result.getActionMap().put(STOP_EDIT_STRING, new StopEditAction());
result.getActionMap().put(NEWLINE_STRING, new NewlineAction());
result.getActionMap().put(AUTOCOMPLETE_STRING, new AutocompleteAction());
result.addCaretListener(this);
return result;
}
示例7: createDetailsSection
import javax.swing.JTextArea; //导入方法依赖的package包/类
private JComponent createDetailsSection()
{
final JLabel notesLabel = new JLabel(getString("label.notes")); //$NON-NLS-1$
notes = new JTextArea();
notes.setWrapStyleWord(true);
notes.setLineWrap(true);
notes.setRows(3);
notes.setBorder(new EmptyBorder(0, 0, 10, 0));
final int height1 = notesLabel.getPreferredSize().height;
final int height2 = notes.getPreferredSize().height;
final int[] rows = {height1, height2};
final int[] cols = {TableLayout.FILL};
final JPanel all = new JPanel(new TableLayout(rows, cols));
all.add(notesLabel, new Rectangle(0, 0, 1, 1));
all.add(new JScrollPane(notes), new Rectangle(0, 1, 1, 1));
return all;
}
示例8: buildMessageLabel
import javax.swing.JTextArea; //导入方法依赖的package包/类
/**
* Builds the message label
*
* @param exception
* @return JComponent
*/
private JComponent buildMessageLabel(Exception exception) {
JTextArea textArea = new JTextArea(2, 100);
textArea.setText(exception.getMessage());
textArea.setBorder(null);
textArea.setOpaque(false);
textArea.setEditable(false);
return textArea;
}
示例9: getTitleComponent
import javax.swing.JTextArea; //导入方法依赖的package包/类
private JComponent getTitleComponent (String msg) {
JTextArea area = new JTextArea (msg);
area.setWrapStyleWord (true);
area.setLineWrap (true);
area.setEditable (false);
area.setOpaque (false);
area.setBorder(BorderFactory.createEmptyBorder());
area.setBackground(new Color(0, 0, 0, 0));
area.putClientProperty(JTextPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
return area;
}
示例10: createMessageArea
import javax.swing.JTextArea; //导入方法依赖的package包/类
private JScrollPane createMessageArea()
{
messages = new JTextArea();
messages.setBorder(BorderFactory.createLineBorder(Color.BLACK));
messages.setBackground(Color.black);
messages.setForeground(Color.green);
messages.setRows(10);
messages.setLineWrap(true);
scroller = new JScrollPane(messages);
return scroller;
}
示例11: MetalworksDocumentFrame
import javax.swing.JTextArea; //导入方法依赖的package包/类
public MetalworksDocumentFrame() {
super("", true, true, true, true);
openFrameCount++;
setTitle("Untitled Message " + openFrameCount);
JPanel top = new JPanel();
top.setBorder(new EmptyBorder(10, 10, 10, 10));
top.setLayout(new BorderLayout());
top.add(buildAddressPanel(), BorderLayout.NORTH);
JTextArea content = new JTextArea(15, 30);
content.setBorder(new EmptyBorder(0, 5, 0, 5));
content.setLineWrap(true);
JScrollPane textScroller = new JScrollPane(content,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
top.add(textScroller, BorderLayout.CENTER);
setContentPane(top);
pack();
setLocation(offset * openFrameCount, offset * openFrameCount);
}
示例12: createConsoleTextare
import javax.swing.JTextArea; //导入方法依赖的package包/类
private void createConsoleTextare(Container pane) {
// The main GUI component is a textarea that will display System.out
JTextArea ta = new JTextArea(30, 65);
ta.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
TextAreaOutputStream taos = new TextAreaOutputStream(ta, 1000);
PrintStream ps = new PrintStream(taos);
System.setOut(ps);
System.setErr(ps);
// Make the textarea scrollable
JScrollPane scrollTa = new JScrollPane(ta);
scrollTa.setBorder(BorderFactory.createEmptyBorder());
pane.add(scrollTa, BorderLayout.CENTER);
}
示例13: mxCellEditor
import javax.swing.JTextArea; //导入方法依赖的package包/类
/**
*
*/
public mxCellEditor(mxGraphComponent graphComponent) {
this.graphComponent = graphComponent;
// Creates the plain text editor
textArea = new JTextArea();
textArea.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
textArea.setOpaque(false);
// Creates the HTML editor
editorPane = new JEditorPane();
editorPane.setOpaque(false);
editorPane.setBackground(new Color(0, 0, 0, 0));
editorPane.setContentType("text/html");
// Workaround for inserted linefeeds in HTML markup with
// lines that are longar than 80 chars
editorPane.setEditorKit(new NoLinefeedHtmlEditorKit());
// Creates the scollpane that contains the editor
// FIXME: Cursor not visible when scrolling
scrollPane = new JScrollPane();
scrollPane.setBorder(BorderFactory.createEmptyBorder());
scrollPane.getViewport().setOpaque(false);
scrollPane.setVisible(false);
scrollPane.setOpaque(false);
// Installs custom actions
editorPane.getActionMap().put(CANCEL_EDITING, cancelEditingAction);
textArea.getActionMap().put(CANCEL_EDITING, cancelEditingAction);
editorPane.getActionMap().put(SUBMIT_TEXT, textSubmitAction);
textArea.getActionMap().put(SUBMIT_TEXT, textSubmitAction);
// Remembers the action map key for the enter keystroke
editorEnterActionMapKey = editorPane.getInputMap().get(enterKeystroke);
textEnterActionMapKey = editorPane.getInputMap().get(enterKeystroke);
}
示例14: UnknownParametersInfoDialog
import javax.swing.JTextArea; //导入方法依赖的package包/类
public UnknownParametersInfoDialog(Frame owner, List<UnknownParameterInformation> unknownParameters) {
super(owner, "Unknown Parameters", true);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setLayout(new BorderLayout());
setModal(true);
// text
JTextArea text = new JTextArea();
text.setLineWrap(true);
text.setWrapStyleWord(true);
text.setBackground(getBackground());
text.setEditable(false);
String textString = "The following table shows all parameters which are not (no longer) valid. This can happen for several reasons. First, a mistake in the parameter name can cause this error. Second, a parameter was removed and is now no longer supported. Third, a parameter was replaced by a (set of) other parameter(s). Please ensure that the process still performs the desired task by checking the parameter settings manually.";
text.setText(textString);
text.setBorder(BorderFactory.createEmptyBorder(11, 11, 11, 11));
add(text, BorderLayout.NORTH);
// table
ExtendedJTable table = new ExtendedJTable(new UnknownParametersTableModel(unknownParameters), true, true, true);
ExtendedJScrollPane pane = new ExtendedJScrollPane(table);
pane.setBorder(BorderFactory.createEmptyBorder(11, 11, 11, 11));
add(pane, BorderLayout.CENTER);
// ok button
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
JButton okButton = new JButton("Ok");
okButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ok();
}
});
buttonPanel.add(okButton);
add(buttonPanel, BorderLayout.SOUTH);
setSize(640, 480);
setLocationRelativeTo(owner);
}
示例15: DialogFrame
import javax.swing.JTextArea; //导入方法依赖的package包/类
public DialogFrame() {
setType(Type.POPUP);
setResizable(false);
setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE);
this.setTitle("Approving question");
this.setPreferredSize(new Dimension(400, 190));
this.setAlwaysOnTop(isAlwaysOnTopSupported());
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
getContentPane().setLayout(new BorderLayout());
final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation(screenSize.width / 2 - 150, screenSize.height / 2 - 75);
this.setIconImage(Toolkit.getDefaultToolkit().
getImage(getClass().getResource(LOGOPATH)));
final JPanel panel = new JPanel();
panel.setAutoscrolls(true);
getContentPane().add(panel, BorderLayout.CENTER);
panel.setLayout(null);
btnYes = new JButton("YES");
btnYes.setBorder(new SoftBevelBorder(BevelBorder.RAISED, null, null, null, null));
btnYes.setBounds(291, 129, 91, 29);
panel.add(btnYes);
btnNo = new JButton("NO");
btnNo.setBorder(new SoftBevelBorder(BevelBorder.RAISED, null, null, null, null));
btnNo.setBounds(199, 129, 91, 29);
panel.add(btnNo);
lblIcon = new JLabel("");
lblIcon.setIcon(new ImageIcon(DialogFrame.class.getResource("/com/coder/hms/icons/dialogPane_question.png")));
lblIcon.setBounds(14, 40, 69, 70);
panel.add(lblIcon);
textArea = new JTextArea();
textArea.setDisabledTextColor(new Color(153, 204, 255));
textArea.setBounds(95, 32, 287, 85);
textArea.setBackground(UIManager.getColor("ComboBox.background"));
textArea.setBorder(null);
textArea.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
textArea.setEditable(false);
textArea.setFont(new Font("Monospaced", Font.PLAIN, 14));
textArea.setLineWrap(true);
panel.add(textArea);
this.pack();
}