本文整理了Java中javax.swing.JTextArea.setMargin()
方法的一些代码示例,展示了JTextArea.setMargin()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextArea.setMargin()
方法的具体详情如下:
包路径:javax.swing.JTextArea
类名称:JTextArea
方法名:setMargin
暂无
代码示例来源:origin: org.codehaus.groovy/groovy
private void jbInit(Reader reader) throws Exception {
final Border border = BorderFactory.createEmptyBorder();
jSplitPane1.setOrientation(JSplitPane.VERTICAL_SPLIT);
tokenPane.setEditable(false);
tokenPane.setText("");
scriptPane.setFont(new java.awt.Font("DialogInput", 0, 12));
scriptPane.setEditable(false);
scriptPane.setMargin(new Insets(5, 5, 5, 5));
scriptPane.setText("");
jScrollPane1.setBorder(border);
jScrollPane2.setBorder(border);
jSplitPane1.setMinimumSize(new Dimension(800, 600));
mainPanel.add(jSplitPane1, BorderLayout.CENTER);
if (reader == null) {
mainPanel.add(jbutton, BorderLayout.NORTH);
}
this.getContentPane().add(mainPanel);
jSplitPane1.add(jScrollPane1, JSplitPane.LEFT);
jScrollPane1.getViewport().add(tokenPane, null);
jSplitPane1.add(jScrollPane2, JSplitPane.RIGHT);
jScrollPane2.getViewport().add(scriptPane, null);
jScrollPane1.setColumnHeaderView(new JLabel(" Token Stream:"));
jScrollPane2.setColumnHeaderView(new JLabel(" Input Script:"));
jSplitPane1.setResizeWeight(0.5);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Create a new Dialog with a title and a message.
* @param message
* @param title
*/
public ErrorDialog(String message, String title) {
setTitle(title);
setSize(new Dimension(600, 400));
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
setLocationRelativeTo(null);
Container container = getContentPane();
container.setLayout(new BorderLayout());
JTextArea textArea = new JTextArea();
textArea.setText(message);
textArea.setEditable(false);
textArea.setMargin(new Insets(PADDING, PADDING, PADDING, PADDING));
add(new JScrollPane(textArea), BorderLayout.CENTER);
final JDialog dialog = this;
JButton button = new JButton(new AbstractAction("OK"){
@Override
public void actionPerformed(ActionEvent e) {
dialog.dispose();
}
});
add(button, BorderLayout.SOUTH);
}
代码示例来源:origin: bobbylight/RSyntaxTextArea
/**
* Overridden to update the current line highlight location.
*
* @param insets The new insets.
*/
@Override
public void setMargin(Insets insets) {
Insets old = getInsets();
int oldTop = old!=null ? old.top : 0;
int newTop = insets!=null ? insets.top : 0;
if (oldTop!=newTop) {
// The entire editor will be automatically repainted if it is
// visible, so no need to call repaint() or forceCurrentLine...().
previousCaretY = currentCaretY = newTop;
}
super.setMargin(insets);
}
代码示例来源:origin: eclipse/hono
private void setDescriptionTextAreaDesign(final JTextArea jTextArea, final JPanel parentPanel) {
jTextArea.setLineWrap(true);
jTextArea.setWrapStyleWord(true);
jTextArea.setEditable(false);
jTextArea.setMargin(new Insets(15, 15, 15, 15));
jTextArea.setBackground(parentPanel.getBackground());
jTextArea.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1));
}
代码示例来源:origin: freeplane/freeplane
static public void showMessage(String message, int messageType) {
backOtherWindows();
JTextArea infoPane = new JTextArea();
infoPane.setEditable(false);
infoPane.setMargin(new Insets(5,5,5,5));
infoPane.setLineWrap(true);
infoPane.setWrapStyleWord(true);
infoPane.setText(message);
infoPane.setColumns(60);
JScrollPane scrollPane = new JScrollPane(infoPane);
scrollPane.setPreferredSize(new Dimension(400, 200));
JOptionPane.showMessageDialog(getCurrentRootComponent(), scrollPane, "Freeplane", messageType);
}
public static int showConfirmDialog(final NodeModel node, final Object message, final String title,
代码示例来源:origin: com.fifesoft/rsyntaxtextarea
/**
* Overridden to update the current line highlight location.
*
* @param insets The new insets.
*/
@Override
public void setMargin(Insets insets) {
Insets old = getInsets();
int oldTop = old!=null ? old.top : 0;
int newTop = insets!=null ? insets.top : 0;
if (oldTop!=newTop) {
// The entire editor will be automatically repainted if it is
// visible, so no need to call repaint() or forceCurrentLine...().
previousCaretY = currentCaretY = newTop;
}
super.setMargin(insets);
}
代码示例来源:origin: sing-group/GC4S
protected JTextArea getDescriptionPane() {
if (this.textArea == null) {
this.textArea = new JTextArea(
getDescription());
this.textArea.setMargin(new Insets(10, 10, 10, 10));
this.textArea.setWrapStyleWord(true);
this.textArea.setLineWrap(true);
this.textArea.setEditable(false);
this.textArea.setBackground(Color.WHITE);
this.textArea.setOpaque(true);
}
return this.textArea;
}
代码示例来源:origin: mikaelhg/openblocks
public CToolTipUI(Color background) {
super();
this.background = background;
renderer = new CellRendererPane();
textArea = new JTextArea();
textArea.setMargin(new Insets(0, 3, 0, 0));
renderer.removeAll();
renderer.add(textArea);
textArea.setFont(new Font("Ariel", Font.PLAIN, 11));
textArea.setWrapStyleWord(true);
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
}
代码示例来源:origin: biojava/biojava
public GUIAlignmentProgressListener(){
super(new BorderLayout());
stopButton = new JButton("Stop");
stopButton.setActionCommand("Stop");
stopButton.addActionListener(this);
progressBar = new JProgressBar(0, 100);
progressBar.setValue(0);
progressBar.setStringPainted(true);
taskOutput = new JTextArea(5, 20);
taskOutput.setMargin(new Insets(5,5,5,5));
taskOutput.setEditable(false);
JPanel panel = new JPanel();
panel.add(stopButton);
panel.add(progressBar);
add(panel, BorderLayout.PAGE_START);
add(new JScrollPane(taskOutput), BorderLayout.CENTER);
setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
}
代码示例来源: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: stackoverflow.com
messageField.setMargin(new Insets(10, 10, 10, 10));
messageBoard.add(messageField);
add(messageBoard, BorderLayout.NORTH);
typeField.setMargin(new Insets(10, 10, 10, 10));
typeBoard.add(typeField);
代码示例来源:origin: stackoverflow.com
private static final long serialVersionUID = 1L;
public Note() {
createContent(); // add this line into your code.
int x = 400;
int y = 300;
this.setSize(new Dimension(x, y));
this.setTitle("Post-It Note");
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public JScrollPane createContent(){
Color textAreaColor = new Color(248, 247, 235);
JTextArea textArea = new JTextArea();
JScrollPane scrollPane = new JScrollPane(textArea);
scrollPane.setBorder(null);
textArea.setBackground(textAreaColor);
scrollPane.setBackground(textAreaColor);
textArea.setMargin(new Insets(10, 15, 20, 20));
this.add(scrollPane, BorderLayout.CENTER);
return null;
}
public static void main(String[] args) {
new Note();
// mainWindow.createContent(); comment this line...
}
代码示例来源:origin: chatty/chatty
changelog.setColumns(87);
changelog.setRows(30);
changelog.setMargin(new Insets(5, 5, 5, 5));
代码示例来源:origin: org.codehaus.groovy/groovy-all-minimal
private void jbInit() throws Exception{
border1 = BorderFactory.createEmptyBorder();
border2 = BorderFactory.createEmptyBorder();
jSplitPane1.setOrientation(JSplitPane.VERTICAL_SPLIT);
tokenPane.setEditable(false);
tokenPane.setText("");
scriptPane.setFont(new java.awt.Font("DialogInput", 0, 12));
scriptPane.setEditable(false);
scriptPane.setMargin(new Insets(5, 5, 5, 5));
scriptPane.setText("");
jScrollPane1.setBorder(border1);
jScrollPane2.setBorder(border1);
jSplitPane1.setMinimumSize(new Dimension(800,600));
mainPanel.add(jSplitPane1, BorderLayout.CENTER);
mainPanel.add(jbutton,BorderLayout.NORTH);
this.getContentPane().add(mainPanel);
jSplitPane1.add(jScrollPane1, JSplitPane.LEFT);
jScrollPane1.getViewport().add(tokenPane, null);
jSplitPane1.add(jScrollPane2, JSplitPane.RIGHT);
jScrollPane2.getViewport().add(scriptPane, null);
jScrollPane1.setColumnHeaderView(new JLabel(" Token Stream:"));
jScrollPane2.setColumnHeaderView(new JLabel(" Input Script:"));
jSplitPane1.setResizeWeight(0.5);
}
代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm
private void jbInit() throws Exception{
border1 = BorderFactory.createEmptyBorder();
border2 = BorderFactory.createEmptyBorder();
jSplitPane1.setOrientation(JSplitPane.VERTICAL_SPLIT);
tokenPane.setEditable(false);
tokenPane.setText("");
scriptPane.setFont(new java.awt.Font("DialogInput", 0, 12));
scriptPane.setEditable(false);
scriptPane.setMargin(new Insets(5, 5, 5, 5));
scriptPane.setText("");
jScrollPane1.setBorder(border1);
jScrollPane2.setBorder(border1);
jSplitPane1.setMinimumSize(new Dimension(800,600));
mainPanel.add(jSplitPane1, BorderLayout.CENTER);
mainPanel.add(jbutton,BorderLayout.NORTH);
this.getContentPane().add(mainPanel);
jSplitPane1.add(jScrollPane1, JSplitPane.LEFT);
jScrollPane1.getViewport().add(tokenPane, null);
jSplitPane1.add(jScrollPane2, JSplitPane.RIGHT);
jScrollPane2.getViewport().add(scriptPane, null);
jScrollPane1.setColumnHeaderView(new JLabel(" Token Stream:"));
jScrollPane2.setColumnHeaderView(new JLabel(" Input Script:"));
jSplitPane1.setResizeWeight(0.5);
}
代码示例来源:origin: org.kohsuke.droovy/groovy
private void jbInit() throws Exception{
border1 = BorderFactory.createEmptyBorder();
border2 = BorderFactory.createEmptyBorder();
jSplitPane1.setOrientation(JSplitPane.VERTICAL_SPLIT);
tokenPane.setEditable(false);
tokenPane.setText("");
scriptPane.setFont(new java.awt.Font("DialogInput", 0, 12));
scriptPane.setEditable(false);
scriptPane.setMargin(new Insets(5, 5, 5, 5));
scriptPane.setText("");
jScrollPane1.setBorder(border1);
jScrollPane2.setBorder(border1);
jSplitPane1.setMinimumSize(new Dimension(800,600));
mainPanel.add(jSplitPane1, BorderLayout.CENTER);
mainPanel.add(jbutton,BorderLayout.NORTH);
this.getContentPane().add(mainPanel);
jSplitPane1.add(jScrollPane1, JSplitPane.LEFT);
jScrollPane1.getViewport().add(tokenPane, null);
jSplitPane1.add(jScrollPane2, JSplitPane.RIGHT);
jScrollPane2.getViewport().add(scriptPane, null);
jScrollPane1.setColumnHeaderView(new JLabel(" Token Stream:"));
jScrollPane2.setColumnHeaderView(new JLabel(" Input Script:"));
jSplitPane1.setResizeWeight(0.5);
}
代码示例来源:origin: org.codehaus.groovy/groovy-jdk14
private void jbInit() throws Exception{
border1 = BorderFactory.createEmptyBorder();
border2 = BorderFactory.createEmptyBorder();
jSplitPane1.setOrientation(JSplitPane.VERTICAL_SPLIT);
tokenPane.setEditable(false);
tokenPane.setText("");
scriptPane.setFont(new java.awt.Font("DialogInput", 0, 12));
scriptPane.setEditable(false);
scriptPane.setMargin(new Insets(5, 5, 5, 5));
scriptPane.setText("");
jScrollPane1.setBorder(border1);
jScrollPane2.setBorder(border1);
jSplitPane1.setMinimumSize(new Dimension(800,600));
mainPanel.add(jSplitPane1, BorderLayout.CENTER);
mainPanel.add(jbutton,BorderLayout.NORTH);
this.getContentPane().add(mainPanel);
jSplitPane1.add(jScrollPane1, JSplitPane.LEFT);
jScrollPane1.getViewport().add(tokenPane, null);
jSplitPane1.add(jScrollPane2, JSplitPane.RIGHT);
jScrollPane2.getViewport().add(scriptPane, null);
jScrollPane1.setColumnHeaderView(new JLabel(" Token Stream:"));
jScrollPane2.setColumnHeaderView(new JLabel(" Input Script:"));
jSplitPane1.setResizeWeight(0.5);
}
代码示例来源:origin: zzhang5/zooinspector
/***
* Function to initialized components
*/
private void initComponents()
{
setSize(toasterWidth, toasterHeight);
message.setFont(getToasterMessageFont());
JPanel externalPanel = new JPanel(new BorderLayout(1, 1));
externalPanel.setBackground(getBorderColor());
JPanel innerPanel = new JPanel(new BorderLayout(getMargin(), getMargin()));
innerPanel.setBackground(getToasterColor());
message.setBackground(getToasterColor());
message.setMargin(new Insets(2, 2, 2, 2));
message.setLineWrap(true);
message.setWrapStyleWord(true);
EtchedBorder etchedBorder = (EtchedBorder) BorderFactory.createEtchedBorder();
externalPanel.setBorder(etchedBorder);
externalPanel.add(innerPanel);
message.setForeground(getMessageColor());
innerPanel.add(iconLabel, BorderLayout.WEST);
innerPanel.add(message, BorderLayout.CENTER);
getContentPane().add(externalPanel);
}
代码示例来源:origin: us.ihmc.thirdparty.jme/jme3-desktop
/**
* Create a new Dialog with a title and a message.
* @param message
* @param title
*/
public ErrorDialog(String message, String title) {
setTitle(title);
setSize(new Dimension(600, 400));
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
setLocationRelativeTo(null);
Container container = getContentPane();
container.setLayout(new BorderLayout());
JTextArea textArea = new JTextArea();
textArea.setText(message);
textArea.setEditable(false);
textArea.setMargin(new Insets(PADDING, PADDING, PADDING, PADDING));
add(new JScrollPane(textArea), BorderLayout.CENTER);
final JDialog dialog = this;
JButton button = new JButton(new AbstractAction("OK"){
@Override
public void actionPerformed(ActionEvent e) {
dialog.dispose();
}
});
add(button, BorderLayout.SOUTH);
}
内容来源于网络,如有侵权,请联系作者删除!