为什么Frame.setSize()方法对Frame的大小起不到作用呢,
我用setSize()调大Frame的宽和高可是Frame还是跟原来一样大小。
下面是我的代码:
public void setWarehouse(int wid){
    m_Warehouse_ID=wid;
    warehouseOK = true;
 
    Dimension frameSize = new Dimension(420, 900);
if (cp == null)
{
cp = new POSControlPanel();
cp.setParent(this);
}

this.setVisible(true);
    m_frame.getContentPane().add(cp, BorderLayout.CENTER);
    
    
    m_frame.setSize(frameSize);
    //m_frame.pack();
    
    this.setSize(frameSize);
    this.setSize(this.getSize());
    
    Toolkit kit = Toolkit.getDefaultToolkit();
        Dimension screenSize = kit.getScreenSize();
 
        // Stroring the screen dimensions, the width and the height
        int screenWidth = (int)screenSize.getWidth();     // getting Screen width
        int screenHeight = (int)screenSize.getHeight();  // getting Screen height
 
        // The following is the calculation needed to calcualte the
        // wanted position of the JDia//log.  It uses the top variabels
        // int screenWidth, and int screenHeight.
        m_frame.setLocation(((screenWidth / 2) - (m_frame.getWidth()/2)),
                         ((screenHeight / 2) - (m_frame.getHeight()/2)));
         
    m_frame.pack();
    
    Thread thread = new Thread(new Runnable(){
            public void run()
            {
                try{
                    initPOS();
                }catch(Exception e)
                {
                    e.printStackTrace();
                }
            }
        });
        thread.start();

  
   
}