javax.swing.JTextPane.setMargin()方法的使用及代码示例

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

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

JTextPane.setMargin介绍

暂无

代码示例

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

public Console() {
  super("Console");
  JTextPane consoleMessages = new JTextPane();
  consoleMessages.setMargin(new Insets(2, 20, 2, 5));
  consoleMessages.setFont(Theme.EDITOR_FONT);
  consoleMessages.setEditable(false);

代码示例来源:origin: Audiveris/audiveris

/**
 * Create the log pane, with a standard mailbox.
 */
public LogPane ()
{
  // Build the scroll pane
  component = new JScrollPane();
  component.setBorder(null);
  // log/status area
  logArea = new JTextPane();
  logArea.setEditable(false);
  logArea.setMargin(new Insets(5, 5, 5, 5));
  document = (AbstractDocument) logArea.getStyledDocument();
  // Let the scroll pane display the log area
  component.setViewportView(logArea);
}

代码示例来源:origin: org.owasp.jbrofuzz/jbrofuzz

JTextPane createSimplePane() {
  JTextPane textPane = new JTextPane();
  textPane.setMargin(new Insets(1, 1, 1, 1));
  textPane.setBackground(Color.WHITE);
  textPane.setForeground(Color.BLACK);
  return textPane;
}

代码示例来源:origin: org.owasp.jbrofuzz/jbrofuzz

protected HashPanel(final String header) {

  super(new BorderLayout());
  
  setBorder(BorderFactory.createCompoundBorder(BorderFactory
      .createTitledBorder(header), BorderFactory.createEmptyBorder(
          5, 5, 5, 5)));
  
  // Text panes -> Comments
  hashTextPane = new JTextPane();
  
  hashTextPane.putClientProperty("charset", "UTF-8");
  hashTextPane.setEditable(false);
  hashTextPane.setVisible(true);
  hashTextPane.setFont(new Font("Verdana", Font.BOLD, 10));
  hashTextPane.setMargin(new Insets(1, 1, 1, 1));
  hashTextPane.setBackground(Color.LIGHT_GRAY);
  hashTextPane.setForeground(new Color(51, 51, 102));
  final JScrollPane hashScrollPane = new JScrollPane(hashTextPane,
      JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
      JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  this.add(hashScrollPane, BorderLayout.CENTER);
  
  hashTextPane.setText("Select Alt + Enter to Encode / Alt + Backspace to decode");
}

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

painter = new QueryPainter(obdaModel, trgQueryTextPane);
trgQueryTextPane.setMargin(new Insets(4, 4, 4, 4));
srcQueryTextPane.setMargin(new Insets(4, 4, 4, 4));
sqlpainter = new SQLQueryPainter(srcQueryTextPane);
mapTextPane.setMargin(new Insets(4, 4, 4, 4));

代码示例来源:origin: uwolfer/gerrit-intellij-plugin

public LoginPanel(final LoginDialog dialog) {
  hostTextField.getEmptyText().setText("https://review.example.org");
  hostTextField.addFocusListener(new FocusAdapter() {
    @Override
    public void focusLost(FocusEvent e) {
      SettingsPanel.fixUrl(hostTextField);
    }
  });
  DocumentListener listener = new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      dialog.clearErrors();
    }
  };
  loginTextField.getDocument().addDocumentListener(listener);
  passwordField.getDocument().addDocumentListener(listener);
  gerritLoginInfoTestField.setText(LOGIN_CREDENTIALS_INFO);
  gerritLoginInfoTestField.setMargin(new Insets(5, 0, 0, 0));
  gerritLoginInfoTestField.setBackground(UIUtil.TRANSPARENT_COLOR);
}

代码示例来源:origin: org.codehaus.izpack/izpack-panel

descriptionField.setMargin(new Insets(2, 2, 2, 2));
descriptionField.setAlignmentX(LEFT_ALIGNMENT);
descriptionField.setCaretPosition(0);

代码示例来源:origin: org.netbeans.api/org-jruby

public ConsoleFacade(String bannerText) {
  textPane = new JTextPane();
textPane.setMargin(new Insets(4, 4, 0, 4));
  textPane.setCaretColor(new Color(0xa4, 0x00, 0x00));
  textPane.setBackground(new Color(0xf2, 0xf2, 0xf2));
  textPane.setForeground(new Color(0xa4, 0x00, 0x00));
  Font font = findFont("Monospaced", Font.PLAIN, 14,
             new String[] {"Monaco", "Andale Mono"});
  textPane.setFont(font);
  scrollPane = new JScrollPane(textPane);
  scrollPane.setDoubleBuffered(true);
  if ( bannerText != null ) {
    bannerText = "  " + bannerText + "  \n\n";
  }
  adaptor = new TextAreaReadline(textPane, bannerText);
  inputStream = adaptor.getInputStream();
  outputStream = new PrintStream(adaptor.getOutputStream());
  errorStream = new PrintStream(adaptor.getOutputStream());
}

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

