国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 學(xué)院 > 開(kāi)發(fā)設(shè)計(jì) > 正文

Java 2中的MVC設(shè)計(jì)模式

2019-11-17 05:58:50
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

一個(gè)好的用戶界面(GUI)的設(shè)計(jì)通常可以在現(xiàn)實(shí)世界找到相應(yīng)的表現(xiàn)。    

    例如,假如在您的面前擺放著一個(gè)類似于電腦鍵盤按鍵的一個(gè)簡(jiǎn)單的按鈕,然而就是這么簡(jiǎn)單的一個(gè)按鈕,我們就可以看出一個(gè)GUI設(shè)計(jì)的規(guī)則,它由兩個(gè)主要的部分構(gòu)成,一部分使得它具有了按鈕應(yīng)該具有的動(dòng)作特性,例如可以被按下。另外一部分則負(fù)責(zé)它的表現(xiàn),例如這個(gè)按鈕是代表了A還是B。

//[C] 2002 Sun Microsystems, Inc.---
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.ArrayList;
import java.util.Iterator;

import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
public class RunMVCPattern {
    public static void main(String [] arguments){
        System.out.        System.out.println();
        System.out.println("In this example, a Contact is divided into");
        System.out.println(" Model, View and Controller components.");
        System.out.println();
        System.out.println("To illustrate the flexibility of MVC, the same");
        System.out.println(" Model will be used to provide information");
        System.out.println(" to two View components.");
        System.out.println();
        System.out.println("One view, ContactEditView, will provide a Contact");
        System.out.println(" editor window and will be paired with a controller");
        System.out.println(" called ContactEditController.");
        System.out.println();
        System.out.println("The other view, ContactDisplayView, will provide a");
        System.out.println(" display window which will reflect the changes made");
        System.out.println(" in the editor window. This view does not support");
        System.out.println(" user interaction, and so does not provide a controller.");
        System.out.println();
       
        System.out.println("Creating ContactModel");
        ContactModel model = new ContactModel();


發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 黄骅市| 安乡县| 光泽县| 台湾省| 西青区| 大石桥市| 阿巴嘎旗| 乌兰浩特市| 潮安县| 铅山县| 新民市| 微山县| 德江县| 界首市| 社会| 大同县| 平定县| 弋阳县| 剑河县| 鲁甸县| 车险| 乌兰察布市| 宜川县| 扶余县| 汕尾市| 华亭县| 土默特右旗| 舟曲县| 新宾| 宿迁市| 阿拉善右旗| 黑龙江省| 庆安县| 桐城市| 类乌齐县| 赤峰市| 林西县| 苍溪县| 萨迦县| 当涂县| 茌平县|