I am still working on my
applet. It is looking better, except I am having this one weird problem. I am trying to get two textfields for user input to display on the same line at the top of the browser window. The code I have makes them display as two small boxes. How do I make them longer? I don't know if this is a question of using the right layout manager, or what. Any input would be helpful. I am holding off on coding the action event methods until I can get the GUI to look somewhat presentable.
<code>
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
public class NumerologyApplet extends Applet
implements ActionListener {
//Declare the textfields for input
private TextField dateInput = new TextField("");
private TextField nameInput = new TextField("");
private TextArea results = new TextArea("");
//Declare buttons
private Button closeBtn = new Button("Close");
private Button compBtn = new Button("Compute");
private Button refBtn = new Button("Refresh");
//Declare panels
Panel xPanel = new Panel();
Panel yPanel = new Panel();
Panel zPanel = new Panel();
Panel buttonPanel = new Panel();
public void init() {
//Make sure textfield background is white
dateInput.setBackground(Color.white);
nameInput.setBackground(Color.white);
//Add textfields to panels
xPanel.add(dateInput);
yPanel.add(nameInput);
zPanel.add(results);
//Set layout for panels
//Add buttons to button panel
closeBtn.addActionListener(this);
buttonPanel.add(closeBtn);
compBtn.addActionListener(this);
buttonPanel.add(compBtn);
refBtn.addActionListener(this);
buttonPanel.add(refBtn);
//Add the panels
add(xPanel);
add(yPanel);
add(zPanel);
add(buttonPanel);
}
public void actionPerformed(ActionEvent event) {
}
}
</code>