setPreferredSize
public void setPreferredSize(Dimension�preferredSize)
      Sets the preferred size of the receiving component. If preferredSize
      is null, the UI will be asked for the preferred size.

      This comes from the java.sun.com api

      The method is for JButtons not Buttons

      Just switch to a JButton and you should be ok

      You still will probally have to switch to a GridBagLayout or another
      layout


                                                                                       
                                                
                      "Tim Nicholson"                                                  
                                                
                      <tim80                   To:      "jdjlist" <[EMAIL PROTECTED]>  
                                      
                      @bigpond.com>            cc:                                     
                                                
                                               Subject: [jdjlist] trying to master 
Buttons                                             
                      02/24/2003 09:36                                                 
                                                
                      AM                                                               
                                                
                      Please respond                                                   
                                                
                      to "jdjlist"                                                     
                                                
                                                                                       
                                                
                                                                                       
                                                




Ok,

thanks for that info Jason, but I have gotten an error unfortunately.

The error is as follows :-

=================================================================
C:\Program Files\Xinox Software\JCreator
LE\MyProjects\Assign1Project\File1.java:24: cannot resolve symbol
symbol  : method setPreferredSize  (java.awt.Dimension)
location: class java.awt.Button
 setbutton.setPreferredSize(new Dimension(50, 50));
                 ^
1 error

Process completed.
=================================================================

My code is as follows :-

import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;

public class File1 extends Frame implements ActionListener{

//button is a GUI component


 private Button setbutton;


 public File1() {

 //setLayout(new GridLayout(3,2));

 setbutton = new Button("SET");
 add(setbutton);
 setbutton.addActionListener(this);
 setbutton.setPreferredSize(new Dimension(50, 50));


 setSize(300,100);
 setTitle("Kitchen System");
 setVisible(true);

}//end of constructor

//---------------------------------------------------------------
//actionPerformed
//---------------------------------------------------------------

public void actionPerformed (ActionEvent e) {
 Button b = (Button)e.getSource();

 if (b == setbutton)
 {

 }//end of if


}//end of actionPerf


 public static void main(String [] args)
 {
 new File1();

 }

}//end of class
---
You are currently subscribed to jdjlist as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]
http://www.sys-con.com/fusetalk





---
You are currently subscribed to jdjlist as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
http://www.sys-con.com/fusetalk

Reply via email to