Codota Logo
JPasswordField.echoCharIsSet
Code IndexAdd Codota to your IDE (free)

How to use
echoCharIsSet
method
in
javax.swing.JPasswordField

Best Java code snippets using javax.swing.JPasswordField.echoCharIsSet (Showing top 13 results out of 315)

  • Common ways to obtain JPasswordField
private void myMethod () {
JPasswordField j =
  • Codota Iconnew JPasswordField()
  • Codota Iconnew JPasswordField(int1)
  • Codota IconString str;new JPasswordField(str)
  • Smart code suggestions by Codota
}
origin: kaikramer/keystore-explorer

/**
 * Is there an echo character set?
 *
 * @return True if there is
 */
public boolean echoCharIsSet() {
  return jpfPassword.echoCharIsSet();
}
origin: net.sf.nimrod/nimrod-laf

public Shape modelToView( int pos, Shape a, Position.Bias b) throws BadLocationException {
  Container c = getContainer();
  if ( c instanceof JPasswordField ) {
   JPasswordField f = (JPasswordField)c;
   if ( !f.echoCharIsSet() ) {
     return super.modelToView( pos, a, b);
   }
    
  char echoChar = f.getEchoChar();
   int w = f.getFontMetrics( f.getFont()).charWidth( echoChar);
   w = ( w < ancho ? ancho : w) + hueco;
   
   Rectangle alloc = adjustAllocation( a).getBounds();
   int dx = (pos - getStartOffset()) * w;
   alloc.x += dx - 2;
  if ( alloc.x <= 5 ) {
   alloc.x = 6;
  }
   alloc.width = 1;
   
   return alloc;
  }
  
  return null;
}
 
origin: net.sf.nimrod/nimrod-laf

 public int viewToModel( float fx, float fy, Shape a, Position.Bias[] bias) {
   bias[0] = Position.Bias.Forward;
   int n = 0;
   Container c = getContainer();
   if ( c instanceof JPasswordField ) {
    JPasswordField f = (JPasswordField)c;
    if ( !f.echoCharIsSet() ) {
      return super.viewToModel( fx, fy, a, bias);
    }
    
    char echoChar = f.getEchoChar();
    int w = f.getFontMetrics( f.getFont()).charWidth( echoChar);
    w = ( w < ancho ? ancho : w) + hueco;
    
    a = adjustAllocation( a);
    Rectangle alloc = (a instanceof Rectangle) ? (Rectangle)a : a.getBounds();
    n = ((int)fx - alloc.x) / w;
    if (n < 0) {
      n = 0;
    }
    else if ( n > (getStartOffset() + getDocument().getLength()) ) {
      n = getDocument().getLength() - getStartOffset();
    }
   }
   
  return getStartOffset() + n;
 }
}
origin: com.github.insubstantial/substance

@Override
public float getPreferredSpan(int axis) {
  switch (axis) {
  case View.X_AXIS:
    Container c = this.getContainer();
    if (c instanceof JPasswordField) {
      JPasswordField f = (JPasswordField) c;
      if (f.echoCharIsSet()) {
        int echoPerChar = SubstanceCoreUtilities
            .getEchoPerChar(f);
        int fontSize = SubstanceSizeUtils
            .getComponentFontSize(this.field);
        int dotWidth = SubstanceSizeUtils
            .getPasswordDotDiameter(fontSize)
            + SubstanceSizeUtils
                .getPasswordDotGap(fontSize);
        return echoPerChar * dotWidth
            * this.getDocument().getLength();
      }
    }
  }
  return super.getPreferredSpan(axis);
}
origin: com.github.insubstantial/substance

@Override
protected int drawUnselectedText(Graphics g, final int x, final int y,
    int p0, int p1) throws BadLocationException {
  Container c = getContainer();
  if (c instanceof JPasswordField) {
    JPasswordField f = (JPasswordField) c;
    if (!f.echoCharIsSet()) {
      return super.drawUnselectedText(g, x, y, p0, p1);
    }
    int n = p1 - p0;
    char echoChar = f.getEchoChar();
    int currPos = x;
    for (int i = 0; i < n; i++) {
      currPos = drawEchoCharacter(g, currPos, y, echoChar, false);
    }
    return x + n * getEchoCharAdvance();
  }
  return x;
}
origin: org.java.net.substance/substance

@Override
protected int drawSelectedText(Graphics g, final int x, final int y,
    int p0, int p1) throws BadLocationException {
  Container c = getContainer();
  if (c instanceof JPasswordField) {
    JPasswordField f = (JPasswordField) c;
    if (!f.echoCharIsSet()) {
      return super.drawSelectedText(g, x, y, p0, p1);
    }
    int n = p1 - p0;
    char echoChar = f.getEchoChar();
    int currPos = x;
    for (int i = 0; i < n; i++) {
      currPos = drawEchoCharacter(g, currPos, y, echoChar, true);
    }
    return x + n * getEchoCharAdvance();
  }
  return x;
}
origin: com.github.insubstantial/substance

