⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainframe.java~3~

📁 实例21显示图像的轮廓.rar
💻 JAVA~3~
字号:
package jconvolvedemo2;import java.awt.*;import java.awt.event.*;import javax.swing.*;public class MainFrame extends JFrame {  private JPanel contentPane;  private BorderLayout borderLayout1 = new BorderLayout();  DrawPane drawPane = new DrawPane();  private JPanel jPanel1 = new JPanel();  private JButton jButton1 = new JButton();  private JButton jButton2 = new JButton();  private GridLayout gridLayout1 = new GridLayout();  //Construct the frame  public MainFrame() {    enableEvents(AWTEvent.WINDOW_EVENT_MASK);    try {      jbInit();    }    catch(Exception e) {      e.printStackTrace();    }  }  //Component initialization  private void jbInit() throws Exception  {    //setIconImage(Toolkit.getDefaultToolkit().createImage(MainFrame.class.getResource("[Your Icon]")));    contentPane = (JPanel) this.getContentPane();    contentPane.setLayout(borderLayout1);    this.setSize(new Dimension(361, 249));    this.setTitle("JConvolveOpDemo2");    jButton1.setFont(new java.awt.Font("Dialog", 0, 14));    jButton1.setText("Image Edge");    jButton1.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        jButton1_actionPerformed(e);      }    });    jButton2.setFont(new java.awt.Font("Dialog", 0, 14));    jButton2.setText("Reset");    jButton2.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        jButton2_actionPerformed(e);      }    });    jPanel1.setLayout(gridLayout1);    contentPane.add(jPanel1, BorderLayout.SOUTH);    jPanel1.add(jButton1, null);    jPanel1.add(jButton2, null);    contentPane.add(drawPane,BorderLayout.CENTER);  }  //Overridden so we can exit when window is closed  protected void processWindowEvent(WindowEvent e) {    super.processWindowEvent(e);    if (e.getID() == WindowEvent.WINDOW_CLOSING) {      System.exit(0);    }  }  void jButton1_actionPerformed(ActionEvent e) {  }  void jButton2_actionPerformed(ActionEvent e) {  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -