Ich würde gerne den Text von dem JLabel wvn immer ändern wenn in ckit ein Buchstaben geschrieben wird. Es soll z.B. stehen du musst noch mind. 16 buchstaben schreiben etc.. Geht das?
MfG
MfG
Code:
public static class ckib implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
ckid = new JDialog();
JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT));
p.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 0));
JLabel em; // error message
em = new JLabel("Gebe deinem Charakter etwas Leben!");
em.setBounds(10, 10, 350, 100);
em.setFont(new Font("Bell Gothic", Font.BOLD, 20));
em.setVisible(true);
p.add(em);
JLabel wvn; // Wie viel noch
wvn = new JLabel("Du musst noch 20 Buchstaben schreiben");
wvn.setBounds(10, 10, 350, 100);
wvn.setFont(new Font("Bell Gothic", Font.BOLD, 20));
wvn.setVisible(false);
p.add(wvn);
JButton emb;
emb = new JButton("Bestätigen");
emb.setBounds(50, 50, 50, 10);
emb.setFont(new Font("Bell Gothic", Font.BOLD, 20));
emb.setVisible(true);
emb.addActionListener(new ckid());
p.add(emb);
ckit = new JTextArea(15, 20);
ckit.setBounds(40, 40, 150, 100);
ckit.setFont(new Font("Bell Gothic", Font.BOLD, 20));
ckit.setVisible(true);
p.add(ckit);
ckid.setTitle("Charakter Kurzinfo");
ckid.setSize(600, 600);
ckid.setDefaultCloseOperation(0);
ckid.setLocation(0, 0);
ckid.add(p);
ckid.setModal(true);
ckid.setResizable(false);
ckid.setLocationRelativeTo(null);
ckid.setVisible(true);
}
}