Java 类javax.swing.JTextPane 实例源码

项目:Motunautr    文件:HelpWindow.java   
public HelpWindow() {
    super(Main.NAME + ": Help");
    setIconImage(Main.icon);
    final JTextPane text = new JTextPane();
    text.setText("Basic Configuration:\n"
            + "Create a folder where you will put the shortcuts to display and set it in the settings\n"
            + "(it should not be the default Desktop folder, as then icons would be displayed twice).\n"
            + "Fill that folder with subfolders - these will be the different icon groups.\n"
            + "In each subfolder, place shortcuts to display, or make subfolders if you want to display not only a shortcut,\n"
            + "but some alternative shortcuts or related data too. This subfolder can be expanded with a right click on the icon later.\n"
            + "\n"
            + "Controls:\n"
            + "Left click on icon: start application or open file\n"
            + "Right click on icon: show sub-icons (if any)\n"
            + "Double click on group title: open folder in explorer\n"
            + "Middle click on icon or group title: rename file or folder");
    text.setEditable(false);
    add(text);
    pack();
}
项目:incubator-netbeans    文件:NotificationsManager.java   
public void setupPane(JTextPane pane, final File[] files, String fileNames, final File projectDir, final String url, final String revision) {
     String msg = revision == null
             ? NbBundle.getMessage(NotificationsManager.class, "MSG_NotificationBubble_DeleteDescription", fileNames, CMD_DIFF) //NOI18N
             : NbBundle.getMessage(NotificationsManager.class, "MSG_NotificationBubble_Description", fileNames, url, CMD_DIFF); //NOI18N
    pane.setText(msg);

    pane.addHyperlinkListener(new HyperlinkListener() {
        @Override
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
                if(CMD_DIFF.equals(e.getDescription())) {
                    Context ctx = new Context(files);
                    DiffAction.diff(ctx, Setup.DIFFTYPE_REMOTE, NbBundle.getMessage(NotificationsManager.class, "LBL_Remote_Changes", projectDir.getName()), false); //NOI18N
                } else if (revision != null) {
                    try {
                        SearchHistoryAction.openSearch(new SVNUrl(url), projectDir, Long.parseLong(revision));
                    } catch (MalformedURLException ex) {
                        LOG.log(Level.WARNING, null, ex);
                    }
                }
            }
        }
    });
}
项目:openvisualtraceroute    文件:LocRecordsView.java   
public LocRecordsView(final Window parent, final ServiceFactory factory) {
    super(parent, Resources.getLabel("LocRecords"), ModalityType.APPLICATION_MODAL);
    final String rawLocRecords = factory.getGeo().getLocRecordsStr();

    final JTextPane text = new JTextPane();
    text.setEditable(true);
    text.setText(rawLocRecords);
    text.setPreferredSize(new Dimension(800, 400));
    getContentPane().add(text, BorderLayout.CENTER);
    final JButton save = new JButton("Save");
    save.addActionListener(e -> {
        final Pair<String, Exception> error = factory.getGeo().parseAndLoadDNSRecords(text.getText());
        text.setText(factory.getGeo().getLocRecordsStr());
        if (StringUtils.isNotEmpty(error.getKey())) {
            JOptionPane.showMessageDialog(LocRecordsView.this, Resources.getLabel("dns.loc.warning", error.getKey()), Resources.getLabel("warning"),
                    JOptionPane.WARNING_MESSAGE);
        } else {
            JOptionPane.showMessageDialog(LocRecordsView.this, Resources.getLabel("dns.loc.updated"));
            LocRecordsView.this.dispose();
        }
    });
    getContentPane().add(save, BorderLayout.SOUTH);
    pack();
    setLocationRelativeTo(parent);
    setVisible(true);
}
项目:Tarski    文件:OurAntiAlias.java   
/** Constructs an antialias-capable JTextPane with a DefaultHighlighter associated with it.
 * @param attributes - see {@link edu.mit.csail.sdg.alloy4.OurUtil#make OurUtil.make(component, attributes...)}
 */
