JInternalFrame 界面上的控件怎么显示
我现在可以显示 MyJInternalFrame 界面了, 但是我加在上面的控件看不到
是怎么回事?
package untitled3;
import java.awt.*;
import java.util.*;
import java.awt.event.*;
import java.awt.font.*;
import java.awt.geom.*;
import java.awt.print.*;
import javax.swing.event.*;
import java.awt.print.Book.*;
import java.sql.*;
import javax.swing.*;
import javax.swing.border.*;
import com.borland.jbcl.layout.*;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2002</p>
* <p>Company: </p>
* @author unascribed
* @version 1.0
*/
public class MyJInternalFrame extends JInternalFrame {
private JDesktopPane JDesktop=new JDesktopPane();
private JMenuBar menubar =new JMenuBar();
private Vector objects =new Vector();
private Font tabFont =new Font("MonoSpaced",Font.PLAIN,12);
private JButton pageSetupBtt =new JButton("页面设置"); //看不到按钮
private JButton printBtt =new JButton("打印");
private JButton printPreviewBtt=new JButton("预览");
private JButton cmdBig =new JButton("放大");
private JButton cmdSmall =new JButton("缩小");
private JButton preBtt =new JButton("上一页");
private JButton nextBtt =new JButton("下一页");
private JButton cmdExit =new JButton("返回");
private JLabel lblVisible =new JLabel("");
private JLabel lblPageInfo =new JLabel(" ");
private JPanel bttPanel =new JPanel();
private FlowLayout flowLayout1 = new FlowLayout();
private GridBagLayout gridBagLayout1 = new GridBagLayout();
private GridBagLayout gridBagLayout2 = new GridBagLayout();
public MyJInternalFrame() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
private void jbInit() throws Exception {
putClientProperty("JInternalFrame.isPalette", Boolean.TRUE);
this.setClosable(true);
this.setContentPane(JDesktop);
this.setMaximizable(true);
this.setResizable(true);
this.setEnabled(true);
this.setNextFocusableComponent(JDesktop);
this.setToolTipText("");
setSize(new Dimension(720, 540));
try{setMaximum(true);}catch(Exception e){}
this.getContentPane().setLayout(gridBagLayout1);
JDesktop.setBorder(BorderFactory.createLineBorder(Color.black));
JDesktop.setSelectedFrame(this);
JDesktop.setLayout(gridBagLayout2);
bttPanel.setLayout(flowLayout1);
bttPanel.setBorder(BorderFactory.createLineBorder(Color.black));
bttPanel.add(lblPageInfo);
bttPanel.add(pageSetupBtt);
bttPanel.add(printBtt);
bttPanel.add(printPreviewBtt);
bttPanel.add(cmdBig);
bttPanel.add(cmdSmall);
bttPanel.add(preBtt);
bttPanel.add(nextBtt);
bttPanel.add(cmdExit);
JDesktop.add(lblVisible, new GridBagConstraints(0, 0, GridBagConstraints.REMAINDER, GridBagConstraints.REMAINDER, 0.0, 0.0
,GridBagConstraints.SOUTHWEST, GridBagConstraints.HORIZONTAL, new Insets(-1, -1, 0, 0), 0, 0));
JDesktop.add(bttPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(-1, -1, 475, 0), 136, -4));
JDesktop.add(lblVisible);
JDesktop.add(bttPanel, null);
pageSetupBtt.setMnemonic('S');
printPreviewBtt.setMnemonic('V');
cmdBig.setMnemonic('=');
preBtt.setMnemonic(',');
cmdSmall.setMnemonic('-');
nextBtt.setMnemonic('.');
printBtt.setMnemonic('P');
cmdExit.setMnemonic('X');
setJMenuBar(menubar);
menubar.add(bttPanel);
this.getContentPane().add(JDesktop, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0
,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 1, 0), 716, 512));
}
}