package untitled12;import java.awt.*;
import java.awt.event.*;
import javax.swing.*;public class Frame1 extends JFrame {
JPanel contentPane;
GridBagLayout gridBagLayout1 = new GridBagLayout();
JScrollPane jScrollPane1 = new JScrollPane();
JTable jTable1 = new JTable(10,10); /**Construct the frame*/
public Frame1() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
/**Component initialization*/
private void jbInit() throws Exception {
//setIconImage(Toolkit.getDefaultToolkit().createImage(Frame1.class.getResource("[Your Icon]")));
contentPane = (JPanel) this.getContentPane();
contentPane.setLayout(gridBagLayout1);
this.setSize(new Dimension(400, 300));
this.setTitle("Frame Title");
jTable1.setPreferredSize(new Dimension(300, 200));
contentPane.add(jScrollPane1, new GridBagConstraints(0, 0, 5, 5, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 260, 200));
jScrollPane1.getViewport().add(jTable1, null);
}
/**Overridden so we can exit when window is closed*/
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
}
}
}
import java.awt.event.*;
import javax.swing.*;public class Frame1 extends JFrame {
JPanel contentPane;
GridBagLayout gridBagLayout1 = new GridBagLayout();
JScrollPane jScrollPane1 = new JScrollPane();
JTable jTable1 = new JTable(10,10); /**Construct the frame*/
public Frame1() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
/**Component initialization*/
private void jbInit() throws Exception {
//setIconImage(Toolkit.getDefaultToolkit().createImage(Frame1.class.getResource("[Your Icon]")));
contentPane = (JPanel) this.getContentPane();
contentPane.setLayout(gridBagLayout1);
this.setSize(new Dimension(400, 300));
this.setTitle("Frame Title");
jTable1.setPreferredSize(new Dimension(300, 200));
contentPane.add(jScrollPane1, new GridBagConstraints(0, 0, 5, 5, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 260, 200));
jScrollPane1.getViewport().add(jTable1, null);
}
/**Overridden so we can exit when window is closed*/
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货