• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

AWT - Type Expected ???

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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).]
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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() ;
}
}

 
Let's go to the waterfront with this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic