亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? sketchframe.java

?? Java Classic Examples是我買(mǎi)的兩本書(shū):《JAVA經(jīng)典實(shí)例》和《java入門(mén)經(jīng)典源代碼》里邊附送光盤(pán)里帶的源碼
?? JAVA
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
// Frame for the Sketcher application
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
import java.awt.print.*;

public class SketchFrame extends JFrame
                         implements Constants, ActionListener, Observer
{
  // Constructor
  public SketchFrame(String title, Sketcher theApp)
  {
    this.theApp = theApp;
    setJMenuBar(menuBar);                         // Add the menu bar to the window

    JMenu fileMenu = new JMenu("File");           // Create File menu
    JMenu elementMenu = new JMenu("Elements");    // Create Elements menu
    JMenu optionsMenu = new JMenu("Options");     // Create options menu
    JMenu helpMenu = new JMenu("Help");           // Create Help menu

    fileMenu.setMnemonic('F');                    // Create shortcut
    elementMenu.setMnemonic('E');                 // Create shortcut
    optionsMenu.setMnemonic('O');                 // Create shortcut
    helpMenu.setMnemonic('H');                    // Create shortcut 

    // Construct the file pull down menu
    addMenuItem(fileMenu, 
                newAction = new FileAction("New", "Create new sketch"),
                KeyStroke.getKeyStroke('N',Event.CTRL_MASK ));
    addMenuItem(fileMenu, 
                openAction = new FileAction("Open", "Open existing sketch"), 
                KeyStroke.getKeyStroke('O',Event.CTRL_MASK ));
    addMenuItem(fileMenu, 
                closeAction = new FileAction("Exit", "Exit Sketcher"), null);
    fileMenu.addSeparator();                                       // Add separator
    addMenuItem(fileMenu, 
                saveAction = new FileAction("Save", "Save sketch"),
                KeyStroke.getKeyStroke('S',Event.CTRL_MASK ));
    addMenuItem(fileMenu, 
                saveAsAction = new FileAction("Save As...","Save as new file"),
                null);
    fileMenu.addSeparator();                                       // Add separator
    addMenuItem(fileMenu, 
                printAction = new FileAction("Print", "Print sketch"),
                KeyStroke.getKeyStroke('P',Event.CTRL_MASK ));
    fileMenu.addSeparator();                                     // Add separator
    addMenuItem(fileMenu, closeAction = new FileAction("Exit", "Exit Sketcher"),
                                    KeyStroke.getKeyStroke('X',Event.CTRL_MASK ));
     
    // Construct the Element pull down menu
    addMenuItem(elementMenu, 
                lineAction = new TypeAction("Line", LINE, "Draw lines"));
    addMenuItem(elementMenu, 
                rectangleAction = new TypeAction("Rectangle", RECTANGLE, 
                                                 "Draw rectangles"));
    addMenuItem(elementMenu, 
                circleAction = new TypeAction("Circle", CIRCLE, "Draw circles"));
    addMenuItem(elementMenu, 
                curveAction = new TypeAction("Curve", CURVE, "Draw curves"));
    addMenuItem(elementMenu, textAction = new TypeAction("Text", TEXT,
                                                         "Draw text"), null);

    elementMenu.addSeparator();

    JMenu colorMenu = new JMenu("Color");         // Color sub-menu
    elementMenu.add(colorMenu);                   // Add the sub-menu
    addMenuItem(colorMenu, 
                redAction = new ColorAction("Red", Color.red, "Draw in red"));
    addMenuItem(colorMenu, 
                yellowAction = new ColorAction("Yellow", Color.yellow,
                                                               "Draw in yellow"));
    addMenuItem(colorMenu, 
                greenAction = new ColorAction("Green", Color.green, 
                                                                "Draw in green"));
    addMenuItem(colorMenu, 
                blueAction = new ColorAction("Blue", Color.blue, "Draw in blue"));

    // Add the font choice item to the options menu
    fontItem = new JMenuItem("Choose font...");
    fontItem.addActionListener(this);
    optionsMenu.add(fontItem);

    // Add the About item to the Help menu
    aboutItem = new JMenuItem("About");           // Create the item
    aboutItem.addActionListener(this);            // Listener is the frame
    helpMenu.add(aboutItem);                      // Add item to menu

    menuBar.add(fileMenu);                        // Add the file menu
    menuBar.add(elementMenu);                     // Add the element menu
    menuBar.add(optionsMenu);                     // Add the options menu
    menuBar.add(helpMenu);                        // Add the Help menu

    // Add file buttons
    toolBar.addSeparator();                                 // Space at the start
    addToolBarButton(newAction);
    addToolBarButton(openAction);
    addToolBarButton(saveAction);
    addToolBarButton(printAction);
   
    // Add element type buttons
    toolBar.addSeparator();
    addToolBarButton(lineAction);
    addToolBarButton(rectangleAction);
    addToolBarButton(circleAction);
    addToolBarButton(curveAction);

    // Add element color buttons
    toolBar.addSeparator();
    addToolBarButton(redAction);
    addToolBarButton(yellowAction);
    addToolBarButton(greenAction);
    addToolBarButton(blueAction);
    toolBar.addSeparator();                            // Space at the end

    addToolBarButton(textAction);

    // Create pop-up menu
    popup.add(lineAction);
    popup.add(rectangleAction);
    popup.add(circleAction);
    popup.add(curveAction);
    popup.add(textAction);

    popup.addSeparator();
    popup.add(redAction);
    popup.add(yellowAction);
    popup.add(greenAction);
    popup.add(blueAction);

    toolBar.setBorder(BorderFactory.createCompoundBorder(       // Toolbar border
                      BorderFactory.createLineBorder(Color.darkGray),
                      BorderFactory.createEmptyBorder(2,2,4,2)));   

    toolBar.setFloatable(false);                       // Inhibit toolbar floating
    getContentPane().add(toolBar, BorderLayout.NORTH); // Add the toolbar

    getContentPane().add(statusBar, BorderLayout.SOUTH);         // Add the statusbar
    fontDlg = new FontDialog(this);

    customColorItem = popup.add("Custom Color...");    // Add the item
    customColorItem.addActionListener(this);           // and add its listener

    frameTitle = title + ": ";        
    setTitle(frameTitle + filename);

    if(!DEFAULT_DIRECTORY.exists())
      if(!DEFAULT_DIRECTORY.mkdirs())
        JOptionPane.showMessageDialog(this,
                                      "Error creating default directory",
                                      "Directory Creation Error",
                                      JOptionPane.ERROR_MESSAGE);
    files = new JFileChooser(DEFAULT_DIRECTORY);
  }

  // Method called by SketchModel object when it changes
  public void update(Observable o, Object obj)
  {
    sketchChanged = true;
  }

  private JButton addToolBarButton(Action action)
  {
    JButton button = toolBar.add(action);                     // Add toolbar button
    button.setToolTipText((String)action.getValue(action.SHORT_DESCRIPTION));
    button.setBorder(BorderFactory.createRaisedBevelBorder()); // Add button border
    button.setText(null);                                     // No button text
    return button;
  }

  private JMenuItem addMenuItem(JMenu menu, Action action)
  {
    JMenuItem item = menu.add(action);                  // Add the menu item
    item.setIcon(null);                                 // Remove the icon
    return item;                                        // Return the menu item
  }

  private JMenuItem addMenuItem(JMenu menu, Action action, KeyStroke keystroke)
  {
    JMenuItem item = addMenuItem(menu, action);         // Add the menu item
    item.setAccelerator(keystroke);                     // Set the accelerator
    return item;                                        // Return the menu item
  }

  // Display a custom file save dialog
  private File showDialog (String dialogTitle,
                          String approveButtonText,
                          String approveButtonTooltip,
                          char approveButtonMnemonic,
                          File file)                       // Current file - if any
  {
    files.setDialogTitle(dialogTitle);
    files.setApproveButtonText(approveButtonText);
    files.setApproveButtonToolTipText(approveButtonTooltip);
    files.setApproveButtonMnemonic(approveButtonMnemonic);
    files.setFileSelectionMode(files.FILES_ONLY);
    files.rescanCurrentDirectory();
    files.setSelectedFile(file);

    ExtensionFilter sketchFilter = new ExtensionFilter(".ske", 
                                        "Sketch files (*.ske)");
    files.addChoosableFileFilter(sketchFilter);             // Add the filter
    files.setFileFilter(sketchFilter);                      // and select it

    int result = files.showDialog(SketchFrame.this, null);  // Show the dialog
    return (result == files.APPROVE_OPTION) ? files.getSelectedFile() : null;
  }

  // Save the sketch if it is necessary
  private void saveOperation()
  {
    if(!sketchChanged)
      return;
    if(modelFile != null)
      saveSketch(modelFile);
    else
    {
      File file = showDialog("Save Sketch",
                             "Save",
                             "Save the sketch",
                             's',
                             new File(files.getCurrentDirectory(), filename));
      if(file == null)
        return;
      else
        if(file.exists())                      // Check for existence
          if(JOptionPane.NO_OPTION ==          // Overwrite warning
              JOptionPane.showConfirmDialog(SketchFrame.this,
                                      file.getName() + " exists. Overwrite?",
                                      "Confirm Save As",
                                      JOptionPane.YES_NO_OPTION,
                                      JOptionPane.WARNING_MESSAGE))
            return;                            // No selected file
      saveSketch(file);
    }
  }

  // Write a sketch to outFile
  private void saveSketch(File outFile)
  {
    try
    {
      ObjectOutputStream out =  new ObjectOutputStream(
                                new BufferedOutputStream(
                                new FileOutputStream(outFile)));
      out.writeObject(theApp.getModel());        // Write the sketch to the stream
      out.flush();                               // Flush the stream
      out.close();                               // And close it
    }
    catch(IOException e)
    {
      JOptionPane.showMessageDialog(SketchFrame.this,
                                          "Error writing a sketch file.",
                                              "File Output Error",
                                              JOptionPane.ERROR_MESSAGE);
      return;                                      // Serious error - return
    }
    if(outFile != modelFile)                      // If we are saving to a new file
    {                                              // we must update the window
      modelFile = outFile;                         // Save file reference
      filename = modelFile.getName();              // Update the file name
      setTitle(frameTitle + modelFile.getPath());  // Change the window title
    }
    sketchChanged = false;                         // Set as unchanged
  }

  public Color getElementColor()
  { 
    return elementColor; 
  }

  public int getElementType()

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲三级视频在线观看| 午夜影视日本亚洲欧洲精品| 国产欧美综合在线观看第十页| 欧美日产国产精品| 欧美日韩国产综合一区二区三区 | 国产麻豆日韩欧美久久| 久久精工是国产品牌吗| 黄一区二区三区| 国产精品99久久久久久久女警 | 成人午夜在线视频| 粉嫩绯色av一区二区在线观看 | 久久综合五月天婷婷伊人| 久久影院视频免费| 国产亚洲女人久久久久毛片| 中日韩免费视频中文字幕| 中文字幕欧美激情| 亚洲欧洲另类国产综合| 亚洲日本在线a| 香蕉久久一区二区不卡无毒影院| 全部av―极品视觉盛宴亚洲| 久久99精品国产.久久久久久| 国产一区二区三区日韩| 成人永久aaa| 色婷婷av一区二区| 在线成人免费视频| 久久综合狠狠综合久久激情| 国产精品久久福利| 亚洲第一精品在线| 国产综合色产在线精品| 97se亚洲国产综合自在线不卡| 欧美体内she精视频| 日韩欧美亚洲国产另类| 欧美精彩视频一区二区三区| 亚洲欧美日韩国产另类专区| 日精品一区二区三区| 国产高清精品网站| 一本大道久久a久久精品综合| 7799精品视频| 亚洲国产精品国自产拍av| 亚洲高清在线视频| 国内不卡的二区三区中文字幕| 成人久久18免费网站麻豆 | 欧美三级欧美一级| 精品乱人伦小说| 亚洲视频 欧洲视频| 毛片一区二区三区| 99久久免费视频.com| 51久久夜色精品国产麻豆| 久久久午夜精品| 亚洲成人av免费| 国产激情一区二区三区| 欧美日韩国产中文| 国产网站一区二区| 首页国产欧美久久| 不卡欧美aaaaa| 日韩欧美二区三区| 亚洲乱码日产精品bd | 欧美sm极限捆绑bd| 亚洲欧美色图小说| 国产精品一线二线三线精华| 在线精品亚洲一区二区不卡| 国产日产欧美一区| 青娱乐精品视频| 色狠狠色狠狠综合| 国产亚洲精品bt天堂精选| 亚洲成av人影院在线观看网| 成人精品国产一区二区4080| 51精品国自产在线| 亚洲一区日韩精品中文字幕| 国产成人99久久亚洲综合精品| 色综合久久久久网| 久久精品在线观看| 奇米777欧美一区二区| 欧美伊人久久久久久午夜久久久久| 久久久99精品免费观看不卡| 日产国产欧美视频一区精品| 91九色最新地址| 亚洲欧美在线观看| 高清不卡一二三区| 26uuu国产电影一区二区| 首页欧美精品中文字幕| 欧美日韩中文国产| 亚洲精品一二三| 99久久伊人精品| 欧美成人精品福利| 爽好久久久欧美精品| 欧美中文一区二区三区| 亚洲免费视频中文字幕| 99麻豆久久久国产精品免费 | 热久久免费视频| 欧美巨大另类极品videosbest | 91老师国产黑色丝袜在线| 中文字幕精品一区| 豆国产96在线|亚洲| 久久女同性恋中文字幕| 激情综合五月天| 日韩免费高清视频| 狠狠久久亚洲欧美| 久久精品人人做| 从欧美一区二区三区| 欧美国产1区2区| av在线不卡观看免费观看| 17c精品麻豆一区二区免费| 成人av资源在线| 亚洲少妇最新在线视频| 97久久人人超碰| 亚洲精品菠萝久久久久久久| 在线视频你懂得一区| 亚洲1区2区3区视频| 欧美日本国产视频| 日本 国产 欧美色综合| 精品黑人一区二区三区久久| 久久激情综合网| 欧美韩国一区二区| 97se亚洲国产综合在线| 夜夜精品浪潮av一区二区三区| 在线观看国产日韩| 日韩av电影免费观看高清完整版| 日韩一级大片在线| 国产一区二区三区四区五区美女| 中文字幕av一区二区三区高| 99热精品国产| 天堂蜜桃91精品| 久久蜜桃一区二区| www.日韩在线| 亚洲亚洲精品在线观看| 欧美大度的电影原声| 国产91富婆露脸刺激对白| 亚洲日本电影在线| 欧美日韩国产精品自在自线| 毛片av一区二区| 日韩一区在线看| 欧美巨大另类极品videosbest| 久久精品国产澳门| 1000精品久久久久久久久| 欧美久久久久久久久久| 国产精品123区| 亚洲成人在线观看视频| 精品精品国产高清a毛片牛牛 | 欧美视频在线观看一区| 美女高潮久久久| 国产精品久久一级| 欧美日韩视频在线第一区 | 欧美精品日韩综合在线| 久久91精品国产91久久小草| 国产精品家庭影院| 91精品黄色片免费大全| 国产成人精品在线看| 亚洲成人免费av| 久久精品一区二区三区不卡牛牛| 色综合亚洲欧洲| 精品一区二区三区免费| 亚洲精品国产精华液| 精品播放一区二区| 欧美性猛交一区二区三区精品| 精品一区二区三区视频| 一区二区三区四区在线播放| 精品乱人伦小说| 欧美欧美欧美欧美首页| a美女胸又www黄视频久久| 奇米精品一区二区三区四区| 亚洲你懂的在线视频| 国产亚洲欧美日韩俺去了| 欧美日韩激情一区二区三区| 大桥未久av一区二区三区中文| 亚洲国产欧美在线| 日韩一区欧美一区| 久久久久久久av麻豆果冻| 欧美美女直播网站| 色综合天天天天做夜夜夜夜做| 精品亚洲欧美一区| 天天色综合天天| 一区二区三区国产精华| 中文字幕第一区综合| 久久综合丝袜日本网| 欧美一区二区视频在线观看2020| 色屁屁一区二区| 成人一区二区三区| 狠狠色丁香婷婷综合久久片| 日本aⅴ亚洲精品中文乱码| 亚洲综合男人的天堂| 亚洲视频在线一区| 中文字幕不卡在线| 欧美国产日韩亚洲一区| 欧美va亚洲va香蕉在线| 欧美一区二区三区白人| 欧美日韩亚州综合| 欧美综合色免费| 日本韩国一区二区| 97超碰欧美中文字幕| jiyouzz国产精品久久| 丁香婷婷综合网| 国产福利视频一区二区三区| 奇米色一区二区三区四区| 亚洲福利一二三区| 亚洲一二三区视频在线观看| 亚洲伊人色欲综合网| 亚洲国产日日夜夜| 亚洲成人手机在线| 天天综合网天天综合色|