⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 riliframe.java

📁 长沙公交查询管理系统,主要实现对人员资料的管理以及车辆的分配路线。
💻 JAVA
字号:
package pro;

import java.util.Vector;

import java.awt.Color;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.BorderLayout;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextArea;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
public class RiliFrame extends JFrame implements ActionListener
{
    private JComboBox cboYear;
    private JComboBox cboMonth;
    private JButton btnShow,btnExit;
 
    private JTextArea txaDisplay;
    private  MainFrame mf;
    private JPanel pnlSouth;
    MyTimePanel myTime=new MyTimePanel();
    
    JScrollPane spnShow;
    public RiliFrame()
    {
        super("万年历");
       
       	txaDisplay = new JTextArea(); 
        txaDisplay.setBackground(Color.CYAN);
        txaDisplay.setForeground(Color.BLACK);
        txaDisplay.setTabSize(4);
        txaDisplay.setEditable(false);
       	spnShow=new JScrollPane(txaDisplay);
       	myTime.setBounds(0,0,290,30);
       	spnShow.setBounds(10,30,300,126);
       	
       	spnShow.getViewport();
       	
       	
      
        
       

        pnlSouth=new SouthPanel();
        pnlSouth.setBounds(0,165,290,50);
        Container me = this.getContentPane();
       
        me.setLayout(null);
        me.add(myTime);
        me.add(spnShow);
        me.add(pnlSouth);
        txaDisplay.setText((new CalendarInfo()).toString());
       
        //btnExit.addActionListener(this);
        
      //  this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setSize(350, 260);
        this.setLocationRelativeTo(this);
        this.setResizable(false);
        this.setVisible(true);
    }
     public void actionPerformed(ActionEvent ae)
     {
   
			this.dispose();

     }
    
    private class SouthPanel extends JPanel implements ActionListener
    {
        public SouthPanel()
        {
            super(new FlowLayout());
            btnShow = new JButton("显示");
            btnShow.setToolTipText("点击显示日历...");
           
           	btnShow.setActionCommand("btnShow");
            btnShow.addActionListener(this);
           
                               
            this.add(cboYear_initialize());
            this.add(new JLabel("年"));
            this.add(cboMonth_initialize());
            this.add(new JLabel("月"));
            this.add(btnShow);
            
        }
        
        public void actionPerformed(ActionEvent ae)
        {
        		int year = ((Integer)(cboYear.getSelectedItem())).intValue();
		        int month = ((Integer)(cboMonth.getSelectedItem())).intValue();
		        try
		        {
		            CalendarInfo ci = new CalendarInfo(year, month);
		            txaDisplay.setText(ci.toString());
		        }
		        catch (Exception de)
		        {
		           
		           de.printStackTrace();
		        }


        }
        
        private JComboBox cboYear_initialize()
        {
            Vector vecYear = new Vector();
            for (int i = 1900; i <= 2100; i++)
            {
                vecYear.add(new Integer(i));   
            }
            cboYear = new JComboBox(vecYear);
            int nowYear = CalendarInfo.getNowYear();
            cboYear.setSelectedItem(new Integer(nowYear));
            cboYear.setToolTipText("请选择年份");
            return (cboYear);
        }
        
        private JComboBox cboMonth_initialize()
        {
            Vector vecMonth = new Vector();
            for (int i = 1; i <= 12; i++)
            {
                vecMonth.add(new Integer(i));   
            }
            cboMonth = new JComboBox(vecMonth);
            int nowMonth = CalendarInfo.getNowMonth();
            cboMonth.setSelectedItem(new Integer(nowMonth));
            cboMonth.setToolTipText("请选择月份");
            return (cboMonth);
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -