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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? sketchframe.java

?? Java Classic Examples是我買的兩本書:《JAVA經典實例》和《java入門經典源代碼》里邊附送光盤里帶的源碼
?? JAVA
字號:
// Frame for the Sketcher application
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;

public class SketchFrame extends JFrame 
                         implements Constants, ActionListener
{
  // Constructor
  public SketchFrame(String title, Sketcher theApp)
  {
    setTitle(title);                              // Set the window title
    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 helpMenu = new JMenu("Help");           // Create Help menu

    fileMenu.setMnemonic('F');                    // Create shortcut
    elementMenu.setMnemonic('E');                 // 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("Close", "Close sketch"), 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 ));
     
    // 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"));

    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 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(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

    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

    // Disable actions
    saveAction.setEnabled(false);
    closeAction.setEnabled(false);
    printAction.setEnabled(false);
  }

  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
  }

  // We will add inner classes defining action objects here...
  class FileAction extends AbstractAction
  {    
    FileAction(String name)
    {
      super(name);
      String iconFileName = "Images/" + name + ".gif";
      if(new File(iconFileName).exists())
        putValue(SMALL_ICON, new ImageIcon(iconFileName));
    }

    FileAction(String name, String tooltip)
    {
      this(name);                                     // Call the other constructor
      if(tooltip != null)                             // If there is tooltip text
        putValue(SHORT_DESCRIPTION, tooltip);         // ...squirrel it away
    }

    public void actionPerformed(ActionEvent e)
    {
      // We will add action code here eventually...
    }
  }

  class TypeAction extends AbstractAction
  {    
    TypeAction(String name, int typeID)
    {
      super(name);
      this.typeID = typeID;
      String iconFileName = "Images/" + name + ".gif";
      if(new File(iconFileName).exists())
        putValue(SMALL_ICON, new ImageIcon(iconFileName));
    }

    TypeAction(String name, int typeID, String tooltip)
    {
      this(name, typeID);
      if(tooltip != null)                               // If there is a tooltip
        putValue(SHORT_DESCRIPTION, tooltip);           // ...squirrel it away
    }
    
    public void actionPerformed(ActionEvent e)
    {
      elementType = typeID;
      statusBar.setTypePane(typeID);
    }

    private int typeID;
  }

  // Handles color menu items
  class ColorAction  extends AbstractAction
  {
    public ColorAction(String name, Color color)
    {
      super(name);
      this.color = color;
      String iconFileName = "Images/" + name + ".gif";
      if(new File(iconFileName).exists())
        putValue(SMALL_ICON, new ImageIcon(iconFileName));
    }

    public ColorAction(String name, Color color, String tooltip)
    {
      this(name, color);
      if(tooltip != null)                               // If there is a tooltip
        putValue(SHORT_DESCRIPTION, tooltip);           // ...squirrel it away
    }

    public void actionPerformed(ActionEvent e)
    {
      elementColor = color;
      statusBar.setColorPane(color);
    }

    private Color color;
  }

  // Handle About menu action events
  public void actionPerformed(ActionEvent e)
  {
    if(e.getSource() == aboutItem)
    {
      // Create about dialog with the app window as parent
      AboutDialog aboutDlg = new AboutDialog(this, "About Sketcher",
                                            "Sketcher Copyright Ivor Horton 1999");
    }
  }

  // Class defining a general purpose message box
  class AboutDialog extends JDialog implements ActionListener
  {
    public AboutDialog(Frame parent, String title, String message)
    {
      super(parent, title, true);

      // If there was a parent, set dialog position inside
      if(parent != null)
      {
        Dimension parentSize = parent.getSize();     // Parent size
        Point p = parent.getLocation();              // Parent position
        setLocation(p.x+parentSize.width/4,p.y+parentSize.height/4);
      }

      // Create the message pane
      JPanel messagePane = new JPanel();
      messagePane.add(new JLabel(message));        
      getContentPane().add(messagePane);

      // Create the button pane
      JPanel buttonPane = new JPanel();
      JButton button = new JButton("OK");        // Create OK button
      buttonPane.add(button);                    // add to content pane
      button.addActionListener(this);
      getContentPane().add(buttonPane, BorderLayout.SOUTH);
      setDefaultCloseOperation(DISPOSE_ON_CLOSE);
      pack();                                    // Size window for components
      setVisible(true);
    }

    // OK button action
    public void actionPerformed(ActionEvent e)
    {
      setVisible(false);                         // Set dialog invisible
      dispose();                                 // Release the dialog resources
    }
  }

  public Color getElementColor()
  { 
    return elementColor; 
  }

  public int getElementType()
  { 
    return elementType; 
  }

  // File actions
  private FileAction newAction, openAction, closeAction,
                     saveAction, saveAsAction, printAction;
  // Element type actions
  private TypeAction lineAction, rectangleAction, circleAction,
                     curveAction;
  // Element color actions
  private ColorAction redAction, yellowAction,
                      greenAction, blueAction;

  private JMenuBar menuBar = new JMenuBar();               // Window menu bar
  private Color elementColor = DEFAULT_ELEMENT_COLOR;      // Current element color
  private int elementType = DEFAULT_ELEMENT_TYPE;          // Current element type
  private JToolBar toolBar = new JToolBar();               // Window toolbar
  private JMenuItem aboutItem;
  StatusBar statusBar = new StatusBar();                   // Window status bar
  Sketcher theApp;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美午夜精品一区二区蜜桃| 国产精品青草久久| 国产99久久久国产精品| 亚洲精品成a人| 欧美—级在线免费片| 欧美日韩视频在线观看一区二区三区| 高清免费成人av| 午夜伦理一区二区| 亚洲色图一区二区| 久久久久国产精品麻豆ai换脸| 欧美三级蜜桃2在线观看| 色综合天天综合网国产成人综合天 | www.66久久| 国产中文字幕精品| 日本中文在线一区| 日韩电影在线观看网站| 亚洲国产精品久久久男人的天堂 | 手机精品视频在线观看| 亚洲女同女同女同女同女同69| 欧美va亚洲va国产综合| 欧美一区二区三区小说| 4438x成人网最大色成网站| 欧美丝袜丝交足nylons| 欧美最猛性xxxxx直播| 不卡一区二区在线| 97久久精品人人澡人人爽| 99精品国产视频| 色系网站成人免费| 亚洲精品老司机| 亚洲美女一区二区三区| 亚洲精品videosex极品| 性感美女极品91精品| 免费在线观看成人| 国产成人欧美日韩在线电影| 波多野结衣欧美| 91色九色蝌蚪| 国产乱理伦片在线观看夜一区| 久久se这里有精品| www.日韩在线| 欧美视频三区在线播放| 91精品欧美综合在线观看最新| 日韩视频免费观看高清在线视频| 欧美三级电影一区| 欧美大黄免费观看| 日韩一区二区在线观看视频| 久久精品一区二区三区av| 99久久99久久综合| 91精品午夜视频| 国产三级久久久| 亚洲曰韩产成在线| 毛片av一区二区| 99久久综合精品| 欧美高清激情brazzers| 国产日韩欧美电影| 一区二区三区四区蜜桃| 午夜成人免费电影| 成人精品一区二区三区中文字幕| 欧美日韩一区二区三区不卡| 精品国产乱码久久久久久久久 | 在线成人免费视频| 久久综合色之久久综合| 一区二区三区日韩在线观看| 青青草伊人久久| 成人av在线一区二区三区| 欧美日韩精品电影| 中文字幕永久在线不卡| 美女尤物国产一区| 色中色一区二区| 久久亚洲精精品中文字幕早川悠里| 日韩毛片高清在线播放| 精品一区二区久久久| 欧美午夜免费电影| 国产精品传媒入口麻豆| 国产成人综合亚洲91猫咪| 7777精品伊人久久久大香线蕉的| 一区在线播放视频| 国产精品18久久久久久久久久久久| 在线免费观看日韩欧美| 国产精品成人网| 国产永久精品大片wwwapp| 91麻豆精品国产91久久久久久 | 日韩国产欧美一区二区三区| 91农村精品一区二区在线| 亚洲精品在线三区| 久久成人免费网| 7878成人国产在线观看| 国产丝袜美腿一区二区三区| 久久精品72免费观看| 日韩精品资源二区在线| 六月丁香综合在线视频| 91精品国产欧美一区二区18 | 2024国产精品| 久久国产精品免费| 日韩精品一区在线观看| 激情欧美一区二区| 欧美电视剧免费观看| 日本不卡1234视频| 7878成人国产在线观看| 午夜精品久久久久久不卡8050| 日本国产一区二区| 亚洲综合区在线| 欧美日韩情趣电影| 青青草原综合久久大伊人精品优势| 欧美人与禽zozo性伦| 日韩在线播放一区二区| 欧美视频在线不卡| 日韩福利视频网| 精品国产一二三| 国产精品亚洲成人| 亚洲午夜在线电影| 久久精品日韩一区二区三区| 91黄色激情网站| 国产一区二区三区精品欧美日韩一区二区三区| 久久久精品综合| 欧美久久婷婷综合色| 成人小视频免费在线观看| 天天免费综合色| 国产精品久久午夜夜伦鲁鲁| 在线成人午夜影院| www.视频一区| 国产一区二区三区香蕉| 污片在线观看一区二区| 中文字幕免费不卡在线| 欧美tickling挠脚心丨vk| 色综合色综合色综合色综合色综合| 欧美aaa在线| 亚洲综合另类小说| 国产精品女同一区二区三区| 日韩欧美一级在线播放| 亚洲情趣在线观看| 亚洲啪啪综合av一区二区三区| 国产精品久99| 日韩一级高清毛片| 日本二三区不卡| 国产mv日韩mv欧美| 精品亚洲国内自在自线福利| 一区二区三区四区乱视频| 欧美国产日韩精品免费观看| 精品国产一二三区| 欧美日韩五月天| 豆国产96在线|亚洲| 久久电影网电视剧免费观看| 无码av中文一区二区三区桃花岛| 亚洲免费观看视频| 国产精品国产自产拍在线| 国产欧美日韩在线观看| 精品国产免费一区二区三区香蕉| 91精品国产色综合久久不卡蜜臀 | 91视频.com| 国产成人啪午夜精品网站男同| 久久se精品一区二区| 青娱乐精品视频在线| 亚洲不卡一区二区三区| 亚洲国产裸拍裸体视频在线观看乱了| 综合婷婷亚洲小说| 亚洲人成伊人成综合网小说| 国产精品国产精品国产专区不蜜 | 欧美日韩在线观看一区二区| 色综合天天综合狠狠| 91在线精品一区二区三区| 99久久777色| 91精彩视频在线观看| 欧美日韩在线三区| 欧美一区二区三区色| 日韩欧美国产电影| 欧美精品一区二区高清在线观看| 精品国产成人系列| 国产欧美在线观看一区| 国产精品视频一二| 亚洲精品中文字幕乱码三区| 亚洲国产日韩综合久久精品| 午夜精彩视频在线观看不卡| 日本伊人精品一区二区三区观看方式| 久久成人麻豆午夜电影| 国产91在线看| 色狠狠av一区二区三区| 欧美丰满高潮xxxx喷水动漫| 精品国产乱子伦一区| 亚洲欧洲av在线| 亚洲高清在线视频| 黄色精品一二区| 色综合天天性综合| 6080午夜不卡| 国产精品免费视频观看| 天堂影院一区二区| 国产精品1区2区| 欧美日韩一级黄| 中文字幕不卡的av| 肉丝袜脚交视频一区二区| 国产精品中文字幕日韩精品| 色偷偷88欧美精品久久久| 日韩欧美国产综合在线一区二区三区| 久久久99精品免费观看不卡| 亚洲第一电影网| 岛国av在线一区| 欧美一区二区三区视频在线观看| 国产精品久久久久久久久免费桃花 | 成人av综合一区| 欧美一区二区三区小说| 亚洲免费观看高清完整|