static void updateMargin(JTextPane textPane) {
  JViewport viewport = (JViewport)
    SwingUtilities.getAncestorOfClass(JViewport.class, textPane);

  if (viewport != null) {
    Insets margin = textPane.getMargin();

    int len = textPane.getDocument().getLength();
    try {
      Rectangle end = textPane.modelToView(len);
      if (end != null) {
        margin.bottom = viewport.getHeight() - end.height;
        textPane.setMargin(margin);
      }
    } catch (BadLocationException e) {
      throw new RuntimeException(e);
    }
  }
}

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

text.setText("");
text.setFont( font );
text.setMargin( new Insets(7,5,7,5) );
text.addKeyListener(this);
setViewportView(text);

代码示例来源:origin: org.codehaus.izpack/izpack-panel

label.setMargin(new Insets(3, 0, 3, 0));

代码示例来源:origin: org.owasp.jbrofuzz/jbrofuzz

private JTextPane createEditablePane() {
  JTextPane textPane = new JTextPane();
  // Get the preferences for wrapping lines of text
  final boolean wrapText = JBroFuzz.PREFS.getBoolean(
      JBroFuzzPrefs.FUZZING[2].getId(), false);
  if (wrapText) {
    textPane = new JTextPane();
  } else {
    textPane = new NonWrappingTextPane();
  }
  textPane.putClientProperty("charset", "UTF-8");
  textPane.setEditable(true);
  textPane.setVisible(true);
  textPane.setFont(new Font("Verdana", Font.PLAIN, 12));
  textPane.setMargin(new Insets(1, 1, 1, 1));
  textPane.setBackground(Color.WHITE);
  textPane.setForeground(Color.BLACK);
  // Set the editor kit responsible for highlighting
  textPane.setEditorKit(new StyledEditorKit() {
    private static final long serialVersionUID = -6085642347022880064L;
    public Document createDefaultDocument() {
      return new TextHighlighter();
    }
  });
  // Right click: Cut, Copy, Paste, Select All
  RightClickPopups.rightClickRequestTextComponent(this, textPane);
  return textPane;
}

代码示例来源:origin: cytoscape.coreplugins/cpath

/**
 * No Arg Constructor.
 */
public ConsolePanel () {
  this.setLayout(new BorderLayout());
  ta = new JTextPane();
  ta.setMargin(new Insets(5, 7, 5, 7));
  ta.setEditable(false);
  ta.setBackground(Color.WHITE);
  ta.setForeground(Color.BLACK);
  addStylesToDocument(ta.getStyledDocument());
  Font font = new Font("Courier", Font.PLAIN, 12);
  ta.setFont(font);
  scrollPane = new JScrollPane(ta);
  StyledDocument doc = ta.getStyledDocument();
  try {
    doc.insertString(doc.getLength(), "Note:  As of January 1, 2008, the " +
        "cPath plugin will continue to operate, but will no longer be maintained.  "
        + "Users are advised to use the Pathway Commons plugin instead. "
        + "\n\nTo access the Pathway Commons plugin, select File -> Import -> "
        + "Network from Web Services, and select the Pathway Commons Web Service."
        + "\n\n", doc.getStyle("red-bold"));
  } catch (BadLocationException e) {
  }
  add(scrollPane, BorderLayout.CENTER);
}

代码示例来源:origin: fr.inria.wimmics/kggui

textPaneQuery.setMargin(new Insets(1, 1, 1, 1));
textPaneQuery.setText("Default text");

代码示例来源:origin: Wimmics/corese

textPaneQuery.setMargin(new Insets(1, 1, 1, 1));
textPaneQuery.setText("Default text");

代码示例来源:origin: KokaKiwi/MCLauncher

editorPane.setBackground(Color.DARK_GRAY);
editorPane.setEditable(false);
editorPane.setMargin(null);

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui

jtpFontPreview.setEditorKit(kitFontPreview);
jtpFontPreview.setDocument(docFontPreview);
jtpFontPreview.setMargin(new Insets(4, 4, 4, 4));
jtpFontPreview.setBounds(0, 0, 120, 18);
jtpFontPreview.setText(getFontSampleString(defaultText));

代码示例来源:origin: org.gosu-lang.gosu/gosu-editor

_outputPanel.setMargin( new Insets( 10, 10, 10, 10 ) );
_outputPanel.setForeground( Color.white );
_outputPanel.setBackground( Color.black );

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

_outputPanel.setMargin( new Insets( 10, 10, 10, 10 ) );
_outputPanel.setForeground( new Color( 92, 225, 92 ) );
_outputPanel.setBackground( new Color( 20, 20, 20 ) );

代码示例来源:origin: featurecat/lizzie

commentPane.setMargin(new Insets(5, 5, 5, 5));
commentPane.setBackground(Lizzie.config.commentBackgroundColor);
commentPane.setForeground(Lizzie.config.commentFontColor);

相关文章

JTextPane类方法