你的信箱是多少
我的是[email protected]
你把你的信箱告诉我
我编一个给你发过去

解决方案 »

  1.   

    你需要用到哪里?
    JAVASCRIPT和applet的好像都有现成的。
      

  2.   

    我的信箱已经写在上面了[email protected]
    我需要用到applet,如果有的话请发给我一个,非常感谢!
      

  3.   

    源码如下,看看如何?/**
     * @(#) Calendar.java
     * @author fancy
     */import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.table.*;public class MyCalendar extends JApplet {    public static final String WEEK_SUN = "SUN";
        public static final String WEEK_MON = "MON";
        public static final String WEEK_TUE = "TUE";
        public static final String WEEK_WED = "WED";
        public static final String WEEK_THU = "THU";
        public static final String WEEK_FRI = "FRI";
        public static final String WEEK_SAT = "SAT";    JPanel cPane;
        JLabel yearsLabel;
        JSpinner yearsSpinner;
        JLabel monthsLabel;
        JComboBox monthsComboBox;
        JTable daysTable;
        AbstractTableModel daysModel;
        Calendar calendar;
        Calendar today;    public MyCalendar() {
            cPane = (JPanel) getContentPane();
        }    public void init() {
            cPane.setLayout(new BorderLayout());        today = Calendar.getInstance();
            calendar = Calendar.getInstance();
            yearsLabel = new JLabel("Year: ");
            yearsSpinner = new JSpinner();
            yearsSpinner.setValue(new Integer(calendar.get(Calendar.YEAR)));
            yearsSpinner.addChangeListener(new ChangeListener() {
                public void stateChanged(ChangeEvent changeEvent) {
                    updateView();
                }
            });        JPanel yearMonthPanel = new JPanel();
            cPane.add(yearMonthPanel, BorderLayout.NORTH);
            yearMonthPanel.setLayout(new BorderLayout());
            yearMonthPanel.add(new JPanel(), BorderLayout.CENTER);
            JPanel yearPanel = new JPanel();
            yearMonthPanel.add(yearPanel, BorderLayout.WEST);
            yearPanel.setLayout(new BorderLayout());
            yearPanel.add(yearsLabel, BorderLayout.WEST);
            yearPanel.add(yearsSpinner, BorderLayout.CENTER);        monthsLabel = new JLabel("Month: ");
            monthsComboBox = new JComboBox();
            for (int i = 1; i <= 12; i++) {
                monthsComboBox.addItem(new Integer(i));
            }
            monthsComboBox.setSelectedIndex(calendar.get(Calendar.MONTH));
            monthsComboBox.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent actionEvent) {
                        updateView();
                    }
                });
            JPanel monthPanel = new JPanel();
            yearMonthPanel.add(monthPanel, BorderLayout.EAST);
            monthPanel.setLayout(new BorderLayout());
            monthPanel.add(monthsLabel, BorderLayout.WEST);
            monthPanel.add(monthsComboBox, BorderLayout.CENTER);        daysModel = new AbstractTableModel() {
                    public int getRowCount() {
                        return 7;
                    }                public int getColumnCount() {
                        return 7;
                    }                public Object getValueAt(int row, int column) {
                        if (row == 0) {
                            return getHeader(column);
                        }
                        row--;
                        Calendar calendar = Calendar.getInstance();
                        calendar.set(((Integer) yearsSpinner.getValue()).intValue(), monthsComboBox.getSelectedIndex(), 1);
                        int dayCount = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
                        int moreDayCount = calendar.get(Calendar.DAY_OF_WEEK) - 1;
                        int index = row * 7 + column;
                        if (index >= dayCount || index < moreDayCount) {
                            return null;
                        } else {
                            return new Integer(index - moreDayCount + 1);
                        }
                    }
                };        daysTable = new JTable(daysModel);
            daysTable.setCellSelectionEnabled(true);        daysTable.setDefaultRenderer(daysTable.getColumnClass(0), new TableCellRenderer() {
                    public static final Color background = Color.white;
                    public static final Color foreground = Color.black;
                    public static final Color headerBackground = Color.blue;
                    public static final Color headerForeground = Color.white;
                    public static final Color selectedBackground = Color.blue;
                    public static final Color selectedForeground = Color.white;                public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                                                                   boolean hasFocus, int row, int column) {
                        String text = (value == null) ? "" : value.toString();
                        JLabel cell = new JLabel(text);
                        cell.setOpaque(true);
                        if (row == 0) {
                            cell.setForeground(headerForeground);
                            cell.setBackground(headerBackground);
                        } else {
                            if (isSelected) {
                                cell.setForeground(selectedForeground);
                                cell.setBackground(selectedBackground);
                            } else {
                                cell.setForeground(foreground);
                                cell.setBackground(background);
                            }
                        }                    return cell;
                    }
                });        cPane.add(daysTable, BorderLayout.CENTER);
        }    public static String getHeader(int index) {
            switch (index) {
            case 0:
                return WEEK_SUN;
            case 1:
                return WEEK_MON;
            case 2:
                return WEEK_TUE;
            case 3:
                return WEEK_WED;
            case 4:
                return WEEK_THU;
            case 5:
                return WEEK_FRI;
            case 6:
                return WEEK_SAT;
            default:
                return null;
            }
        }    public void updateView() {
            daysModel.fireTableDataChanged();
        }    public static void main(String[] args) {
            JFrame frame = new JFrame("Calendar Application");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            MyCalendar myCalendar = new MyCalendar();
            myCalendar.init();
            frame.getContentPane().add(myCalendar);
            frame.setSize(240, 168);
            frame.show();
        }}
      

  4.   

    上次我在 Linux 下编译的,没有问题,这次我在 Windows 下再编译了一次,就出问题了。所以我把它改了一下,如下:/** 
     * @(#) MyCalendar.java 
     * @author fancy 
     */
     
    import java.awt.*; 
    import java.awt.event.*; 
    import java.util.*; 
    import javax.swing.*; 
    import javax.swing.event.*; 
    import javax.swing.table.*;
     
    public class MyCalendar extends JApplet {
     
        public static final String WEEK_SUN = "SUN"; 
        public static final String WEEK_MON = "MON"; 
        public static final String WEEK_TUE = "TUE"; 
        public static final String WEEK_WED = "WED"; 
        public static final String WEEK_THU = "THU"; 
        public static final String WEEK_FRI = "FRI"; 
        public static final String WEEK_SAT = "SAT";
     
        public static final Color background = Color.white; 
        public static final Color foreground = Color.black; 
        public static final Color headerBackground = Color.blue; 
        public static final Color headerForeground = Color.white; 
        public static final Color selectedBackground = Color.blue; 
        public static final Color selectedForeground = Color.white;
     
        JPanel cPane; 
        JLabel yearsLabel; 
        JSpinner yearsSpinner; 
        JLabel monthsLabel; 
        JComboBox monthsComboBox; 
        JTable daysTable; 
        AbstractTableModel daysModel; 
        Calendar calendar; 
        Calendar today;
     
        public MyCalendar() { 
            cPane = (JPanel) getContentPane(); 
        }
     
        public void init() { 
            cPane.setLayout(new BorderLayout());
     
            today = Calendar.getInstance(); 
            calendar = Calendar.getInstance(); 
            yearsLabel = new JLabel("Year: "); 
            yearsSpinner = new JSpinner(); 
            yearsSpinner.setValue(new Integer(calendar.get(Calendar.YEAR))); 
            yearsSpinner.addChangeListener(new ChangeListener() { 
                    public void stateChanged(ChangeEvent changeEvent) { 
                        updateView(); 
                    } 
                });
     
            JPanel yearMonthPanel = new JPanel(); 
            cPane.add(yearMonthPanel, BorderLayout.NORTH); 
            yearMonthPanel.setLayout(new BorderLayout()); 
            yearMonthPanel.add(new JPanel(), BorderLayout.CENTER); 
            JPanel yearPanel = new JPanel(); 
            yearMonthPanel.add(yearPanel, BorderLayout.WEST); 
            yearPanel.setLayout(new BorderLayout()); 
            yearPanel.add(yearsLabel, BorderLayout.WEST); 
            yearPanel.add(yearsSpinner, BorderLayout.CENTER);
     
            monthsLabel = new JLabel("Month: "); 
            monthsComboBox = new JComboBox(); 
            for (int i = 1; i <= 12; i++) { 
                monthsComboBox.addItem(new Integer(i)); 
            } 
            monthsComboBox.setSelectedIndex(calendar.get(Calendar.MONTH)); 
            monthsComboBox.addActionListener(new ActionListener() { 
                    public void actionPerformed(ActionEvent actionEvent) { 
                        updateView(); 
                    } 
                }); 
            JPanel monthPanel = new JPanel(); 
            yearMonthPanel.add(monthPanel, BorderLayout.EAST); 
            monthPanel.setLayout(new BorderLayout()); 
            monthPanel.add(monthsLabel, BorderLayout.WEST); 
            monthPanel.add(monthsComboBox, BorderLayout.CENTER);
     
            daysModel = new AbstractTableModel() { 
                    public int getRowCount() { 
                        return 7; 
                    }
     
                    public int getColumnCount() { 
                        return 7; 
                    }
     
                    public Object getValueAt(int row, int column) { 
                        if (row == 0) { 
                            return getHeader(column); 
                        } 
                        row--; 
                        Calendar calendar = Calendar.getInstance(); 
                        calendar.set(((Integer) yearsSpinner.getValue()).intValue(), monthsComboBox.getSelectedIndex(), 1); 
                        int dayCount = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); 
                        int moreDayCount = calendar.get(Calendar.DAY_OF_WEEK) - 1; 
                        int index = row * 7 + column; 
                        int dayIndex = index - moreDayCount + 1;
                        if (index < moreDayCount || dayIndex > dayCount) { 
                            return null; 
                        } else { 
                            return new Integer(dayIndex); 
                        } 
                    } 
                };
     
            daysTable = new JTable(daysModel); 
            daysTable.setCellSelectionEnabled(true);
     
            daysTable.setDefaultRenderer(daysTable.getColumnClass(0), new TableCellRenderer() { 
                    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, 
                                                                   boolean hasFocus, int row, int column) { 
                        String text = (value == null) ? "" : value.toString(); 
                        JLabel cell = new JLabel(text); 
                        cell.setOpaque(true); 
                        if (row == 0) { 
                            cell.setForeground(headerForeground); 
                            cell.setBackground(headerBackground); 
                        } else { 
                            if (isSelected) { 
                                cell.setForeground(selectedForeground); 
                                cell.setBackground(selectedBackground); 
                            } else { 
                                cell.setForeground(foreground); 
                                cell.setBackground(background); 
                            } 
                        }
     
                        return cell; 
                    } 
                });
     
            cPane.add(daysTable, BorderLayout.CENTER); 
        }
     
        public static String getHeader(int index) { 
            switch (index) { 
            case 0: 
                return WEEK_SUN; 
            case 1: 
                return WEEK_MON; 
            case 2: 
                return WEEK_TUE; 
            case 3: 
                return WEEK_WED; 
            case 4: 
                return WEEK_THU; 
            case 5: 
                return WEEK_FRI; 
            case 6: 
                return WEEK_SAT; 
            default: 
                return null; 
            } 
        }
     
        public void updateView() { 
            daysModel.fireTableDataChanged(); 
        }
     
        public static void main(String[] args) { 
            JFrame frame = new JFrame("Calendar Application"); 
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
            MyCalendar myCalendar = new MyCalendar(); 
            myCalendar.init(); 
            frame.getContentPane().add(myCalendar); 
            frame.setSize(240, 172); 
            frame.show(); 
        }
     
    }