Пример #1
0
  private void jbInit() throws Exception {
    // this.setResizable(false);
    this.setSize(ancho, alto);
    this.setLocation(0, 0);

    // this.setUndecorated(true);
    // this.getContentPane().setLayout(null);

    // limites de componentes
    labelFondo.setBounds(
        new Rectangle((int) (ancho / 5), 2 * (alto / 6), (int) (ancho / 1.5), alto / 4));
    botonCancelar.setBounds(
        new Rectangle(
            (int) (2.9 * (ancho / 5)), (int) (2 * (alto / 4)), (int) (ancho / 10.2), alto / 25));
    botonCancelar.setBorder(null);
    // botonAceptar.setBounds(new Rectangle(0, 0, 100, 30));
    botonAceptar.setBounds(
        new Rectangle(
            (int) (2.15 * (ancho / 5)), (int) (2 * (alto / 4)), (int) (ancho / 10.2), alto / 25));
    botonAceptar.setBorder(null);
    textNombre.setFont(new java.awt.Font("Serif", 3, 15));
    textNombre.setBounds(
        new Rectangle((int) (2.5 * (ancho / 5)), (int) (1.5 * (alto / 4)), ancho / 5, alto / 25));
    textNombre.addKeyListener(new PanelNick_textNombre_keyAdapter(this));

    textContra.setFont(new java.awt.Font("Serif", 3, 15));
    textContra.setBounds(
        new Rectangle(
            (int) (2.9 * (ancho / 5)), (int) (1.65 * (alto / 4)) + 20, ancho / 8, alto / 25));

    // imagenes de componentes
    labelFondo.setIcon(new ImageIcon("../imagenes/introduceNick.jpg"));
    botonCancelar.setIcon(new ImageIcon("../imagenes/botoncancelar.jpg"));
    botonCancelar.addMouseListener(new PanelNick_botonCancelar_mouseAdapter(this));
    botonAceptar.setIcon(new ImageIcon("../imagenes/botonaceptar.jpg"));
    botonAceptar.addMouseListener(new PanelNick_botonAceptar_mouseAdapter(this));

    // agregar componentes al panel
    this.add(textContra, null);
    this.add(botonCancelar, null);
    this.add(botonAceptar, null);
    this.add(textNombre, null);
    this.add(labelFondo, null);

    // acciones de botones
    botonAceptar.addActionListener(new PanelNick_botonAceptar_actionAdapter(this));
    botonCancelar.addActionListener(new PanelNick_botonCancelar_actionAdapter(this));
  }
Пример #2
0
  protected void setPref() {
    Color color = DisplayOptions.getColor("PlainText");
    Font font = DisplayOptions.getFont("PlainText");
    m_lblUsername.setForeground(color);
    m_lblUsername.setFont(font);
    m_lblPassword.setForeground(color);
    m_lblPassword.setFont(font);
    m_cmbUser.getEditor().getEditorComponent().setForeground(color);
    m_cmbUser.getEditor().getEditorComponent().setFont(font);
    m_passwordField.setForeground(color);
    m_passwordField.setFont(font);

    color = DisplayOptions.getColor("Heading3");
    font = DisplayOptions.getFont("Heading3");
    m_lblSampleName.setForeground(color);
    m_pnlTrays.setBorder(
        BorderDeli.createBorder("Empty", "Sample Trays", "Bottom", "Center", color, font));
    VBox.setforeground(color);
    VBox.setfont(font);
  }
Пример #3
0
  Usermaster() {
    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
    x = dim.width;
    y = dim.height;
    setSize(x, y);
    setUndecorated(true);

    Container c = getContentPane();

    center =
        new JPanel() {
          public void paintComponent(Graphics g) {
            Toolkit kit = Toolkit.getDefaultToolkit();
            Image img = kit.getImage("Image/user.jpg");
            MediaTracker t = new MediaTracker(this);
            t.addImage(img, 0);
            while (true) {
              try {
                t.waitForAll();
                break;
              } catch (Exception ee) {
              }
            }
            g.drawImage(img, 0, 0, x, y, null);
          }
        };

    c.add(center);
    center.setLayout(null);

    titleLb =
        new JLabel(
            "<html><body ><font size='5'><b><i>&nbsp;&nbsp; User Name &nbsp;&nbsp;</b></i></font></body></html>");
    titleLb.setForeground(new Color(10, 110, 255));
    titleLb.setBounds(x / 2 + 50, x / 4, 150, 50);
    center.add(titleLb);

    output =
        new JLabel(
            "<html><body ><font size='5'><b><i>&nbsp;&nbsp; OUTPUT &nbsp;&nbsp;</b></i></font></body></html>");
    output.setForeground(Color.white);
    output.setBounds(x / 2 - 250, x / 6, 150, 50);
    center.add(output);

    login = new JButton(new ImageIcon("Image/logBut.gif"));
    login.setBorder(BorderFactory.createRaisedBevelBorder());
    login.setBounds(x / 2 + 100, x / 2 - 70, 100, 100);
    login.setBackground(Color.white);

    pass = new JPasswordField();
    pass.setToolTipText("Enter The Password To Payroll System");
    login.requestFocus();
    pass.setBorder(BorderFactory.createRaisedBevelBorder());
    pass.setForeground(new Color(10, 110, 255));
    pass.setFont(new Font("Arial", Font.BOLD, 22));
    pass.setCaretColor(Color.red);
    pass.setBounds(x / 2 + 50, x / 3, 200, 35);
    center.add(pass);
    center.add(login);

    pass.addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            output.setText(
                "<html><body ><font size='5'><b><i>&nbsp;&nbsp; OUTPUT &nbsp;&nbsp;</b></i></font></body></html>");
            output.setForeground(Color.white);
          }
        });

    try {
      clsConnection connect = new clsConnection();
      conn = connect.setConnection(conn, "", "");
    } catch (Exception e) {
    }

    login.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              st = conn.createStatement();
              rs = st.executeQuery("select * from img");
              while (rs.next()) {
                if (pass.getText().equals(rs.getString(3))) {
                  setVisible(false);
                  URL url = closeSystem.class.getResource("spacemusic.au");
                  click = Applet.newAudioClip(url);
                  click.play();
                  paro.setVisible(true);
                } else {
                  pass.setText("");
                  pass.requestFocus();
                  output.setText("Fell");
                  output.setFont(new Font("Arial", Font.BOLD, 36));
                  output.setForeground(Color.red);
                }
              }
            } catch (Exception er) {
              System.out.println("Sorry\n" + er);
            }
          }
        });
  }