This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes help~! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "help~! " Watch "help~! " New topic


li qing

Joined: Sep 27, 2003
Posts: 11
below is my source code for my JPanel... i got an error... can someone teach me where the problem lies?

import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;
public class Applet1 extends JApplet {
public static void main(String [] args) {
Applet1 Applet = new Applet1();
class stringPanel extends JPanel {
//create all label and variable
private JLabel topLabel = new JLabel("Picture Finding Game");
private JLabel bottomLabel = new JLabel("\nDo you recongize those picture?");
private int x,y;
public stringPanel() {
JPanel strPanel = new JPanel();
strPanel.setLayout(new BorderLayout,(5,10)); ----> error:
'(' or '[' expected at line 20
strPanel.add(topLabel, BorderLayout.NORTH);
strPanel.add(bottomLabel, BorderLayout.CENTER);

Scott Ding

Joined: Nov 27, 2002
Posts: 13
strPanel.setLayout(new BorderLayout,(5,10)); ----> error:
try this.
strPanel.setLayout(new BorderLayout(5,10));
li qing

Joined: Sep 27, 2003
Posts: 11
oh... ok... thanks a lot... the error is gone...
I agree. Here's the link:
subject: help~!
It's not a secret anymore!