|
1st Java Project...Still
[php]
import javax.swing.JFrame;
import javax.swing.JButton;
import javax.swing.JPanel;
public class lettercount
{
public static void main(String args[])
{
Panel pan=new Panel();
pan.setLayout(new BorderLayout()); // STUPID LAYOUT
JFrame app=new JFrame();
JButton fileButton=new JButton("Scan File");
char[] letterArray=new char[26];
int[] letterCount=new int[26];
int count=0;
for(int i=97;i<=122;i++)
{
letterArray[count]=(char)i;
//System.out.printf("%d = %s\n",count,letterArray[count]);
count++;
}
app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
app.add(pan);
//app.add(fileButton);
app.setSize(450,250);
app.setVisible(true);
}
}
[/php]
Im am completely clueless on how to implement this BorderLayout thing so that i can manage where my buttons and other components are being placed.
[php]
Panel pan=new Panel();
pan.setLayout(new BorderLayout());
[/php]
these 2 lines of code are my main problem.. do i have to make my class extend JPanel??? Im lost....
I would like to add that im using the API page from sun as my reference.
__________________
"When in Rome, Do as the Romans Do"
"Beauty is in the eye of the BEER holder"
"Save your breath your going to need it for your blow up doll later"
SearchLores.org
|