91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 5KB
    文件類型: .java
    金幣: 1
    下載: 2 次
    發布日期: 2021-06-09
  • 語言: Java
  • 標簽: ssd3??

資源簡介

ssd3 exercise7答案 完全滿分

資源截圖

代碼片段和文件信息

import?java.util.*;
import?java.awt.*;
import?java.awt.event.*;
import?javax.swing.*;
import?javax.swing.event.*;
import?java.io.*;

/**
*?This?class?displays?the?catalog?of?the?gourmet?coffee?system.
*
*?@author?BlueDream?*?@version?1.1.0
*?@see?Product
*?@see?Coffee
*?@see?CoffeeBrewer
*?@see?Catalog
*?@see?CatalogLoader
*?@see?FileCatalogLoader
*?@see?DataFormatException
*?@see?DataField
*/
public?class?CatalogGUI?extends?JPanel?{

/*?Standar?error?stream?*/
static?private?PrintWriter?stdErr?=?new?PrintWriter(System.err?true);

/*?Window?width?in?pixels?*/
static?private?int?WIDTH?=?420;

/*?Window?height?in?pixels?*/
static?private?int?HEIGHT?=?320;

/*?Size?of?the?list?cell?in?pixels?*/
static?private?int?CELL_SIZE?=?50;

/*?Visible?rows?in?list?*/
static?private?int?LIST_ROWS?=?10;

/*?Rows?in?status?text?area?*/
static?private?int?STATUS_ROWS?=?5;

/*?Rows?in?status?text?area?*/
static?private?int?STATUS_COLS?=?40;

private?JList?catalogList;
private?JPanel?productPanel;
private?JTextArea?statusTextArea;

private?Catalog?catalog;

/**
*?Loads?a?product?catalog?and?starts?the?application.
*
*?@param?args?String?arguments.?Not?used.
*?@throws?IOException?if?there?are?errors?in?the?loading
*?????????????????????the?catalog.
*/
public?static?void?main(String[]?args)?throws?IOException?{

???String?filename?=?““;

???if?(args.length?!=?1)?{
????filename?=?“catalog.dat“;
???}?else?{
????filename?=?args[0];
???}
???try?{
????Catalog?catalog?=
?????(new?FileCatalogLoader()).loadCatalog(filename);

????Jframe?frame?=?new?Jframe(“Catalog?Gourmet?Coffee“);

????frame.setContentPane(new?CatalogGUI(catalog));
????frame.setDefaultCloseOperation(Jframe.EXIT_ON_CLOSE);
????frame.setSize(WIDTH?HEIGHT);
????frame.setResizable(true);
????frame.setVisible(true);

???}?catch?(FileNotFoundException?fnfe)?{
????stdErr.println(“The?file?does?not?exist“);

????System.exit(1);

???}?catch?(DataFormatException?dfe)?{
????stdErr.println(“The?file?contains?malformed?data:?“
??????????????????+?dfe.getMessage());

????System.exit(1);
???}
}

/**
*?Instantiates?the?components?and?arranges?them?in?a?window.
*
*?@param?initialCatalog?a?product?catalog.
*/
public?CatalogGUI(Catalog?initialCatalog)?{

???catalog?=?initialCatalog;

????//?create?the?components
???catalogList?=?new?JList(catalog.getCodes());
???catalogList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
???catalogList.setVisibleRowCount(LIST_ROWS);
???catalogList.setFixedCellWidth(CELL_SIZE);
???statusTextArea?=?new?JTextArea(STATUS_ROWS?STATUS_COLS);
???statusTextArea.setEditable(false);

???//?create?product?information?panel
???productPanel?=?new?JPanel();
???produc

評論

共有 條評論