📄 matchinfopane.java
字号:
/*
* Created 2008-9-16
*/
package fbms;
import javax.swing.*;
import java.awt.*;
import javax.swing.event.*;
public class MatchInfoPane extends JPanel
{
public MatchInfoPane()
{
JPanel teams = new JPanel();
teams.setLayout(new GridLayout(2,5));
teams.add(new JLabel("主队"));
teams.add(jlMScore = new JLabel("0"));
teams.add(new JLabel(":"));
teams.add(jlGScore = new JLabel("0"));
teams.add(new JLabel("客队"));teams.add(new JLabel());
teams.add(jcMTeam = new JComboBox());
teams.add(jcGTeam = new JComboBox());
teams.add(new JLabel());
jpGoalInfoPane = new GoalInfoPane();
jtTabbedPane = new JTabbedPane();
jtTabbedPane.add("进球情况",null);
jtTabbedPane.addChangeListener(new ChangeListener()
{
public void stateChanged(ChangeEvent event)
{
if (jtTabbedPane.getSelectedComponent() == null)
{
int n = jtTabbedPane.getSelectedIndex();
loadTab(n);
}
}
}
);
loadTab(0);
JPanel jpBottom = new JPanel();
jpBottom.setLayout(new GridLayout(1,3));
JPanel jpTurn = new JPanel();
jpTurn.add(new JLabel("第"));
jpTurn.add(jcTurn = new JComboBox());
jpTurn.add(new JLabel("轮"));
jpBottom.add(jpTurn);
JPanel jpTime = new JPanel();
jpTime.setLayout(new GridLayout(1,4));
jpTime.add(new JLabel("日期"));
jpTime.add(jcYear = new JComboBox());
jpTime.add(jcMonth= new JComboBox());
jpTime.add(jcDay = new JComboBox());
jpBottom.add(jpTime);
jpBottom.add(jbSubmitAll = new JButton("输入"));
setLayout(new BorderLayout());
add(teams,"North");
add(jtTabbedPane,"Center");
add(jpBottom,"South");
}
private void loadTab(int n)
{
jtTabbedPane.setComponentAt(n, jpGoalInfoPane = new GoalInfoPane());
}
private class GoalInfoPane extends JPanel
{
public GoalInfoPane()
{
JPanel jpMGoalInfo = new JPanel();
jpMGoalInfo.setLayout(new GridLayout(0,1));
JPanel jpMGoalPlayer = new JPanel();
jpMGoalPlayer.setLayout(new GridLayout(1,0));
jpMGoalPlayer.add(new Label("进球队员"));
jpMGoalPlayer.add(jcMGoalPlayer = new JComboBox());
JPanel jpMGoalTime = new JPanel();
jpMGoalTime.setLayout(new GridLayout(1,0));
jpMGoalTime.add(new Label("进球时间"));
jpMGoalTime.add(jtMGoalTime = new JTextField());
JPanel jpMGoalPlace = new JPanel();
jpMGoalPlace.setLayout(new GridLayout(1,0));
jpMGoalPlace.add(new Label("进球位置"));
jpMGoalPlace.add(jcMGoalPlace = new JComboBox());
JPanel jpMGoalStyle = new JPanel();
jpMGoalStyle.setLayout(new GridLayout(1,0));
jpMGoalStyle.add(new Label("进球方式"));
jpMGoalStyle.add(jcMGoalStyle = new JComboBox());
jbMSubmit = new JButton("确定");
jpMGoalInfo.add(jpMGoalPlayer);
jpMGoalInfo.add(jpMGoalTime);
jpMGoalInfo.add(jpMGoalPlace);
jpMGoalInfo.add(jpMGoalStyle);
jpMGoalInfo.add(jbMSubmit);
jtaMGoalInfo = new JTextArea();
jtaMGoalInfo.setBorder(BorderFactory.createEtchedBorder());
jtaGGoalInfo = new JTextArea();
jtaGGoalInfo.setBorder(BorderFactory.createEtchedBorder());
JPanel jpGGoalInfo = new JPanel();
jpGGoalInfo.setLayout(new GridLayout(0,1));
JPanel jpGGoalPlayer = new JPanel();
jpGGoalPlayer.setLayout(new GridLayout(1,0));
jpGGoalPlayer.add(new Label("进球队员"));
jpGGoalPlayer.add(jcGGoalPlayer = new JComboBox());
JPanel jpGGoalTime = new JPanel();
jpGGoalTime.setLayout(new GridLayout(1,0));
jpGGoalTime.add(new Label("进球时间"));
jpGGoalTime.add(jtGGoalTime = new JTextField());
JPanel jpGGoalPlace = new JPanel();
jpGGoalPlace.setLayout(new GridLayout(1,0));
jpGGoalPlace.add(new Label("进球位置"));
jpGGoalPlace.add(jcGGoalPlace = new JComboBox());
JPanel jpGGoalStyle = new JPanel();
jpGGoalStyle.setLayout(new GridLayout(1,0));
jpGGoalStyle.add(new Label("进球方式"));
jpGGoalStyle.add(jcGGoalStyle = new JComboBox());
jbGSubmit = new JButton("确定");
jpGGoalInfo.add(jpGGoalPlayer);
jpGGoalInfo.add(jpGGoalTime);
jpGGoalInfo.add(jpGGoalPlace);
jpGGoalInfo.add(jpGGoalStyle);
jpGGoalInfo.add(jbGSubmit);
setLayout(new GridLayout(0,4));
add(jpMGoalInfo);
add(jtaMGoalInfo);
add(jtaGGoalInfo);
add(jpGGoalInfo);
}
}
JComboBox jcMasterTeam;
JComboBox jcGuestTeam;
JLabel jlMScore;
JLabel jlGScore;
JComboBox jcMTeam;
JComboBox jcGTeam;
JTabbedPane jtTabbedPane;
JComboBox jcMGoalPlayer;
JComboBox jcGGoalPlayer;
JTextField jtMGoalTime;
JTextField jtGGoalTime;
JComboBox jcMGoalPlace;
JComboBox jcGGoalPlace;
JComboBox jcMGoalStyle;
JComboBox jcGGoalStyle;
JButton jbMSubmit;
JButton jbGSubmit;
JTextArea jtaMGoalInfo;
JTextArea jtaGGoalInfo;
GoalInfoPane jpGoalInfoPane;
JComboBox jcTurn;
JComboBox jcYear;
JComboBox jcMonth;
JComboBox jcDay;
JButton jbSubmitAll;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -