*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes AWT - Type Expected ??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "AWT - Type Expected ???" Watch "AWT - Type Expected ???" New topic
Author

AWT - Type Expected ???

Vivek Nambiar
Ranch Hand

Joined: Sep 25, 2000
Posts: 63

Type expected.
bigUpperPanel.setLayout(new GridLayout(1, 3, 20, 0));
1 error
Why is this happening? WHERE DO I GET THE INFORMATION ON ERRORS SUCH AS THE ABOVE. I MEAN A COMPLETE LISTING OF THESE TYPE OF ERRORS. DOES IT COME WITH THE jdk1.2.2 itself??
thank u!

[This message has been edited by Vivek Nambiar (edited October 12, 2000).]
Aparna Murthy
Greenhorn

Joined: Oct 13, 2000
Posts: 1
Hi Vivek,
I think there are some errors in your code . First the code starting with BigUpperPanel.setLayout() .... should be placed in a method block . You should place the setBounds() statement after populating all the panels and adding them to the frame. Finally you should add setVisible(true) ; to make Frame visible . The method should be called in main .
I tried compiling and running your code. It gave an error for the Scrollbar constructor (Scrollbar.HORIZANTAL, int, int, int) .
The field HORIZANTAL should be made HORIZONTAL and the Constructor takes 5 ints (including Scrollbar.HORIZONTAL). Hope this information helps you .
Here is the copy of my program which is running fine :
import java.awt.*;
import java.awt.event.* ;
public class Heir extends Frame
{
Heir()
{
super("Containment Heirarchy Demo");
}
String strings[] = {"Red :", "Green :", "Blue :"};
Panel bigUpperPanel = new Panel();
public void go()
{
setLayout(new BorderLayout(0, 25));
bigUpperPanel.setLayout(new GridLayout(1, 3, 20, 0));
for (int i=0; i<3; i++)
{
Panel levelPanel = new Panel();
levelPanel.setLayout(new GridLayout(3, 1, 0, 10));
levelPanel.add(new Label(strings[i]));
levelPanel.add(
new Scrollbar(Scrollbar.HORIZONTAL, 0, 1, 0, 255));
levelPanel.add(new TextField("0"));
bigUpperPanel.add(levelPanel);
}
add(bigUpperPanel, BorderLayout.CENTER);
Panel lowerPanel = new Panel();
lowerPanel.add(new Button("Apply"));
lowerPanel.add(new Button("Reset"));
lowerPanel.add(new Button("Cancel"));
add(lowerPanel, BorderLayout.SOUTH);
setBounds (20, 20, 300, 180);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0) ;
}
} ) ;
setVisible(true) ;
}
public static void main(String args[])
{
new Heir().go() ;
}
}

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: AWT - Type Expected ???