Examples of JTextComponent


Examples of javax.swing.text.JTextComponent

        handleDocumentChange();
    }

    private void handleDocumentChange() {
        boolean verified = verify();
        JTextComponent text = getTextComponent();
        if (! verified) {
            text.setForeground(Color.red);
        }
        else {
            text.setForeground(LightZoneSkin.Colors.ToolPanesForeground);
        }
    }
View Full Code Here

Examples of javax.swing.text.JTextComponent

  }

  protected synchronized void damage(Rectangle r) {
    if (r != null)
      try {
        JTextComponent comp = getComponent();
        TextUI mapper = comp.getUI();
        Rectangle r2 = mapper.modelToView(comp, getDot() + 1);
        int width = r2.x - r.x;
        if (width == 0)
          width = 8;
        comp.repaint(r.x, r.y, width, r.height);
        x = r.x;
        y = r.y;
        this.width = width;
        height = r.height;
      } catch (BadLocationException badlocationexception) {
View Full Code Here

Examples of javax.swing.text.JTextComponent

  }

  public void paint(Graphics g) {
    if (isVisible())
      try {
        JTextComponent comp = getComponent();
        TextUI mapper = comp.getUI();
        Rectangle r1 = mapper.modelToView(comp, getDot());
        Rectangle r2 = mapper.modelToView(comp, getDot() + 1);
        g = g.create();
        g.setColor(comp.getForeground());
        g.setXORMode(comp.getBackground());
        int width = r2.x - r1.x;
        if (width == 0)
          width = 8;
        g.fillRect(r1.x, r1.y, width, r1.height);
        g.dispose();
View Full Code Here

Examples of javax.swing.text.JTextComponent

    Rectangle r = new Rectangle(locationOnScreen.x, locationOnScreen.y, size.width, size.height);
    return takeScreenshot(r);
  }

  private @Nonnull BufferedImage takeScreenshot(Rectangle r) {
    JTextComponent textComponent = findFocusOwnerAndHideItsCaret();
    robot.waitForIdle();
    try {
      return takeScreenshot(robot, r);
    } finally {
      showCaretIfPossible(textComponent);
View Full Code Here

Examples of javax.swing.text.JTextComponent

      protected JTextComponent executeInEDT() {
        Component focusOwner = focusOwner();
        if (!(focusOwner instanceof JTextComponent)) {
          return null;
        }
        JTextComponent textComponent = (JTextComponent) focusOwner;
        Caret caret = textComponent.getCaret();
        if (caret == null || !caret.isVisible()) {
          return null;
        }
        caret.setVisible(false);
        return textComponent;
View Full Code Here

Examples of javax.swing.text.JTextComponent

  }

  @Test
  public void should_return_text_using_driver() {
    JTextComponentDriver driver = fixture.driver();
    JTextComponent target = fixture.target();
    when(driver.textOf(target)).thenReturn("Hello");
    assertThat(fixture.text()).isEqualTo("Hello");
    verify(driver).textOf(target);
  }
View Full Code Here

Examples of javax.swing.text.JTextComponent

  @Test
  public void should_enter_text() {
    showWindow();
    updateValue("Frodo");
    driver.enterText(spinner, "Gandalf");
    JTextComponent editor = driver.editor(spinner);
    assertThat(textOf(editor)).isEqualTo("Gandalf");
    assertThatValueIs("Frodo");
  }
View Full Code Here

Examples of javax.swing.text.JTextComponent

   * @return the text displayed in the given {@code JSpinner}.
   * @since 1.2
   */
  @RunsInEDT
  public @Nullable String textOf(@Nonnull JSpinner spinner) {
    JTextComponent editor = findEditor(spinner);
    if (editor != null) {
      return JTextComponentTextQuery.textOf(editor);
    }
    Object value = valueOf(spinner);
    return value != null ? value.toString() : null;
View Full Code Here

Examples of javax.swing.text.JTextComponent

   * @see #enterTextAndCommit(JSpinner, String)
   */
  @RunsInEDT
  public void enterText(@Nonnull JSpinner spinner, @Nonnull String text) {
    checkInEdtEnabledAndShowing(spinner);
    JTextComponent editor = findEditor(spinner);
    robot.waitForIdle();
    checkEditorNotNull(spinner, editor);
    if (editor == null) {
      return;
    }
View Full Code Here

Examples of javax.swing.text.JTextComponent

  /** {@inheritDoc} */
  @RunsInEDT
  @Override
  public void enterValue(@Nonnull JTable table, int row, int column, @Nonnull String value) {
    JTextComponent editor = doStartCellEditing(table, row, column);
    driver.replaceText(editor, value);
    stopCellEditing(table, row, column);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.