Ciao,
dovrei fare una modifica nell' applet.
Al caricamento della prima volta dell' applet mi inserisca giā il " nome" senza la combinazione di tasti alt+N.
Grazie
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.net.*;
public class TextApplet extends JApplet
{
public void init()
{
JPanel contentPane = (JPanel)getContentPane();
contentPane.add(new TextAreaFrame(Integer.parseInt(getParameter("WIDTH "))-70,
Integer.parseInt(getParameter("HEIGHT"))-70));
}
}
class TextAreaFrame extends JPanel {
private JTextArea textArea;
private JScrollPane scrollPane;
private JPanel buttonPanel;
private JButton wrapButton;
private JButton setButton;
private JButton titButton;
public TextAreaFrame(int WIDTH,int HEIGHT) {
textArea = new JTextArea(8,40);
scrollPane = new JScrollPane(textArea);
scrollPane.setPreferredSize(new Dimension(WIDTH,HEIGHT));
buttonPanel = new JPanel();
JButton insertButton = new JButton("Nome");
buttonPanel.add(insertButton);
insertButton.setMnemonic('N');
insertButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
textArea.append("Il mio nome č Stefano ");
}
});
titButton = new JButton("Cognome");
buttonPanel.add(titButton);
titButton.setMnemonic('C');
titButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
textArea.append("Cognome XXXX ");
}
});
add(buttonPanel, BorderLayout.SOUTH);
add(scrollPane, BorderLayout.CENTER);
}
}
HTML:
<APPLET CODE="TextApplet.class"
WIDTH=320 HEIGHT=250 >
</APPLET>