Java Code Examples for javax.swing.JTextPane#getBounds()
The following examples show how to use
javax.swing.JTextPane#getBounds() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VCSHyperlinkSupport.java From netbeans with Apache License 2.0 | 6 votes |
public void computeBounds(JTextPane textPane, BoundsTranslator translator) { Rectangle tpBounds = textPane.getBounds(); TextUI tui = textPane.getUI(); this.bounds = new Rectangle[length]; for (int i = 0; i < length; i++) { try { Rectangle startr = tui.modelToView(textPane, docstart[i], Position.Bias.Forward); Rectangle endr = tui.modelToView(textPane, docend[i], Position.Bias.Backward); if (startr == null || endr == null) { continue; } startr = startr.getBounds(); endr = endr.getBounds(); this.bounds[i] = new Rectangle(tpBounds.x + startr.x, startr.y, endr.x - startr.x, startr.height); //NOTE the textPane is positioned within a parent panel so the origin has to be modified too if (null != translator) { translator.correctTranslation(textPane, this.bounds[i]); } } catch (BadLocationException ex) { } } }
Example 2
Source File: VCSHyperlinkSupport.java From netbeans with Apache License 2.0 | 6 votes |
public void computeBounds(JTextPane textPane, BoundsTranslator translator) { 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(); if(kenaiUser.getIcon() != null) { endr.x += kenaiUser.getIcon().getIconWidth(); } this.bounds = new Rectangle(tpBounds.x + startr.x, startr.y, endr.x - startr.x, startr.height); if (null != translator) { translator.correctTranslation(textPane, this.bounds); } } catch (BadLocationException ex) { Exceptions.printStackTrace(ex); } }
Example 3
Source File: TooltipWindow.java From netbeans with Apache License 2.0 | 5 votes |
@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); } }
Example 4
Source File: TooltipWindow.java From netbeans with Apache License 2.0 | 5 votes |
@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); } }