public static JTextPane pane(Object... attributes) {
   JTextPane ans = new JTextPane() {
      static final long serialVersionUID = 0;
      @Override public void paint(Graphics gr) {
         if (antiAlias && gr instanceof Graphics2D) {
            ((Graphics2D)gr).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
         }
         super.paint(gr);
      }
   };
   OurUtil.make(ans, attributes);
   ans.setHighlighter(new DefaultHighlighter());
   map.put(ans, Boolean.TRUE);
   return ans;
}
项目:incubator-netbeans    文件:MiniEdit.java   
public void cut() {
    if (doCopy()) {
        Doc doc = getSelectedDoc();
        JTextPane pane = doc.getTextPane();
        int start = pane.getSelectionStart();
        int end = pane.getSelectionEnd();
        if (start == end) {
            throw new IllegalStateException ("no selection");
        }
        try {
            pane.getDocument().remove(start, end-start);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } else {
        throw new NullPointerException ("no document");
    }
}
项目:DIA-Umpire-Maven    文件:DocumentHandler.java   
/**
 * Constructor
 *
 * @param textPane
 */
public DocumentHandler(JTextPane textPane) {
    this.textPane = textPane;
    setFormatter(new RecordFormatter());

    StyledDocument document = (StyledDocument) this.textPane.getDocument();

    infoStyle = document.addStyle("INFO", null);
    StyleConstants.setFontFamily(infoStyle, "Monospaced");
    StyleConstants.setBackground(infoStyle, Color.white);
    StyleConstants.setForeground(infoStyle, Color.blue);

    severStyle = document.addStyle("SEVER", null);
    StyleConstants.setFontFamily(severStyle, "Monospaced");
    StyleConstants.setBackground(severStyle, Color.white);
    StyleConstants.setForeground(severStyle, Color.red);
}
项目:incubator-netbeans    文件:SummaryCellRenderer.java   
private void addDate (JTextPane pane, RevisionItem item, boolean selected, Collection<SearchHighlight> highlights) throws BadLocationException {

            LogEntry entry = item.getUserData();
            StyledDocument sd = pane.getStyledDocument();
            // clear document
            clearSD(pane, sd);

            Style selectedStyle = createSelectedStyle(pane);
            Style normalStyle = createNormalStyle(pane);
            Style style;
            if (selected) {
                style = selectedStyle;
            } else {
                style = normalStyle;
            }

            // add date
            sd.insertString(sd.getLength(), entry.getDate(), style);
        }
项目:JavaGraph    文件:HelpFactory.java   
/**
 * Creates a default help panel, listing all the setting kinds for a given exploration key
 * with corresponding explanations.
 */
protected JTextPane createDefaultHelp(ExploreKey key) {
    JTextPane result = createTextPane();
    StringBuilder text = getExplanation(key);
    StringBuilder list = new StringBuilder();
    HTMLTag dt = new HTMLTag("dt");
    HTMLTag dd = new HTMLTag("dd");
    HTMLTag strong = HTMLConverter.STRONG_TAG;
    for (SettingKey kind : key.getKindType()
        .getEnumConstants()) {
        list.append(dt.on(strong.on(StringHandler.toUpper(kind.getName()))));
        list.append(dd.on(kind.getExplanation()));
    }
    new HTMLTag("dl").on(list);
    text.append(list);
    result.setText(text.toString());
    return result;
}
项目:QN-ACTR-Release    文件:SynopsisPanel.java   
private void initComponents() {
    Box vBox = Box.createVerticalBox();
    Box hBox = Box.createHorizontalBox();
    synView = new JTextPane();
    synView.setContentType("text/html");
    synView.setEditable(false);
    synScroll = new JScrollPane(synView);
    synScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    synScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    vBox.add(Box.createVerticalStrut(20));
    vBox.add(hBox);
    vBox.add(Box.createVerticalStrut(20));
    hBox.add(Box.createHorizontalStrut(20));
    hBox.add(synScroll);
    hBox.add(Box.createHorizontalStrut(20));
    this.setLayout(new GridLayout(1, 1));
    this.add(vBox);
}
项目:openjdk-jdk10    文件:JViewPortBackingStoreImageTest.java   
private static JComponent createComponent() {
    createStyles();
    for (int i = 0; i < data.length; i++) {
        Paragraph p = data[i];
        addParagraph(p);
    }

    JTextPane textPane = new JTextPane(doc);

    JScrollPane scroller = new JScrollPane();
    JViewport port = scroller.getViewport();
    port.setScrollMode(JViewport.BACKINGSTORE_SCROLL_MODE);
    port.add(textPane);

    return scroller;
}
项目:incubator-netbeans    文件:KenaiNotificationListener.java   
@Override
protected void setupPane(JTextPane pane, final File[] files, final File projectDir, final String url, final String revision) {
    String text = NbBundle.getMessage(
            KenaiNotificationListener.class,
            "MSG_NotificationBubble_Description", 
            getFileNames(files),
            HgKenaiAccessor.getInstance().getRevisionUrl(url, revision)); //NOI18N
    pane.setText(text);

    pane.addHyperlinkListener(new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
                URL url = e.getURL();
                assert url != null;
                HtmlBrowser.URLDisplayer displayer = HtmlBrowser.URLDisplayer.getDefault ();
                assert displayer != null : "HtmlBrowser.URLDisplayer found.";   //NOI18N
                if (displayer != null) {
                    displayer.showURL (url);
                } else {
                    Mercurial.LOG.info("No URLDisplayer found.");               //NOI18N
                }
            }
        }
    });
}
项目:JavaGraph    文件:HelpFactory.java   
/** Creates the help panel for the isomorphism checking setting. */
protected JTextPane createRandomHelp(BooleanKey kind) {
    JTextPane result = createTextPane();
    StringBuilder text = getExplanation(ExploreKey.RANDOM);
    text.append("Determines if successor states are explored in random order.");
    text.append(HTMLConverter.HTML_LINEBREAK);
    text.append(HTMLConverter.HTML_LINEBREAK);
    switch (kind) {
    case FALSE:
        text.append(
            "Currently set to <b>false</b>, meaning that when the successors of a given state "
                + "are explored, the next state to be picked is determined by the search strategy "
                + "and deterministally fixed between one exploration and the next.");
        break;
    case TRUE:
        text.append("Currently set to <b>true</b>, meaning that whenever the next successor of "
            + "a given state is explored, a random choice is made between the as yet unexplored "
            + "states.");
        break;
    default:
        assert false;
    }
    result.setText(text.toString());
    return result;
}
项目:Tarski    文件:OurAntiAlias.java   
/** Constructs an antialias-capable JTextPane with a DefaultHighlighter associated with it.
 * @param attributes - see {@link edu.mit.csail.sdg.alloy4.OurUtil#make OurUtil.make(component, attributes...)}
 */
