搞了一天了,还是没有弄出来,请各位看看,先谢谢了。package Firstpanel;import java.awt.*; //import java.awt.event.ActionEvent;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; //import java.awt.event.KeyEvent;
//import java.awt.event.WindowAdapter;
//import java.awt.event.WindowEvent;
import javax.swing.*;
import javax.swing.JFrame;
import javax.swing.table.*;
@SuppressWarnings("serial")
public class MainWindow extends JFrame implements ActionListener {
// private static final Component JPanel = null;
private JTabbedPane tabbedPane;
private JLabel label1, label2, label3;
private JPanel panel1,panel2,panel3;
private JButton button1, button2, button3, button4, button5, button6,
button7, button8;
private JTextField cTxt1;
private JComboBox c1, c2, c3, c4, c5;
//private JScrollPane j1, j2, j3;public MainWindow() {
super("管理界面");
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
// TODO: handle exception
}setSize(700, 500);
setResizable(false);
centerJFrame();
Container container = getContentPane();
tabbedPane = new JTabbedPane();panel1 = new JPanel();
panel1.setBackground(Color.cyan);
panel2 = new JPanel();
panel3 = new JPanel();label1 = new JLabel("员工工号:");
label1.setBounds(60, 15, 90, 28);JTable table = new JTable(100, 5);
table.setBounds(40, 70, 620, 300);
table.setShowVerticalLines(true);
panel1.add(table);cTxt1 = new JTextField(12);
cTxt1.setBounds(120, 20, 100, 23);button1 = new JButton("查询");
button1.setBounds(270, 20, 90, 28);
button2 = new JButton("添加");
button2.setBounds(410, 20, 90, 28);
button3 = new JButton("删除");
button3.setBounds(550, 20, 90, 28);
button4 = new JButton("查询");
button4.setBounds(270, 20, 90, 28);
button5 = new JButton("添加");
button5.setBounds(410, 20, 90, 28);
button6 = new JButton("删除");
button6.setBounds(550, 20, 90, 28);
button7 = new JButton("密码修改");
button7.setBounds(270, 20, 90, 28);
button8 = new JButton("退出");
button8.setBounds(410, 20, 90, 28);panel1.add(cTxt1);
panel1.add(label1);
panel1.add(button1);
panel1.add(button2);
panel1.add(button3);
panel2.add(button4);
panel2.add(button5);
panel2.add(button6);
panel3.add(button7);
panel3.add(button8);tabbedPane.addTab("人事管理", null, panel1, "人事管理");
tabbedPane.addTab("财务管理", null, panel2, "财务管理");
tabbedPane.addTab("系统管理", null, panel3, "系统管理");
tabbedPane.setBackground(Color.BLUE);panel1.setLayout(null);
panel2.setLayout(null);
panel3.setLayout(null);container.add(tabbedPane);
container.setBackground(Color.WHITE);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);}public void centerJFrame() {
int screenwidth = Toolkit.getDefaultToolkit().getScreenSize().width;
int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height;
setLocation((screenwidth - getWidth()) / 2,
(screenHeight - getHeight()) / 2);
}public static void main(String[] args) {
new MainWindow();
}@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub}
}
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; //import java.awt.event.KeyEvent;
//import java.awt.event.WindowAdapter;
//import java.awt.event.WindowEvent;
import javax.swing.*;
import javax.swing.JFrame;
import javax.swing.table.*;
@SuppressWarnings("serial")
public class MainWindow extends JFrame implements ActionListener {
// private static final Component JPanel = null;
private JTabbedPane tabbedPane;
private JLabel label1, label2, label3;
private JPanel panel1,panel2,panel3;
private JButton button1, button2, button3, button4, button5, button6,
button7, button8;
private JTextField cTxt1;
private JComboBox c1, c2, c3, c4, c5;
//private JScrollPane j1, j2, j3;public MainWindow() {
super("管理界面");
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
// TODO: handle exception
}setSize(700, 500);
setResizable(false);
centerJFrame();
Container container = getContentPane();
tabbedPane = new JTabbedPane();panel1 = new JPanel();
panel1.setBackground(Color.cyan);
panel2 = new JPanel();
panel3 = new JPanel();label1 = new JLabel("员工工号:");
label1.setBounds(60, 15, 90, 28);JTable table = new JTable(100, 5);
table.setBounds(40, 70, 620, 300);
table.setShowVerticalLines(true);
panel1.add(table);cTxt1 = new JTextField(12);
cTxt1.setBounds(120, 20, 100, 23);button1 = new JButton("查询");
button1.setBounds(270, 20, 90, 28);
button2 = new JButton("添加");
button2.setBounds(410, 20, 90, 28);
button3 = new JButton("删除");
button3.setBounds(550, 20, 90, 28);
button4 = new JButton("查询");
button4.setBounds(270, 20, 90, 28);
button5 = new JButton("添加");
button5.setBounds(410, 20, 90, 28);
button6 = new JButton("删除");
button6.setBounds(550, 20, 90, 28);
button7 = new JButton("密码修改");
button7.setBounds(270, 20, 90, 28);
button8 = new JButton("退出");
button8.setBounds(410, 20, 90, 28);panel1.add(cTxt1);
panel1.add(label1);
panel1.add(button1);
panel1.add(button2);
panel1.add(button3);
panel2.add(button4);
panel2.add(button5);
panel2.add(button6);
panel3.add(button7);
panel3.add(button8);tabbedPane.addTab("人事管理", null, panel1, "人事管理");
tabbedPane.addTab("财务管理", null, panel2, "财务管理");
tabbedPane.addTab("系统管理", null, panel3, "系统管理");
tabbedPane.setBackground(Color.BLUE);panel1.setLayout(null);
panel2.setLayout(null);
panel3.setLayout(null);container.add(tabbedPane);
container.setBackground(Color.WHITE);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);}public void centerJFrame() {
int screenwidth = Toolkit.getDefaultToolkit().getScreenSize().width;
int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height;
setLocation((screenwidth - getWidth()) / 2,
(screenHeight - getHeight()) / 2);
}public static void main(String[] args) {
new MainWindow();
}@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub}
}
解决方案 »
- select菜单中的值存在数据表中,现在要改变菜单中的值的个数,发现取不到原来的值,会报null错误
- java 里的冒号是什么意思
- 请问下面一段字符是什么?
- html:option能不能设置某一项为选中
- 请教如何制作操作界面来传递文件路径
- 为什么不往文件里写啊??
- 简单线程问题(没输出)怎么办
- 在java中 内存、栈内存、堆内存到底有什么区别和联系呢?谁能说清楚啊,请帮忙澄清噢
- 怎样用链表实现collection接口 ??
- 为什么 总是 Exception in thread "main" java.lang.NoClassDefFoundError: NewsRobot/class????
- 这道题怎么做啊 帮帮忙啊
- java中FileOutputStream的问题
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import javax.swing.table.*;public class MainWindow extends JFrame implements ActionListener {
private JTabbedPane tabbedPane;
private JScrollPane jScrollPane;
private JLabel label1, label2, label3;
private JPanel panel1, panel2, panel3;
private JButton button1, button2, button3, button4, button5, button6,
button7, button8;
private JTextField cTxt1;
private JComboBox c1, c2, c3, c4, c5;
public MainWindow(){
initialize();
}
private void initialize() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setTitle("管理系统");
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
// TODO: handle exception
}
setSize(700, 500);
setResizable(false);
setLocationRelativeTo(null);
Container container = getContentPane();
tabbedPane = new JTabbedPane();
panel1 = new JPanel();
panel2 = new JPanel();
panel3 = new JPanel(); label1 = new JLabel("员工工号:");
label1.setBounds(60, 15, 90, 28); JTable table = new JTable(100, 5);
panel1.add(table);
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(table);
jScrollPane.setBounds(40, 70, 620, 300);
panel1.add(jScrollPane);
cTxt1 = new JTextField(12);
cTxt1.setBounds(120, 20, 100, 23); button1 = new JButton("查询");
button1.setBounds(270, 20, 90, 28);
button2 = new JButton("添加");
button2.setBounds(410, 20, 90, 28);
button3 = new JButton("删除");
button3.setBounds(550, 20, 90, 28);
button4 = new JButton("查询");
button4.setBounds(270, 20, 90, 28);
button5 = new JButton("添加");
button5.setBounds(410, 20, 90, 28);
button6 = new JButton("删除");
button6.setBounds(550, 20, 90, 28);
button7 = new JButton("密码修改");
button7.setBounds(270, 20, 90, 28);
button8 = new JButton("退出");
button8.setBounds(410, 20, 90, 28); panel1.add(cTxt1);
panel1.add(label1);
panel1.add(button1);
panel1.add(button2);
panel1.add(button3);
panel2.add(button4);
panel2.add(button5);
panel2.add(button6);
panel3.add(button7);
panel3.add(button8); tabbedPane.addTab("人事管理", null, panel1, "人事管理");
tabbedPane.addTab("财务管理", null, panel2, "财务管理");
tabbedPane.addTab("系统管理", null, panel3, "系统管理");
tabbedPane.setBackground(Color.BLUE); panel1.setLayout(null);
panel2.setLayout(null);
panel3.setLayout(null); container.add(tabbedPane);
container.setBackground(Color.WHITE);
}
public static void main(String[] args) {
MainWindow mw = new MainWindow();
mw.setVisible(true);
}
public void actionPerformed(ActionEvent e) { }
}