@Override
protected int drawSelectedText(Graphics g, final int x, final int y,
    int p0, int p1) throws BadLocationException {
  Container c = getContainer();
  if (c instanceof JPasswordField) {
    JPasswordField f = (JPasswordField) c;
    if (!f.echoCharIsSet()) {
      return super.drawSelectedText(g, x, y, p0, p1);
    }
    int n = p1 - p0;
    char echoChar = f.getEchoChar();
    int currPos = x;
    for (int i = 0; i < n; i++) {
      currPos = drawEchoCharacter(g, currPos, y, echoChar, true);
    }
    return x + n * getEchoCharAdvance();
  }
  return x;
}
origin: org.java.net.substance/substance

@Override
protected int drawUnselectedText(Graphics g, final int x, final int y,
    int p0, int p1) throws BadLocationException {
  Container c = getContainer();
  if (c instanceof JPasswordField) {
    JPasswordField f = (JPasswordField) c;
    if (!f.echoCharIsSet()) {
      return super.drawUnselectedText(g, x, y, p0, p1);
    }
    int n = p1 - p0;
    char echoChar = f.getEchoChar();
    int currPos = x;
    for (int i = 0; i < n; i++) {
      currPos = drawEchoCharacter(g, currPos, y, echoChar, false);
    }
    return x + n * getEchoCharAdvance();
  }
  return x;
}
origin: org.java.net.substance/substance

@Override
public float getPreferredSpan(int axis) {
  switch (axis) {
  case View.X_AXIS:
    Container c = this.getContainer();
    if (c instanceof JPasswordField) {
      JPasswordField f = (JPasswordField) c;
      if (f.echoCharIsSet()) {
        int echoPerChar = SubstanceCoreUtilities
            .getEchoPerChar(f);
        int fontSize = SubstanceSizeUtils
            .getComponentFontSize(this.field);
        int dotWidth = SubstanceSizeUtils
            .getPasswordDotDiameter(fontSize)
            + SubstanceSizeUtils
                .getPasswordDotGap(fontSize);
        return echoPerChar * dotWidth
            * this.getDocument().getLength();
      }
    }
  }
  return super.getPreferredSpan(axis);
}
origin: com.github.insubstantial/substance

if (c instanceof JPasswordField) {
  JPasswordField f = (JPasswordField) c;
  if (!f.echoCharIsSet()) {
    return super.viewToModel(fx, fy, a, bias);
origin: org.java.net.substance/substance

@Override
public Shape modelToView(int pos, Shape a, Position.Bias b)
    throws BadLocationException {
  Container c = this.getContainer();
  if (c instanceof JPasswordField) {
    JPasswordField f = (JPasswordField) c;
    if (!f.echoCharIsSet()) {
      return super.modelToView(pos, a, b);
    }
    Rectangle alloc = this.adjustAllocation(a).getBounds();
    int echoPerChar = SubstanceCoreUtilities.getEchoPerChar(f);
    int fontSize = SubstanceSizeUtils
        .getComponentFontSize(this.field);
    int dotWidth = SubstanceSizeUtils
        .getPasswordDotDiameter(fontSize)
        + SubstanceSizeUtils.getPasswordDotGap(fontSize);
    int dx = (pos - this.getStartOffset()) * echoPerChar * dotWidth;
    alloc.x += dx;
    alloc.width = 1;
    return alloc;
  }
  return null;
}
origin: com.github.insubstantial/substance

@Override
public Shape modelToView(int pos, Shape a, Position.Bias b)
    throws BadLocationException {
  Container c = this.getContainer();
  if (c instanceof JPasswordField) {
    JPasswordField f = (JPasswordField) c;
    if (!f.echoCharIsSet()) {
      return super.modelToView(pos, a, b);
    }
    Rectangle alloc = this.adjustAllocation(a).getBounds();
    int echoPerChar = SubstanceCoreUtilities.getEchoPerChar(f);
    int fontSize = SubstanceSizeUtils
        .getComponentFontSize(this.field);
    int dotWidth = SubstanceSizeUtils
        .getPasswordDotDiameter(fontSize)
        + SubstanceSizeUtils.getPasswordDotGap(fontSize);
    int dx = (pos - this.getStartOffset()) * echoPerChar * dotWidth;
    alloc.x += dx;
    alloc.width = 1;
    return alloc;
  }
  return null;
}
origin: org.java.net.substance/substance

if (c instanceof JPasswordField) {
  JPasswordField f = (JPasswordField) c;
  if (!f.echoCharIsSet()) {
    return super.viewToModel(fx, fy, a, bias);
javax.swingJPasswordFieldechoCharIsSet

Popular methods of JPasswordField

  • <init>
  • getPassword
  • setText
  • setEnabled
  • addActionListener
  • addKeyListener
  • setColumns
  • getDocument
  • setEchoChar
  • requestFocusInWindow
  • setEditable
  • setPreferredSize
  • setEditable,
  • setPreferredSize,
  • addFocusListener,
  • setFont,
  • setToolTipText,
  • setName,
  • getEchoChar,
  • getText,
  • requestFocus,
  • setDocument

Popular in Java

  • Start an intent from android
  • getApplicationContext (Context)
  • getExternalFilesDir (Context)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • ArrayList (java.util)
    Resizable-array implementation of the List interface. Implements all optional list operations, and p
  • Timer (java.util)
    A facility for threads to schedule tasks for future execution in a background thread. Tasks may be s
  • Pattern (java.util.regex)
    A compiled representation of a regular expression. A regular expression, specified as a string, must
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now