Tabnine Logo
JPasswordField.paintComponent
Code IndexAdd Tabnine to your IDE (free)

How to use
paintComponent
method
in
javax.swing.JPasswordField

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

origin: org.icepdf.os/icepdf-viewer

@Override
protected void paintComponent(Graphics g) {
  if (!active) {
    return;
  }
  super.paintComponent(g);
}
origin: com.jalalkiswani/jk-desktop

@Override
protected void paintComponent(final Graphics pG) {
  super.paintComponent(pG);
  if (placeholder == null || placeholder.length() == 0 || getText().length() > 0) {
    return;
  }
  final Graphics2D g = (Graphics2D) pG;
  g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  g.setColor(Color.lightGray);
  g.drawString(placeholder, getInsets().left, pG.getFontMetrics().getMaxAscent() + getInsets().top);
}
origin: edu.toronto.cs.medsavant/medsavant-client

@Override
protected void paintComponent(final Graphics pG) {
  super.paintComponent(pG);
  if (placeholder.length() == 0 || getText().length() > 0) {
    return;
  }
  final Graphics2D g = (Graphics2D) pG;
  g.setRenderingHint(
    RenderingHints.KEY_ANTIALIASING,
    RenderingHints.VALUE_ANTIALIAS_ON);
  g.setColor(getDisabledTextColor());
  g.drawString(placeholder, getInsets().left, pG.getFontMetrics()
    .getMaxAscent() + getInsets().top);
}
origin: abel533/DBMetadata

  @Override
  public void paintComponent(Graphics g) {
    Component window = this.getTopLevelAncestor();
    if (window instanceof Window && !((Window) window).isOpaque()) {
      // This is a translucent window, so we need to draw to a buffer
      // first to work around a bug in the DirectDraw rendering in Swing.
      int w = this.getWidth();
      int h = this.getHeight();
      if (buffer == null || buffer.getWidth() != w || buffer.getHeight() != h) {
        // Create a new buffer based on the current size.
        GraphicsConfiguration gc = this.getGraphicsConfiguration();
        buffer = gc.createCompatibleImage(w, h, BufferedImage.TRANSLUCENT);
      }

      // Use the super class's paintComponent implementation to draw to
      // the buffer, then write that buffer to the original Graphics object.
      Graphics bufferGraphics = buffer.createGraphics();
      try {
        super.paintComponent(bufferGraphics);
      } finally {
        bufferGraphics.dispose();
      }
      g.drawImage(buffer, 0, 0, w, h, 0, 0, w, h, null);
    } else {
      // This is not a translucent window, so we can call the super class
      // implementation directly.
      super.paintComponent(g);
    }
  }
}
origin: leMaik/swing-material

@Override
protected void paintComponent(Graphics g) {
  Graphics2D g2 = (Graphics2D) g;
  g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
  g2.setColor(getBackground());
  g2.fillRect(0, 0, getWidth(), getHeight());
  g2.translate(0, 9);
  super.paintComponent(g);
  g2.translate(0, -9);
  if (!getHint().isEmpty() && getPassword().length == 0 && (getLabel().isEmpty() || isFocusOwner()) && floatingLabel.isFloatingAbove()) {
    g.setFont(Roboto.REGULAR.deriveFont(16f));
    g2.setColor(Utils.applyAlphaMask(getForeground(), HINT_OPACITY_MASK));
    FontMetrics metrics = g.getFontMetrics(g.getFont());
    g.drawString(getHint(), 0, metrics.getAscent() + 36);
  }
  floatingLabel.paint(g2);
  g2.setColor(Utils.applyAlphaMask(getForeground(), LINE_OPACITY_MASK));
  g2.fillRect(0, getHeight() - 9, getWidth(), 1);
  g2.setColor(accentColor);
  g2.fillRect((int) ((getWidth() - line.getWidth()) / 2), getHeight() - 10, (int) line.getWidth(), 2);
}
javax.swingJPasswordFieldpaintComponent

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

  • Making http requests using okhttp
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getSharedPreferences (Context)
  • setContentView (Activity)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now