Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import javax.swing.JComponent;
import javax.swing.JLabel;

import javax.swing.JPasswordField;

public class Main {
    public static JPasswordField addLabeledPwdField(JComponent c, String label, int length, boolean wrap) {
        JLabel l = new JLabel(label);
        c.add(l, "align left");

        JPasswordField pwd = new JPasswordField(length);
        if (wrap) {
            c.add(pwd, "align left, wrap");
        } else {
            c.add(pwd, "align left");
        }

        return pwd;
    }
}