aspose file tools
The moose likes Applets and the fly likes Swinging around Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Applets
Reply Bookmark "Swinging around" Watch "Swinging around" New topic
Author

Swinging around

Glenn Wearen
Greenhorn

Joined: Feb 21, 2001
Posts: 4
I've started a new project, and decided to use Swings JApplet instead of Applet because I like all the nice things you can do.
However, I find Swing a bit more complex than I expected, since most graphical components are usually modified indirectly by modifying some sort of Model, I have variables declared all over the place, and I really don't know where the right place to declare the components is.
So here's the question: the Java tutorial shows examples where applet variables are declared in the class itself and in the init() method e.g.
BEGIN CODE SNIPPET...
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class MultiListener extends JApplet
implements ActionListener {

//Glenn's comment: class variables...
JTextArea topTextArea;
JTextArea bottomTextArea;
JButton button1, button2;
final static String newline = "\n";
public void init() {
//Glenn's Comment: more variables??
JLabel l = null;
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
JPanel contentPane = new JPanel();
//Glenn's comment:
//another variable the same name as the class variable?
button1 = new JButton("Blah blah blah");
END CODE SNIPPET
Here's a similar problem, I have a table (visual interface object) and I want to populate it with data from my database (business object), I want to keep the buisness stuff away from the interface stuff, so where do I create my buisness object, if so, how do I pass it to the interface object?
Hope somebody can help
 
 
subject: Swinging around
 
Threads others viewed
How to call variables in one applet using another applet?
When I reload the applet the labels with html syntax hides.
ScrollBar Problem
Please help me with this grid bag layout!!
JAVA: What is the error in this applet?
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com