| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 611 人关注过本帖
标题:JAVA源码开放
只看楼主 加入收藏
canyue
Rank: 1
等 级:新手上路
威 望:1
帖 子:159
专家分:0
注 册:2007-10-4
收藏
 问题点数:0 回复次数:3 
JAVA源码开放

以下代码初学者可以看看
package myfrist;

import java.awt.BorderLayout;
import java.awt.Dimension;

import javax.swing.*;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JButton;
import java.awt.CardLayout;
import javax.swing.JTextField;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JMenuBar;
import java.awt.Font;
import javax.swing.JMenu;
import javax.swing.JToolBar;
import javax.swing.BorderFactory;
import java.awt.Color;
import javax.swing.border.TitledBorder;
import javax.swing.JComboBox;
import javax.swing.JMenuItem;
import javax.swing.JTabbedPane;
import javax.swing.JEditorPane;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.FileDialog;
import java.io.IOException;
import java.io.LineNumberReader;
import java.io.FileReader;

/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class Frame1 extends JFrame {
JPanel contentPane;
BorderLayout borderLayout1 = new BorderLayout();


JPanel jPanel1 = new JPanel();
JPanel jPanel2 = new JPanel();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
BorderLayout borderLayout2 = new BorderLayout();


CardLayout cardLayout1 = new CardLayout();
JPanel jPanel3 = new JPanel();
JPanel jPanel4 = new JPanel();
JTextField jTextField1 = new JTextField();

JPanel jPanel5 = new JPanel();
BorderLayout borderLayout3 = new BorderLayout();
JPanel jPanel6 = new JPanel();
JScrollPane jScrollPane1 = new JScrollPane();
BorderLayout borderLayout4 = new BorderLayout();
JTextArea jTextArea1 = new JTextArea();

JMenuBar jMenuBar1 = new JMenuBar();
JMenu jMenu1 = new JMenu();
JMenu jMenu2 = new JMenu();
JToolBar jToolBar1 = new JToolBar();
BorderLayout borderLayout5 = new BorderLayout();
JButton jButton3 = new JButton();
TitledBorder titledBorder1 = new TitledBorder("");
JButton jButton4 = new JButton();
JButton jButton5 = new JButton();
JButton jButton6 = new JButton();
JMenu jMenu3 = new JMenu();
JMenu jMenu4 = new JMenu();
JMenuItem jMenuItem1 = new JMenuItem();
JMenuItem jMenuItem2 = new JMenuItem();
JMenuItem jMenuItem4 = new JMenuItem();
JMenuItem jMenuItem5 = new JMenuItem();
JMenuItem jMenuItem6 = new JMenuItem();
JMenuItem jMenuItem7 = new JMenuItem();
JMenuItem jMenuItem8 = new JMenuItem();
JMenuItem jMenuItem9 = new JMenuItem();
JMenuItem jMenuItem10 = new JMenuItem();

BorderLayout borderLayout6 = new BorderLayout();
JToolBar jToolBar2 = new JToolBar();
JTabbedPane jTabbedPane1 = new JTabbedPane();
JButton jButton7 = new JButton();
JButton jButton8 = new JButton();
JEditorPane jEditorPane1 = new JEditorPane();
JTextArea jTextArea2 = new JTextArea();


public Frame1() {
try {
setDefaultCloseOperation(EXIT_ON_CLOSE);
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}

/**
* Component initialization.
*
* @throws java.lang.Exception
*/
private void jbInit() throws Exception {
contentPane = (JPanel) getContentPane();
contentPane.setLayout(borderLayout1);
this.setJMenuBar(jMenuBar1);
setSize(new Dimension(400, 300));
setTitle("Frame Title");
jButton1.setText("jButton1");
jButton1.addActionListener(new Frame1_jButton1_actionAdapter(this));
jButton2.setText("jButton2");
jButton2.addActionListener(new Frame1_jButton2_actionAdapter(this));
jPanel2.setLayout(borderLayout2);
jPanel1.setLayout(cardLayout1);
jTextField1.setEditable(false);
jTextField1.setText("jTextField1");
jPanel3.setLayout(borderLayout3);
jPanel6.setLayout(borderLayout4);
jTextArea1.setBorder(BorderFactory.createLoweredBevelBorder());
jTextArea1.setCaretColor(Color.white);
jTextArea1.setText("jTextArea1");
jMenuBar1.setFont(new java.awt.Font("仿宋_GB2312", Font.BOLD, 14));
jMenu2.setText("Edit");
jMenu1.setText("File");
jPanel5.setLayout(borderLayout5);
jButton3.setText("jButton3");
jButton3.addActionListener(new Frame1_jButton3_actionAdapter(this));
jToolBar1.setBorder(null);
jButton4.setText("jButton4");
jButton5.setText("jButton5");
jButton6.setText("jButton6");
jMenu3.setText("Format");
jMenu4.setText("Help");
jMenuItem1.setText("open...(O)");
jMenuItem1.addActionListener(new Frame1_jMenuItem1_actionAdapter(this));
jMenuItem2.setActionCommand("sive...");
jMenuItem2.setText("sive...");
jMenuItem2.addActionListener(new Frame1_jMenuItem2_actionAdapter(this));
jMenuItem4.setMnemonic('0');
jMenuItem4.setText("getURL...");
jMenuItem5.setText("find...(F)");
jMenuItem5.addActionListener(new Frame1_jMenuItem5_actionAdapter(this));
jMenuItem6.setText("change...");
jMenuItem7.setText("font...");
jMenuItem8.setText("color...");
jMenuItem9.setText("About Canyue...");
jMenuItem10.setText("How to use ?");
jPanel4.setLayout(borderLayout6);
jButton7.setIcon(new ImageIcon("Image/arrow.gif"));
//jButton7.setText("aa");
jButton8.setText("jButton8");
jEditorPane1.setText("jEditorPane1");
jTextArea2.setText("jTextArea2");
contentPane.add(jPanel1, java.awt.BorderLayout.CENTER);
jPanel1.add(jPanel3, "jPanel3");
jPanel1.add(jPanel4, "jPanel4");
jPanel4.add(jToolBar2, java.awt.BorderLayout.NORTH);
jToolBar2.add(jButton7);
jPanel4.add(jTabbedPane1, java.awt.BorderLayout.CENTER);
jTabbedPane1.add(jEditorPane1, "jEditorPane1");
jTabbedPane1.add(jTextArea2, "jTextArea2");
contentPane.add(jPanel2, java.awt.BorderLayout.SOUTH);
jPanel2.add(jTextField1, java.awt.BorderLayout.CENTER);
jPanel3.add(jPanel5, java.awt.BorderLayout.NORTH);
jPanel3.add(jPanel6, java.awt.BorderLayout.CENTER);
jPanel6.add(jScrollPane1, java.awt.BorderLayout.CENTER);
jMenuBar1.add(jMenu1);
jMenuBar1.add(jMenu2);
jMenuBar1.add(jMenu3);
jMenuBar1.add(jMenu4);
jPanel5.add(jToolBar1, java.awt.BorderLayout.CENTER);
jToolBar1.add(jButton3);
jToolBar1.add(jButton4);
jToolBar1.add(jButton5);
jToolBar1.add(jButton6);
jScrollPane1.getViewport().add(jTextArea1);
jMenu1.add(jMenuItem1);
jMenu1.add(jMenuItem2);
jMenu1.add(jMenuItem4);
jMenu2.add(jMenuItem5);
jMenu2.add(jMenuItem6);
jMenu3.add(jMenuItem7);
jMenu3.add(jMenuItem8);
jMenu4.add(jMenuItem9);
jMenu4.add(jMenuItem10);
jToolBar2.add(jButton8);
jPanel2.add(jButton1, java.awt.BorderLayout.WEST);
jPanel2.add(jButton2, java.awt.BorderLayout.EAST);
}

public void jButton2_actionPerformed(ActionEvent e) {
CardLayout cc = (CardLayout)(jPanel1.getLayout());
cc.show(jPanel1,"jPanel4");
}

public void jButton1_actionPerformed(ActionEvent e) {
CardLayout cc = (CardLayout)(jPanel1.getLayout());
cc.show(jPanel1,"jPanel3");
}

public void jMenuItem1_actionPerformed(ActionEvent e) {
Actions ac = new Actions();
String s = ac.open();
jTextArea1.append(s);
}

public void jButton3_actionPerformed(ActionEvent e) {
Actions ac = new Actions();
String s = ac.open();
jTextArea1.append(s);
}

public void jMenuItem2_actionPerformed(ActionEvent e) {
Actions ac = new Actions();
String s = jTextArea1.getText();
ac.sive(s);
}

public void jMenuItem5_actionPerformed(ActionEvent e) {
Actions ac = new Actions();
ac.find();
}
}


class Frame1_jMenuItem2_actionAdapter implements ActionListener {
private Frame1 adaptee;
Frame1_jMenuItem2_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.jMenuItem2_actionPerformed(e);
}
}


