µ¥µÄJAVAä¯ÀÀÆ÷
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import org.jdesktop.jdic.browser.IWebBrowser;
import org.jdesktop.jdic.browser.WebBrowser;
import org.jdesktop.jdic.browser.WebBrowserEvent;
import org.jdesktop.jdic.browser.WebBrowserListenerAdapter;
/**
*
* @author hadeslee
*/
public class Test1 extends JPanel implements ActionListener {
private JTextField input;
private JButton go;
private IWebBrowser web;
public Test1() {
super(new BorderLayout());
initWindow();
}
private void initWindow() {
try {
web = new WebBrowser();
web.addWebBrowserListener(new MyListener());
go = new JButton("תµ½");
input = new JTextField();
JPanel up = new JPanel(new BorderLayout());
up.add(input, BorderLayout.CENTER);
up.add(go, BorderLayout.EAST);
this.add(up, BorderLayout.NORTH);
this.add(web.asComponent(), BorderLayout.CENTER);
input.addActionListener(this);
go.addActionListener(this);
} catch (Exception ex) {
Logger.getLogger(Test1.class.getName()).log(Level.SEVERE, null, ex);
}
JFrame jf = new JFrame("JAVAä¯ÀÀÆ÷");
jf.add(this, BorderLayout.CENTER);
jf.setSize(500, 300);
jf.setLocationRelativeTo(null);
jf.setVisible(true);
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void actionPerformed(ActionEvent ae) {
doOpen();
}
private void doOpen() {
try {
String text = input.getText();
if (text == null || text.equals("")) {
return;
}
if (!text.toLowerCase().startsWith("http://")) {
text = "http://" + text;
}
web.setURL(new URL(text));
} catch (MalformedURLException ex) {
Logger.getLogger(Test1.class.getName()).log(Level.SEVERE, null, ex);
}
}
public static void main(String[] args) {
new Test1();
}
private class MyListener
Ïà¹ØÎĵµ£º
Javaµ÷Óô洢¹ý³Ì
±¾ÎIJûÊöÁËÔõôʹÓÃDBMS´æ´¢¹ý³Ì¡£ÎÒ²ûÊöÁËʹÓô洢¹ý³ÌµÄ»ù±¾µÄºÍ¸ß¼¶ÌØÐÔ£¬±ÈÈç·µ»ØResultSet¡£±¾ÎļÙÉèÄã¶ÔDBMSºÍJDBCÒѾ·Ç³£ÊìϤ£¬Ò²¼ÙÉèÄãÄܹ»ºÁÎÞÕÏ°µØÔĶÁÆäËüÓïÑÔд³ÉµÄ´úÂ루¼´²»ÊÇJavaµÄÓïÑÔ£©£¬µ«ÊÇ£¬²¢²»ÒªÇóÄãÓÐÈκδ洢¹ý³ÌµÄ±à³Ì¾Àú¡£
´æ´¢¹ý³ÌÊÇÖ¸±£´æÔÚ ......
1.¸ÅÊö
JSPÊÇÒ»ÖÖʵÏÖÆÕͨ¾²Ì¬HTMLºÍ¶¯Ì¬HTML»ìºÏ±àÂëµÄ¼¼Êõ¡£
JSP×îÖջᱻת»»³É±ê×¼µÄServlet£¡£¡£¡
JSPÉè¼ÆµÄÄ¿µÄÔÚÓÚ¼ò»¯±íʾ²ãµÄ±íʾ¡£
JSPÒ³ÃæµÄÆäËû³É·ÖÖ÷ÒªÓÐÈçÏÂÈýÖÖ£º
½Å±¾ÔªËØ
Ö¸Áî
¶¯×÷
ÀýÈ磺
<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.util.*& ......
Ï̳߳ØͨË×µÄÃèÊö¾ÍÊÇÔ¤ÏÈ´´½¨Èô¸É¿ÕÏÐỊ̈߳¬µÈµ½ÐèÒªÓöàÏß³ÌÈ¥´¦ÀíÊÂÎñµÄʱºòÈ¥»½ÐÑijЩ¿ÕÏÐÏß³ÌÖ´Ðд¦ÀíÈÎÎñ£¬ÕâÑù¾ÍÊ¡È¥ÁËƵ·±´´½¨Ï̵߳Äʱ¼ä£¬ÒòΪƵ ·±´´½¨Ïß³ÌÊÇÒªºÄ·Ñ´óÁ¿µÄCPU×ÊÔ´µÄ¡£Èç¹ûÒ»¸öÓ¦ÓóÌÐòÐèҪƵ·±µØ´¦Àí´óÁ¿²¢·¢ÊÂÎñ£¬²»¶ÏµÄ´´½¨Ïú»ÙÏß³ÌÍùÍù»á´ó´óµØ½µµÍϵͳµÄЧÂÊ£ ......
JAVA×¢ÊÍ·½·¨¼°¸ñʽ
1¡¢µ¥ÐÐ(single-line)--¶Ì×¢ÊÍ£º//……
µ¥¶ÀÐÐ×¢ÊÍ£ºÔÚ´úÂëÖе¥ÆðÒ»ÐÐ×¢ÊÍ£¬ ×¢ÊÍÇ°×îºÃÓÐÒ»ÐпÕÐУ¬²¢ÓëÆäºóµÄ´úÂë¾ßÓÐÒ»ÑùµÄËõ½ø²ã¼¶¡£Èç¹ûµ¥ÐÐÎÞ·¨Íê³É£¬ÔòÓ¦²ÉÓÿé×¢ÊÍ¡£
×¢Ê͸ñʽ£º/* ×¢ÊÍÄÚÈÝ */
ÐÐÍ·×¢ÊÍ£ºÔÚ´úÂëÐеĿªÍ·½øÐÐ×¢ÊÍ¡£Ö÷ҪΪÁËʹ¸ÃÐд ......