public static JTextPane pane(Object... attributes) {
   JTextPane ans = new JTextPane() {
      static final long serialVersionUID = 0;
      @Override public void paint(Graphics gr) {
         if (antiAlias && gr instanceof Graphics2D) {
            ((Graphics2D)gr).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
         }
         super.paint(gr);
      }
   };
   OurUtil.make(ans, attributes);
   ans.setHighlighter(new DefaultHighlighter());
   map.put(ans, Boolean.TRUE);
   return ans;
}
项目:fuck_zookeeper    文件:NodeViewerData.java   
/**
* 
*/
  public NodeViewerData() {
      this.setLayout(new BorderLayout());
      this.dataArea = new JTextPane();
      this.toolbar = new JToolBar();
      this.toolbar.setFloatable(false);
      JScrollPane scroller = new JScrollPane(this.dataArea);
      scroller
              .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
      this.add(scroller, BorderLayout.CENTER);
      this.add(this.toolbar, BorderLayout.NORTH);
      JButton saveButton = new JButton(ZooInspectorIconResources
              .getSaveIcon());
      saveButton.addActionListener(new ActionListener() {

          public void actionPerformed(ActionEvent e) {
              if (selectedNode != null) {
                  if (JOptionPane.showConfirmDialog(NodeViewerData.this,
                          "Are you sure you want to save this node?"
                                  + " (this action cannot be reverted)",
                          "Confirm Save", JOptionPane.YES_NO_OPTION,
                          JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) {
                      zooInspectorManager.setData(selectedNode, dataArea
                              .getText());
                  }
              }
          }
      });
      this.toolbar.add(saveButton);

  }
项目:MaxSim    文件:BookmarkableLogViewer.java   
private void init() {
    txpText = new JTextPane();
    txpLines = new JTextPane();

    // needed for correct layouting
    Insets ins = txpLines.getInsets();
    txpLines.setMargin(new Insets(ins.top + 1, ins.left, ins.bottom, ins.right));

    textHighlighter = new BookmarkHighlighter();
    lineHighlighter = new BookmarkHighlighter();

    txpText.setHighlighter(textHighlighter);
    //txpText.setMinimumSize(new Dimension(100, 100));
    txpText.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
    txpText.setEditable(false);

    txpLines.setHighlighter(lineHighlighter);
    txpLines.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
    txpLines.setBackground(Color.LIGHT_GRAY);
    txpLines.setEnabled(false);
    txpLines.setForeground(Color.BLACK);
    txpLines.addMouseListener(mouseInputListener);

    fm = txpText.getFontMetrics(txpText.getFont());

    JPanel pnlBookmarks = new JPanel();
    pnlBookmarks.setLayout(new BorderLayout());
    pnlBookmarks.add(txpText, BorderLayout.CENTER);

    JScrollPane jspBookmarks = new JScrollPane(pnlBookmarks);
    jspBookmarks.setRowHeaderView(txpLines);
    jspBookmarks.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    jspBookmarks.getVerticalScrollBar().setUnitIncrement(15);

    this.setLayout(new BorderLayout());
    this.add(jspBookmarks, BorderLayout.CENTER);
}
项目:litiengine    文件:Program.java   
private static Component initConsole() {
  Logger root = Logger.getLogger("");
  JTextPane consoleTextArea = new JTextPane();
  JScrollPane consoleScrollPane = new JScrollPane();
  consoleScrollPane.setViewportBorder(null);
  consoleScrollPane.setViewportView(consoleTextArea);

  consoleTextArea.setEditable(false);
  consoleTextArea.setBackground(Color.DARK_GRAY);
  consoleTextArea.setAutoscrolls(true);
  root.addHandler(new ConsoleLogHandler(consoleTextArea));
  return consoleScrollPane;
}
项目:DicomViewer    文件:CLEditor.java   
public static int getRow(int pos, JTextPane editor) {
    int rn = (pos == 0) ? 1 : 0;
    try {
        int offs = pos;
        while (offs > 0) {
            offs = Utilities.getRowStart(editor, offs) - 1;
            rn++;
        }
    } catch (BadLocationException e) {
    }
    return rn;
}
项目:incubator-netbeans    文件:FindTypesSupport.java   
private Highlight getHighlight(JTextPane pane, int offset) {
    List<Highlight> highlights = getHighlights(pane);
    Highlight h = null;
    for (int i = 0; i < highlights.size(); i++) {
        h = highlights.get(i);
        if(h.startOffset <= offset && h.endOffset >= offset) {
            break;
        } 
        h = null;
    }
    return h;
}
项目:Mujeed-Arabic-Prolog    文件:FromGui.java   
public static void insert(JTextPane interpreter, String text, Color color) {
    StyledDocument doc = interpreter.getStyledDocument();
    Style style = interpreter.addStyle("Style", null);
       StyleConstants.setForeground(style, color);
       try {
        doc.insertString(doc.getLength(), text ,style);
        //((AbstractDocument)interpreter.getDocument()).setDocumentFilter(new NonEditableLineDocumentFilter());
    } catch (BadLocationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } 
    //doc.insertString( doc.getEndPosition().getOffset(), "Hello you can't edit this!", null );

}
项目:call-IDE    文件:ReadStdOut.java   
/**
 * Description: Handles the System.out from a forked process
 * @param p forked process
 * @param t pane that the err stream going to be directed
 */
public ReadStdOut(Process p,JTextPane t) {
    finish = false;
    process = p;
    reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
    console = t;
    read = new Thread(this);
    read.start();
}
项目:incubator-netbeans    文件:StackTraceSupport.java   
private static void underlineStacktraces(StyledDocument doc, JTextPane textPane, List<StackTracePosition> stacktraces, String comment) {
    Style defStyle = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE);
    Style hlStyle = doc.addStyle("regularBlue-stacktrace", defStyle); // NOI18N
    hlStyle.addAttribute(HyperlinkSupport.STACKTRACE_ATTRIBUTE, new StackTraceAction());
    StyleConstants.setForeground(hlStyle, UIUtils.getLinkColor());
    StyleConstants.setUnderline(hlStyle, true);

    int last = 0;
    textPane.setText(""); // NOI18N
    for (StackTraceSupport.StackTracePosition stp : stacktraces) {
        int start = stp.getStartOffset();
        int end = stp.getEndOffset();

        if (last < start) {
            insertString(doc, comment, last, start, defStyle);
        }
        last = start;

        // for each line skip leading whitespaces (look bad underlined)
        boolean inStackTrace = (comment.charAt(start) > ' ');
        for (int i = start; i < end; i++) {
            char ch = comment.charAt(i);
            if ((inStackTrace && ch == '\n') || (!inStackTrace && ch > ' ')) {
                insertString(doc, comment, last, i, inStackTrace ? hlStyle : defStyle);
                inStackTrace = !inStackTrace;
                last = i;
            }
        }

        if (last < end) {
            insertString(doc, comment, last, end, inStackTrace ? hlStyle : defStyle);
        }
        last = end;
    }
    try {
        doc.insertString(doc.getLength(), comment.substring(last), defStyle);
    } catch (BadLocationException ex) {
        Support.LOG.log(Level.SEVERE, null, ex);
    }
}
项目:Mujeed-Arabic-Prolog    文件:SearchListener.java   
@Override
public void insertUpdate(DocumentEvent e) {
    // TODO Auto-generated method stub
    JPanel panel = (JPanel) PrincipalWindow.tabbedPaneProgram.getComponentAt(PrincipalWindow.tabbedPaneProgram.getSelectedIndex());
    JScrollPane scrollpane = (JScrollPane) panel.getComponent(0);
    JTextPane textPane = (JTextPane) scrollpane.getViewport().getComponent(0);
    search(textPane);

}
项目:openjdk-jdk10    文件:JTextPaneOperator.java   
/**
 * Maps {@code JTextPane.addStyle(String, Style)} through queue
 */
public Style addStyle(final String string, final Style style) {
    return (runMapping(new MapAction<Style>("addStyle") {
        @Override
        public Style map() {
            return ((JTextPane) getSource()).addStyle(string, style);
        }
    }));
}
项目:incubator-netbeans    文件:HyperlinkSupport.java   
@Override
public void mouseMoved(MouseEvent e) {
    JTextPane pane = (JTextPane)e.getSource();
    StyledDocument doc = pane.getStyledDocument();
    Element elem = doc.getCharacterElement(pane.viewToModel(e.getPoint()));
    AttributeSet as = elem.getAttributes();
    if (StyleConstants.isUnderline(as)) {
        pane.setCursor(new Cursor(Cursor.HAND_CURSOR));
    } else {
        pane.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    }
}
项目:incubator-netbeans    文件:TooltipWindow.java   
@Override
public void computeBounds (JTextPane textPane) {
    Rectangle tpBounds = textPane.getBounds();
    TextUI tui = textPane.getUI();
    this.bounds = new Rectangle();
    try {
        Rectangle startr = tui.modelToView(textPane, docstart, Position.Bias.Forward).getBounds();
        Rectangle endr = tui.modelToView(textPane, docend, Position.Bias.Backward).getBounds();
        this.bounds = new Rectangle(tpBounds.x + startr.x, startr.y, endr.x - startr.x, startr.height);
    } catch (BadLocationException ex) {
        Exceptions.printStackTrace(ex);
    }
}
项目:openjdk-jdk10    文件:JTextPaneOperator.java   
/**
 * Maps {@code JTextPane.insertIcon(Icon)} through queue
 */
public void insertIcon(final Icon icon) {
    runMapping(new MapVoidAction("insertIcon") {
        @Override
        public void map() {
            ((JTextPane) getSource()).insertIcon(icon);
        }
    });
}
项目:openjdk-jdk10    文件:JTextPaneOperator.java   
/**
 * Maps {@code JTextPane.setParagraphAttributes(AttributeSet, boolean)}
 * through queue
 */
public void setParagraphAttributes(final AttributeSet attributeSet, final boolean b) {
    runMapping(new MapVoidAction("setParagraphAttributes") {
        @Override
        public void map() {
            ((JTextPane) getSource()).setParagraphAttributes(attributeSet, b);
        }
    });
}
项目:incubator-netbeans    文件:MiniEdit.java   
private boolean hasSelection() {
    Doc doc = getSelectedDoc();
    if (doc == null) {
        return false;
    }
    JTextPane pane = doc.getTextPane();
    return pane.getSelectionStart() != pane.getSelectionEnd();
}
项目:Mujeed-Arabic-Prolog    文件:JFontChooser.java   
private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed

    for (int i=0; i<PrincipalWindow.tabbedPaneProgram.getTabCount(); i++){
    JPanel panelToSetFont = (JPanel) PrincipalWindow.tabbedPaneProgram.getComponentAt(i);
JScrollPane scrollpane = (JScrollPane) panelToSetFont.getComponent(0);
JTextPane textPane = (JTextPane) scrollpane.getViewport().getComponent(0);
textPane.setFont(lblPreview.getFont());
textPane.repaint();
    }
    PrincipalWindow.tabbedPaneProgram.setSelectedIndex(PrincipalWindow.tabbedPaneProgram.getTabCount()-1);
    FontFile.saveFont(lblPreview.getFont());

      doClose(RET_OK);
  }
项目:QN-ACTR-Release    文件:DescriptionPanel.java   
/**
 * Set up the panel contents and layout
 */
private void initComponents() {
    textPane = new JTextPane();
    help.addHelp(textPane, "Enter any text describing this model");

    //BEGIN Federico Dall'Orso 14/3/2005
    //OLD
    /*
    setLayout(new BorderLayout());
    JScrollPane esp = new JScrollPane(textPane);
    esp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    add(esp, BorderLayout.CENTER);
    add(Box.createVerticalStrut(20), BorderLayout.NORTH);
    add(Box.createHorizontalStrut(20), BorderLayout.EAST);
    add(Box.createVerticalStrut(20), BorderLayout.SOUTH);
    add(Box.createHorizontalStrut(20), BorderLayout.WEST);
    */
    //NEW
    JPanel intPanel = new JPanel(new BorderLayout(10, 10));
    //Box intPanel = Box.createVerticalBox();

    JScrollPane jsp = new JScrollPane(textPane, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    JLabel descrLabel = new JLabel(DESCRIPTION_COMMENT);

    intPanel.add(descrLabel, BorderLayout.NORTH);
    intPanel.add(jsp, BorderLayout.CENTER);
    //intPanel.add(jsp);

    setLayout(new BorderLayout());
    add(intPanel, BorderLayout.CENTER);
    add(Box.createVerticalStrut(20), BorderLayout.NORTH);
    add(Box.createVerticalStrut(20), BorderLayout.SOUTH);
    add(Box.createHorizontalStrut(20), BorderLayout.EAST);
    add(Box.createHorizontalStrut(20), BorderLayout.WEST);

    //END Federico Dall'Orso 14/3/2005

}
项目:incubator-netbeans    文件:VCSHyperlinkSupport.java   
public void computeBounds(JTextPane textPane, String idx) {
    List<Hyperlink> list = linkers.get(idx);
    if(list == null) return ;
    for (Hyperlink linker : list) {
        linker.computeBounds(textPane);
    }
}
项目:ZooKeeper    文件:NodeViewerData.java   
/**
* 
*/
  public NodeViewerData() {
      this.setLayout(new BorderLayout());
      this.dataArea = new JTextPane();
      this.toolbar = new JToolBar();
      this.toolbar.setFloatable(false);
      JScrollPane scroller = new JScrollPane(this.dataArea);
      scroller
              .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
      this.add(scroller, BorderLayout.CENTER);
      this.add(this.toolbar, BorderLayout.NORTH);
      JButton saveButton = new JButton(ZooInspectorIconResources
              .getSaveIcon());
      saveButton.addActionListener(new ActionListener() {

          public void actionPerformed(ActionEvent e) {
              if (selectedNode != null) {
                  if (JOptionPane.showConfirmDialog(NodeViewerData.this,
                          "Are you sure you want to save this node?"
                                  + " (this action cannot be reverted)",
                          "Confirm Save", JOptionPane.YES_NO_OPTION,
                          JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) {
                      zooInspectorManager.setData(selectedNode, dataArea
                              .getText());
                  }
              }
          }
      });
      this.toolbar.add(saveButton);

  }
项目:ZooKeeper    文件:NodeViewerData.java   
/**
* 
*/
  public NodeViewerData() {
      this.setLayout(new BorderLayout());
      this.dataArea = new JTextPane();
      this.toolbar = new JToolBar();
      this.toolbar.setFloatable(false);
      JScrollPane scroller = new JScrollPane(this.dataArea);
      scroller
              .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
      this.add(scroller, BorderLayout.CENTER);
      this.add(this.toolbar, BorderLayout.NORTH);
      JButton saveButton = new JButton(ZooInspectorIconResources
              .getSaveIcon());
      saveButton.addActionListener(new ActionListener() {

          public void actionPerformed(ActionEvent e) {
              if (selectedNode != null) {
                  if (JOptionPane.showConfirmDialog(NodeViewerData.this,
                          "Are you sure you want to save this node?"
                                  + " (this action cannot be reverted)",
                          "Confirm Save", JOptionPane.YES_NO_OPTION,
                          JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) {
                      zooInspectorManager.setData(selectedNode, dataArea
                              .getText());
                  }
              }
          }
      });
      this.toolbar.add(saveButton);

  }
项目:https-github.com-apache-zookeeper    文件:NodeViewerData.java   
public NodeViewerData() {
    this.setLayout(new BorderLayout());
    this.dataArea = new JTextPane();
    this.toolbar = new JToolBar();
    this.toolbar.setFloatable(false);
    JScrollPane scroller = new JScrollPane(this.dataArea);
    scroller
            .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    this.add(scroller, BorderLayout.CENTER);
    this.add(this.toolbar, BorderLayout.NORTH);
    JButton saveButton = new JButton(ZooInspector.iconResource.get(IconResource.ICON_SAVE,""));
    saveButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (selectedNode != null) {
                if (JOptionPane.showConfirmDialog(NodeViewerData.this,
                        "Are you sure you want to save this node?"
                                + " (this action cannot be reverted)",
                        "Confirm Save", JOptionPane.YES_NO_OPTION,
                        JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) {
                    zooInspectorManager.setData(selectedNode, dataArea
                            .getText());
                }
            }
        }
    });
    this.toolbar.add(saveButton);

}
项目:QN-ACTR-Release    文件:JabaWizard.java   
public void redraw() {
    // Redraws only if data has changed - Bertoli Marco
    if (old_data == data) {
        return;
    } else {
        old_data = data;
    }

    if (data.hasResults() && data.areResultsOK() && data.getResults().size() > 0) {
        if (data.getClasses() == 2) {
            this.removeAll();
            Sectors2DPanel s2dp = new Sectors2DPanel(data.getResults(), data.getClassNames());
            this.add(s2dp);
            repaint();
        } else if (data.getClasses() == 3) {
            this.removeAll();
            Sectors3DPanel s3dp = new Sectors3DPanel(data.getResults(), data.getClassNames());
            this.add(s3dp);
            repaint();
        }
    } else {
        this.removeAll();
        JEditorPane synView = new JTextPane();
        synView.setContentType("text/html");
        synView.setEditable(false);
        JScrollPane synScroll = new JScrollPane(synView);
        synScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        synScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
        synView
                .setText("<html><body><center><font face=\"bold\" size=\"3\">Saturation Sectors will be here displayed once you solve the model.</font></center></body></html>");
        this.add(synScroll);
    }
}
项目:call-IDE    文件:ReadStdErr.java   
/**
 * Description: Handles the System.err from a forked process
 * @param p forked process
 * @param t pane that the err stream going to be directed
 */
public ReadStdErr(Process p,JTextPane t) {
    finish = false;
    process = p;
    reader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
    console = t;

    read = new Thread(this);
    read.start();
}
项目:voicemenu    文件:Style.java   
private static void setHeader(JPanel panel) {
  JTextPane header = new JTextPane();
  Insets inset = new Insets(0, 0, 0, 5);
  header.setPreferredSize(new Dimension(80, 15));
  header.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
  header.setEditable(false);
  header.setText("10:00");
  header.setMargin(inset);
  header.setBackground(Color.lightGray);
  panel.add(header);
}
项目:Mujeed-Arabic-Prolog    文件:CopyListener.java   
@Override
public void actionPerformed(ActionEvent e) {
    // TODO Auto-generated method stub
    if(PrincipalWindow.tabbedPaneProgram.getComponentCount() != 0){
        JPanel selectedPanel = (JPanel) PrincipalWindow.tabbedPaneProgram.getComponentAt(PrincipalWindow.tabbedPaneProgram.getSelectedIndex());
        JScrollPane scrollPane = (JScrollPane) selectedPanel.getComponent(0);
        JTextPane textPaneCode = (JTextPane) scrollPane.getViewport().getComponent(0);
        textPaneCode.copy();
    }

}
项目:jmt    文件:AllInOnePanel.java   
public void redraw() {
    // We redraw only if data has changed - Sebastiano Spicuglia
    if (!redrawNeeded)
        return;
    this.removeAll();
    if (data.hasResults() && data.areResultsOK()
            && data.getResults().getSaturationSectors().size() > 0) {
        if (data.getClasses() == 2) {
            this.removeAll();
            this.setLayout(new GridLayout(2, 1));
            JPanel tmp = new JPanel(new GridLayout(1, 2));
            tmp.add(new JabaCanvas(new Sectors2DGraph(data)));
            tmp.add(new JabaCanvas(new Convex2DGraph(data, mainWin)));
            this.add(tmp);
            this.add(new JabaCanvas(new PerformanceIndices2DGraph(data)));
            repaint();
        } else if (data.getClasses() == 3) {
            this.removeAll();
            this.setLayout(new GridLayout(1, 2));
            this.add(new JabaCanvas(new Sectors3DGraph(data)));
            this.add(new JabaCanvas(new Convex3DGraph(data, mainWin)));
            repaint();
        }
    } else {
        JEditorPane synView = new JTextPane();
        synView.setContentType("text/html");
        synView.setEditable(false);
        JScrollPane synScroll = new JScrollPane(synView);
        synScroll
                .setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        synScroll
                .setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
        synView.setText("<html><body><center><font face=\"bold\" size=\"3\">Graphs will be here displayed once you solve the model.</font></center></body></html>");
        this.add(synScroll);
        repaint();
    }
    redrawNeeded = false;
}