重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
楼上说的对啊,时间问题,祝你好运啦!
公司主营业务:成都网站制作、成都网站建设、移动网站开发等业务。帮助企业客户真正实现互联网宣传,提高企业的竞争能力。创新互联是一支青春激扬、勤奋敬业、活力青春激扬、勤奋敬业、活力澎湃、和谐高效的团队。公司秉承以“开放、自由、严谨、自律”为核心的企业文化,感谢他们对我们的高要求,感谢他们从不同领域给我们带来的挑战,让我们激情的团队有机会用头脑与智慧不断的给客户带来惊喜。创新互联推出华池免费做网站回馈大家。
PS:楼主不是我说你,这事早干嘛了~~
这种东西已涉及到商业利益,没人愿意帮你吧!都想你这样别人都没钱赚啦
package javaapplication26;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
// Import the Java classes
import java.util.*;
import javax.swing.border.EmptyBorder;
/**
* A JOutlookBar provides a component that is similar to a JTabbedPane, but instead of maintaining
* tabs, it uses Outlook-style bars to control the visible component
*/
public class JOutlookBar extends JPanel implements ActionListener {
private JPanel topPanel = new JPanel(new GridLayout(1, 1));
private JPanel bottomPanel = new JPanel(new GridLayout(1, 1));
/**
* A LinkedHashMap of bars: we use a linked hash map to preserve the order of the bars
*/
private Map bars = new LinkedHashMap();
/**
* The currently visible bar (zero-based index)
*/
private int visibleBar = 0;
/**
* A place-holder for the currently visible component
*/
private JComponent visibleComponent = null;
/**
* Creates a new JOutlookBar; after which you should make repeated calls to
* addBar() for each bar
*/
public JOutlookBar() {
this.setLayout(new BorderLayout());
this.add(topPanel, BorderLayout.NORTH);
this.add(bottomPanel, BorderLayout.SOUTH);
}
public void addBar(String name, JComponent component) {
BarInfo barInfo = new BarInfo(name, component);
barInfo.getButton().addActionListener(this);
this.bars.put(name, barInfo);
render();
}
/**
* Adds the specified component to the JOutlookBar and sets the bar's name
*
* @param name The name of the outlook bar
* @param icon An icon to display in the outlook bar
* @param componenet The component to add to the bar
*/
public void addBar(String name, Icon icon, JComponent component) {
BarInfo barInfo = new BarInfo(name, icon, component);
barInfo.getButton().addActionListener(this);
this.bars.put(name, barInfo);
render();
}
/**
* Removes the specified bar from the JOutlookBar
*
* @param name The name of the bar to remove
*/
public void removeBar(String name) {
this.bars.remove(name);
render();
}
/**
* Returns the index of the currently visible bar (zero-based)
*
* @return The index of the currently visible bar
*/
public int getVisibleBar() {
return this.visibleBar;
}
/**
* Programmatically sets the currently visible bar; the visible bar
* index must be in the range of 0 to size() - 1
*
* @param visibleBar The zero-based index of the component to make visible
*/
public void setVisibleBar(int visibleBar) {
if (visibleBar 0
visibleBar this.bars.size() - 1) {
this.visibleBar = visibleBar;
render();
}
}
/**
* Causes the outlook bar component to rebuild itself; this means that
* it rebuilds the top and bottom panels of bars as well as making the
* currently selected bar's panel visible
*/
public void render() {
// Compute how many bars we are going to have where
int totalBars = this.bars.size();
int topBars = this.visibleBar + 1;
int bottomBars = totalBars - topBars;
// Get an iterator to walk through out bars with
Iterator itr = this.bars.keySet().iterator();
// Render the top bars: remove all components, reset the GridLayout to
// hold to correct number of bars, add the bars, and "validate" it to
// cause it to re-layout its components
this.topPanel.removeAll();
GridLayout topLayout = (GridLayout) this.topPanel.getLayout();
topLayout.setRows(topBars);
BarInfo barInfo = null;
for (int i = 0; i topBars; i++) {
String barName = (String) itr.next();
barInfo = (BarInfo) this.bars.get(barName);
this.topPanel.add(barInfo.getButton());
}
this.topPanel.validate();
// Render the center component: remove the current component (if there
// is one) and then put the visible component in the center of this panel
if (this.visibleComponent != null) {
this.remove(this.visibleComponent);
}
this.visibleComponent = barInfo.getComponent();
this.add(visibleComponent, BorderLayout.CENTER);
// Render the bottom bars: remove all components, reset the GridLayout to
// hold to correct number of bars, add the bars, and "validate" it to
// cause it to re-layout its components
this.bottomPanel.removeAll();
GridLayout bottomLayout = (GridLayout) this.bottomPanel.getLayout();
bottomLayout.setRows(bottomBars);
for (int i = 0; i bottomBars; i++) {
String barName = (String) itr.next();
barInfo = (BarInfo) this.bars.get(barName);
this.bottomPanel.add(barInfo.getButton());
}
this.bottomPanel.validate();
this.validate();
}
/**
* Invoked when one of our bars is selected
*/
public void actionPerformed(ActionEvent e) {
/* int currentBar = 0;
for (Iterator i = this.bars.keySet().iterator(); i.hasNext();) {
String barName = (String) i.next();
BarInfo barInfo = (BarInfo) this.bars.get(barName);
if (barInfo.getButton() == e.getSource()) {
// Found the selected button
this.visibleBar = currentBar;
render();
return;
}
currentBar++;
}*/
BarInfo barInfo = (BarInfo) this.bars.get("员工管理");
if (barInfo.getButton() == e.getSource()) {
this.visibleBar = 0;
render();
return;
}
}
/**
* Debug, dummy method
*/
public static JPanel getDummyPanel(String name) {
JPanel panel = new JPanel(new BorderLayout());
panel.add(new JLabel(name, JLabel.CENTER));
return panel;
}
public static JPanel getEmployeePanel() {
GridBagLayout gbl = new GridBagLayout();
GridBagConstraints gbc = new GridBagConstraints();
JPanel panel = new JPanel(gbl);
panel.setBorder(new EmptyBorder(12, 12, 0, 11));
gbc.gridx = 0;
gbc.gridy = 0;
gbc.insets = new Insets(0, 0, 0, 5);
gbc.anchor = GridBagConstraints.EAST;
panel.add(new JMenuItem(new addEmployeeInfoAction()), gbc);
gbc.gridy++;
gbc.insets = new Insets(0, 0, 0, 5);
gbc.anchor = GridBagConstraints.EAST;
panel.add(new JMenuItem(new modifyEmployeeInfoAction()), gbc);
gbc.gridy++;
gbc.insets = new Insets(0, 0, 0, 5);
gbc.anchor = GridBagConstraints.EAST;
panel.add(new JMenuItem(new searchEmployeeInfoAction()), gbc);
gbc.gridy++;
gbc.insets = new Insets(0, 0, 0, 5);
gbc.anchor = GridBagConstraints.EAST;
panel.add(new JMenuItem(new deleteEmployeeInfoAction()), gbc);
return panel;
}
/**
* Debug test...
*/
public static void main(String[] args) {
JFrame frame = new JFrame("学生信息管理");
JOutlookBar outlookBar = new JOutlookBar();
//outlookBar.addBar(TOOL_TIP_TEXT_KEY, component)
outlookBar.addBar("员工管理", getEmployeePanel());
// outlookBar.add
outlookBar.addBar("饭卡管理", getDummyPanel(""));
outlookBar.addBar("销售管理", getDummyPanel(""));
// outlookBar.addBar( "Four", getDummyPanel( "Four" ) );
// outlookBar.addBar( "Five", getDummyPanel( "Five" ) );
outlookBar.setVisibleBar(2);
frame.getContentPane().add(outlookBar);
frame.setSize(200, 400);
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation(d.width / 2 - 400, d.height / 2 - 300);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
/**
* Internal class that maintains information about individual Outlook bars;
* specifically it maintains the following information:
*
* name The name of the bar
* button The associated JButton for the bar
* component The component maintained in the Outlook bar
*/
class BarInfo {
/**
* The name of this bar
*/
private String name;
/**
* The JButton that implements the Outlook bar itself
*/
private JButton button;
/**
* The component that is the body of the Outlook bar
*/
private JComponent component;
/**
* Creates a new BarInfo
*
* @param name The name of the bar
* @param component The component that is the body of the Outlook Bar
*/
public BarInfo(String name, JComponent component) {
this.name = name;
this.component = component;
this.button = new JButton(name);
}
/**
* Creates a new BarInfo
*
* @param name The name of the bar
* @param icon JButton icon
* @param component The component that is the body of the Outlook Bar
*/
public BarInfo(String name, Icon icon, JComponent component) {
this.name = name;
this.component = component;
this.button = new JButton(name, icon);
}
public String getName() {
return this.name;
}
/**
* Sets the name of the bar
*
* @param The name of the bar
*/
public void setName(String name) {
this.name = name;
}
public JButton getButton() {
return this.button;
}
public JComponent getComponent() {
return this.component;
}
}
}
class addEmployeeInfoAction extends AbstractAction {
{
putValue(Action.SHORT_DESCRIPTION, "heool");
putValue(Action.NAME, "添加员工信息");
putValue(Action.LONG_DESCRIPTION, "Name this element.");
putValue(Action.MNEMONIC_KEY,
new Integer(java.awt.event.KeyEvent.VK_L));
}
public void actionPerformed(ActionEvent e) {
JDialog dialog = new JDialog();
dialog.setName("Message");
dialog.setVisible(true);
//throw new UnsupportedOperationException("Not supported yet.");
}
}
class modifyEmployeeInfoAction extends AbstractAction {
{
putValue(Action.SHORT_DESCRIPTION, "heool");
putValue(Action.NAME, "修改员工信息");
putValue(Action.LONG_DESCRIPTION, "Name this element.");
putValue(Action.MNEMONIC_KEY,
new Integer(java.awt.event.KeyEvent.VK_L));
}
public void actionPerformed(ActionEvent e) {
JDialog dialog = new JDialog();
dialog.setName("Message");
dialog.setVisible(true);dialog.setSize(100, 100);
//throw new UnsupportedOperationException("Not supported yet.");
}
}
class searchEmployeeInfoAction extends AbstractAction {
{
putValue(Action.SHORT_DESCRIPTION, "heool");
putValue(Action.NAME, "查询员工信息");
putValue(Action.LONG_DESCRIPTION, "Name this element.");
putValue(Action.MNEMONIC_KEY,
new Integer(java.awt.event.KeyEvent.VK_L));
}
public void actionPerformed(ActionEvent e) {
JDialog dialog = new JDialog();
dialog.setName("Message");
dialog.setVisible(true);
//throw new UnsupportedOperationException("Not supported yet.");
}
}
class deleteEmployeeInfoAction extends AbstractAction {
{
putValue(Action.SHORT_DESCRIPTION, "heool");
putValue(Action.NAME, "删除员工信息");
putValue(Action.LONG_DESCRIPTION, "Name this element.");
putValue(Action.MNEMONIC_KEY,
new Integer(java.awt.event.KeyEvent.VK_L));
}
public void actionPerformed(ActionEvent e) {
JDialog dialog = new JDialog();
dialog.setName("Message");
dialog.setVisible(true);dialog.setVisible(true);
//点击对应的操作
//throw new UnsupportedOperationException("Not supported yet.");
}
}
程序沿用到楼上的那个模板,不过有些地方很毛糙,你自己在修改一下,比方说对事件的定义还有对那几个选项的位置等你自己再修改一下
答案voidmain(){intsele=1,t;floatx;system("cls");printf("欢迎使用简易菜单!本菜单在VC++平台编译通过\n");printf("有何建议请联系本人!\n");printf("成绩管理菜单\n");printf("\n");printf("1.输入成绩2.计算总分3.求平均值4.输出总分与平均5.清理屏幕6.高低排列7.上平均分人数0.退出8.全部情况:总分平均分第一名及格人数");scanf("%d",sele);puts("");if(sele=0sele1.输入成绩2.计算总分3.求平均值4.输出总分与平均5.清理屏幕6.高低排列7.上平均分人数0.退出8.全部情况:总分平均分第一名及格人数\n");break;case6:gaodi(a);break;case7:super(a);break;case8:full(t,x);break;}elseprintf("你的输入有误,请重新:")