dit is mijn code tot nu toe:
package oldtimer;
import java.awt.*;
import com.borland.jbcl.layout.*;
import javax.swing.*;
import com.borland.jbcl.control.*;
import java.awt.event.*;
import javax.swing.*;
/**
* Title:
* Description:
* Copyright: Copyright (c) 2001
* Company:
* @author
* @version 1.0
*/
public class FrDoLogin extends JFrame {
XYLayout xYLayout1 = new XYLayout();
JTextField jTextFieldNaam = new JTextField();
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JPasswordField jPassword = new JPasswordField();
String naam = jTextFieldNaam.getText();
Frame frWPR = new FrWPR();
private static boolean isPasswordCorrect(char[] input) {
char[] correctPassword = { 'b', 'u', 'g', 'a', 'b', 'o', 'o' };
if (input.length != correctPassword.length)
return false;
for (int i = 0; i < input.length; i ++)
if (input[i] != correctPassword[i])
return false;
return true;
}
public FrDoLogin() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
public void jbInit() throws Exception {
this.getContentPane().setBackground(new Color(0, 0, 164));
this.getContentPane().setLayout(xYLayout1);
jLabel1.setFont(new java.awt.Font("Dialog", 1, 12));
jLabel1.setForeground(Color.white);
jLabel1.setText("Naam");
jLabel2.setText("Paswoord");
jLabel2.setForeground(Color.white);
jLabel2.setFont(new java.awt.Font("Dialog", 1, 12));
xYLayout1.setWidth(368);
xYLayout1.setHeight(88);
jPassword.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
{
JPasswordField jPassword = (JPasswordField)e.getSource();
char[] password = jPassword.getPassword();
if (isPasswordCorrect(password))
{
JOptionPane.showMessageDialog(frWPR,"Success! You typed the right password.");
}
else
{
JOptionPane.showMessageDialog(frWPR,"Invalid password. Try again.","Error Message", JOptionPane.ERROR_MESSAGE);
}
}
});
JPanel contentPane = new JPanel(new BorderLayout());
contentPane.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
contentPane.add(jPassword, BorderLayout.CENTER);
frWPR.setContentPane(contentPane);
frWPR.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) { System.exit(0); }
});
frWPR.pack();
frWPR.setVisible(true);
this.getContentPane().add(jTextFieldNaam, new XYConstraints(108, 11, 244, 24));
this.getContentPane().add(jLabel1, new XYConstraints(12, 10, 56, 26));
this.getContentPane().add(jLabel2, new XYConstraints(12, 51, 67, 26));
this.getContentPane().add(jPassword, new XYConstraints(107, 51, 244, 24));
}
}
en hier zit hem de fout:
frWPR.setContentPane(contentPane);
deze methode kent ie niet... en ik weet echt niet wat ie zou moeten doen....
gr jack