class Frame1_jButton3_actionAdapter implements ActionListener {
private Frame1 adaptee;
Frame1_jButton3_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.jButton3_actionPerformed(e);
}
}


class Frame1_jMenuItem1_actionAdapter implements ActionListener {
private Frame1 adaptee;
Frame1_jMenuItem1_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.jMenuItem1_actionPerformed(e);
}
}


class Frame1_jMenuItem5_actionAdapter implements ActionListener {
private Frame1 adaptee;
Frame1_jMenuItem5_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.jMenuItem5_actionPerformed(e);
}
}


class Frame1_jButton1_actionAdapter implements ActionListener {
private Frame1 adaptee;
Frame1_jButton1_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e);
}
}


class Frame1_jButton2_actionAdapter implements ActionListener {
private Frame1 adaptee;
Frame1_jButton2_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.jButton2_actionPerformed(e);
}
}
主要是图形界面,关于算法的我正在完善中。

搜索更多相关主题的帖子: import JAVA swing javax awt 
2007-10-04 15:06
yqjr
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-10-3
收藏
得分:0 
干什么啊  连名字也不命
2007-10-04 17:23
canyue
Rank: 1
等 级:新手上路
威 望:1
帖 子:159
专家分:0
注 册:2007-10-4
收藏
得分:0 
对不起,我忘了写了。这是一个具有记事本,多线程下载,网页浏览,和源码查看等功能的东东。
这里只是基本界面,还有待完善。

别看我现在只有这么亮,总有一天会月圆的!
2007-10-05 12:08
achang523890
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2007-10-11
收藏
得分:0 

那完善了让大家一起分享哦!
谢谢拉!


2007-10-11 10:37
快速回复:JAVA源码开放
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.033156 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved