本文整理了Java中javax.swing.JTextPane.insertComponent()
方法的一些代码示例,展示了JTextPane.insertComponent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextPane.insertComponent()
方法的具体详情如下:
包路径:javax.swing.JTextPane
类名称:JTextPane
方法名:insertComponent
暂无
代码示例来源:origin: org.codehaus.groovy/groovy
private void insertComponent(JComponent comp) {
try {
tokenPane.getDocument().insertString(tokenPane.getDocument().getLength(), " ", null);
} catch (BadLocationException ex1) {
// Ignore
}
try {
tokenPane.setCaretPosition(tokenPane.getDocument().getLength() - 1);
} catch (Exception ex) {
tokenPane.setCaretPosition(0);
}
tokenPane.insertComponent(comp);
}
代码示例来源:origin: stackoverflow.com
jtp.insertIcon(UIManager.getIcon("OptionPane.warningIcon"));
jtp.setSelectionStart(doc.getLength());
jtp.insertComponent(new JLabel("Label"));
jtp.setSelectionStart(doc.getLength());
代码示例来源:origin: stackoverflow.com
JTextPane k = new JTextPane();
k.insertComponent(new JLabel("<html><strong>Hey!</strong></html>"));
代码示例来源:origin: net.imagej/imagej-ui-swing
/**
* Add a link.
*
* @param text
* the label of the link
* @param action
* the action to perform when the link is clicked
*/
public void link(String text, ActionListener action) {
final JButton button = new JButton(text);
button.addActionListener(action);
textPane.insertComponent(button);
button.setCursor(handCursor);
}
代码示例来源:origin: stackoverflow.com
JLabel lable = new JLabel("Hello World");
lable.setBorder(BorderFactory.createLineBorder(Color.RED));
jTextPane.insertComponent(lable);
代码示例来源:origin: net.imagej/imagej-ui-swing
protected void addButton(final String label, final ActionListener listener) {
final JButton button = SwingTools.button(label, null, listener, null);
selectEnd();
panel.insertComponent(button);
}
代码示例来源:origin: MegaMek/mekhq
public JTextPane getReport() {
// SplitPane them
JSplitPane splitOverviewPersonnel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, getCombatPersonnelReport(), getSupportPersonnelReport());
splitOverviewPersonnel.setName("splitOverviewPersonnel");
splitOverviewPersonnel.setOneTouchExpandable(true);
splitOverviewPersonnel.setResizeWeight(0.5);
// Actual report pane
JTextPane txtReport = new JTextPane();
txtReport.setMinimumSize(new Dimension(800, 500));
txtReport.insertComponent(splitOverviewPersonnel);
return txtReport;
}
代码示例来源:origin: MegaMek/mekhq
public JTextPane getReport() {
JTextPane txtReport = new JTextPane();
txtReport.setMinimumSize(new Dimension(800, 500));
txtReport.setFont(new Font("Courier New", Font.PLAIN, 12));
txtReport.setAlignmentY(1.0f);
txtReport.setText(getHangarTotals() + "\n\n\n");
txtReport.insertComponent(getHangarTree());
return txtReport;
}
代码示例来源:origin: net.imagej/imagej-ui-swing
protected void maybeAddSeparator() {
if (panel.getText().equals("") && panel.getComponents().length == 0) return;
addText("\n");
selectEnd();
panel.insertComponent(new JSeparator());
}
代码示例来源:origin: org.codehaus.groovy/groovy-all-minimal
private void insertComponent(JComponent comp){
try{
tokenPane.getDocument().insertString(tokenPane.getDocument().getLength(), " ", null);
} catch(BadLocationException ex1){
// Ignore
}
try{
tokenPane.setCaretPosition(tokenPane.getDocument().getLength()-1);
} catch(Exception ex){
tokenPane.setCaretPosition(0);
}
tokenPane.insertComponent(comp);
}
代码示例来源:origin: org.kohsuke.droovy/groovy
private void insertComponent(JComponent comp){
try{
tokenPane.getDocument().insertString(tokenPane.getDocument().getLength(), " ", null);
} catch(BadLocationException ex1){
// Ignore
}
try{
tokenPane.setCaretPosition(tokenPane.getDocument().getLength()-1);
} catch(Exception ex){
tokenPane.setCaretPosition(0);
}
tokenPane.insertComponent(comp);
}
代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm
private void insertComponent(JComponent comp){
try{
tokenPane.getDocument().insertString(tokenPane.getDocument().getLength(), " ", null);
} catch(BadLocationException ex1){
// Ignore
}
try{
tokenPane.setCaretPosition(tokenPane.getDocument().getLength()-1);
} catch(Exception ex){
tokenPane.setCaretPosition(0);
}
tokenPane.insertComponent(comp);
}
代码示例来源:origin: stackoverflow.com
super(BoxLayout.Y_AXIS);
final JTextPane textArea = new JTextPane();
textArea.insertComponent(new JLabel("Text"));
add(textArea);
代码示例来源:origin: org.codehaus.groovy/groovy-jdk14
private void insertComponent(JComponent comp){
try{
tokenPane.getDocument().insertString(tokenPane.getDocument().getLength(), " ", null);
} catch(BadLocationException ex1){
// Ignore
}
try{
tokenPane.setCaretPosition(tokenPane.getDocument().getLength()-1);
} catch(Exception ex){
tokenPane.setCaretPosition(0);
}
tokenPane.insertComponent(comp);
}
代码示例来源:origin: stackoverflow.com
super(BoxLayout.Y_AXIS);
final JTextPane textArea = new JTextPane();
textArea.insertComponent(new JLabel("Text"));
add(textArea);
代码示例来源:origin: stackoverflow.com
super(BoxLayout.Y_AXIS);
final JTextPane textArea = new JTextPane();
textArea.insertComponent(new JLabel("Text"));
add(textArea);
代码示例来源:origin: stackoverflow.com
JLabel label = new JLabel("label");
label.setAlignmentY(0.85f);
pane.insertComponent(label);
代码示例来源:origin: stackoverflow.com
text.setOpaque(true);
text.setBackground(Color.yellow);
textArea.insertComponent(text);
}});
add(addText);
代码示例来源:origin: stackoverflow.com
editorPane.insertComponent(label);
frame.getContentPane().add(editorPane);
代码示例来源:origin: stackoverflow.com
JTextPane textPane = new JTextPane();
textPane.replaceSelection(s);
textPane.insertComponent(label1);
label2.setAlignmentY(baseline/(float)d.height);
textPane.replaceSelection("\n\n"+s);
textPane.insertComponent(label2);
内容来源于网络,如有侵权,请联系作者删除!