G
Guest
Gast
Hi,
ich bin grad dabei mir ein applet zu schreiben und will jetzt auf meinen Bildschirm ein Textarea und einen JButton ausgebe. Das Problem ist, der Button nimmt das Komplette fenster ein!!!!! ich hab shcon probiert ihm mit setBounds(); zu formatieren aber das klappt nicht! Wie kann ich meinen button auf "normale" größe bringen?
mfg moejoe
ich bin grad dabei mir ein applet zu schreiben und will jetzt auf meinen Bildschirm ein Textarea und einen JButton ausgebe. Das Problem ist, der Button nimmt das Komplette fenster ein!!!!! ich hab shcon probiert ihm mit setBounds(); zu formatieren aber das klappt nicht! Wie kann ich meinen button auf "normale" größe bringen?
Code:
if(mistakes ==-1){
final JTextArea antwort = new JTextArea(myanswer);
antwort.setFont( new Font("Arial", Font.BOLD, 16));
antwort.setBackground(new Color (199, 225, 242)); // Setzt Farbe
getContentPane().add(antwort);
antwort.setEditable(false);
antwort.setBounds(30, 30, 400, 300);
antwort.setLineWrap(true);
antwort.setVisible(true);
final JButton weiter = new JButton("Weiter geht's");
getContentPane().add(weiter);
weiter.setBounds(100, 500, 105, 20);
ActionListener al = new ActionListener() {
public void actionPerformed(ActionEvent e) {
addKeyListener(control); // hinzufügen
getContentPane().remove(weiter);
getContentPane().remove(antwort);
requestFocus(); //setzt den Focus noch ..
if(v_fragen.isEmpty()){
g.drawString("Herzlichen Glückwunsch! Sie haben alle Fragen beantwortet.", 200, 200);
repaint();
}
else{
neue_runde();
reinitVariables();
repaint();
}
}
};
weiter.addActionListener(al);
weiter.setVisible(true);
}
mfg moejoe