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); }
jtp.insertIcon(UIManager.getIcon("OptionPane.warningIcon")); jtp.setSelectionStart(doc.getLength()); jtp.insertComponent(new JLabel("Label")); jtp.setSelectionStart(doc.getLength());
JTextPane k = new JTextPane(); k.insertComponent(new JLabel("<html><strong>Hey!</strong></html>"));
/** * 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); }
JLabel lable = new JLabel("Hello World"); lable.setBorder(BorderFactory.createLineBorder(Color.RED)); jTextPane.insertComponent(lable);
protected void addButton(final String label, final ActionListener listener) { final JButton button = SwingTools.button(label, null, listener, null); selectEnd(); panel.insertComponent(button); }
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; }
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; }
protected void maybeAddSeparator() { if (panel.getText().equals("") && panel.getComponents().length == 0) return; addText("\n"); selectEnd(); panel.insertComponent(new JSeparator()); }
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); }
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); }
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); }
super(BoxLayout.Y_AXIS); final JTextPane textArea = new JTextPane(); textArea.insertComponent(new JLabel("Text")); add(textArea);
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); }
super(BoxLayout.Y_AXIS); final JTextPane textArea = new JTextPane(); textArea.insertComponent(new JLabel("Text")); add(textArea);
super(BoxLayout.Y_AXIS); final JTextPane textArea = new JTextPane(); textArea.insertComponent(new JLabel("Text")); add(textArea);
JLabel label = new JLabel("label"); label.setAlignmentY(0.85f); pane.insertComponent(label);
text.setOpaque(true); text.setBackground(Color.yellow); textArea.insertComponent(text); }}); add(addText);
editorPane.insertComponent(label); frame.getContentPane().add(editorPane);
JTextPane textPane = new JTextPane(); textPane.replaceSelection(s); textPane.insertComponent(label1); label2.setAlignmentY(baseline/(float)d.height); textPane.replaceSelection("\n\n"+s); textPane.insertComponent(label2);