javaÖÐʹ´°¿Ú¾ÓÖÐÏÔʾ
Èç¹ûҪʹÖ÷´°¿Ú ¾ÓÖÐÒ»°ãʹÓÃÏÂÃæµÄ·½·¨£º
import javax.swing.*;
import java.awt.*;
public class ToCenter
{
public ToCenter(JFrame frame)
{
//---------------------------ÉèÖô°¿Ú¾ÓÖÐ----------------------------------------------------------
int windowWidth = frame.getWidth(); //»ñµÃ´°¿Ú¿í
int windowHeight = frame.getHeight(); //»ñµÃ´°¿Ú¸ß
Toolkit kit = Toolkit.getDefaultToolkit(); //¶¨Ò幤¾ß°ü
Dimension screenSize = kit.getScreenSize(); //»ñÈ¡ÆÁÄ»µÄ³ß´ç
int screenWidth = screenSize.width; //»ñÈ¡ÆÁÄ»µÄ¿í
int screenHeight = screenSize.height; //»ñÈ¡ÆÁÄ»µÄ¸ß
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//ÉèÖô°¿Ú¾ÓÖÐÏÔʾ
//------------------------------------------------------------------------------------------------
}
}
µ±È»ÄãÒ²¿ÉÒÔÈÃÒ»¸öWindow¶ÔÏó¡¢JWindow¶ÔÏó»òFrame¶ÔÏó¾ÓÖУ¬ÒÔÏÂÊǸüͨÓõķ½·¨£º
Toolkit kit = Toolkit.getDefaultToolkit();&
Ïà¹ØÎĵµ£º
ÕæÊDzÑÀ¢°¡, ѧÁËÔõô¾Ã java, ÏÖÔÚ²ÅÖªµÀ java µÄ»ù±¾Êý¾ÝÀàÐÍÊDz»´æÔÚÓзûºÅºÍÎÞ·ûºÅÕâÖÖ¶«Î÷µÄ. ƽʱ¶¼Ã»Óиã×Ö½ÚºÍλ֮ÀàµÄÔËËã, ËùÒÔµ¹ÊÇûÓÐ×¢Òâµ½Õâ¸ö·½ÃæÄØ.
JAVAÖеĻù±¾Êý¾ÝÀàÐͲ»´æÔÚÎÞ·ûºÅµÄ£¬ËüÃǵÄÈ¡Öµ·¶Î§Êǹ̶¨µÄ£¬²»»áËæ×Å»úÆ÷Ó²¼þ»·¾³»òÕß²Ù×÷ϵͳµÄ¸Ä±ä¶ø¸Ä±ä¡£(Õâ¾ä³µÄ)
Java¼òµ¥Êý¾ÝÀàÐÍ
......
ͨ³£Çé¿öÏ£¬ÎÒÃÇÔÚдһ¸öÀàʱ£¬Ò»°ã»á¸³ÓèËüÒ»¸ö»ò¼¸¸öpublicµÄ¹¹Ô캯Êý£¬ÈÃÍⲿ³ÌÐòÄܹ»´´½¨¶ÔÏó.¡¡È»¶ø£¬ÔÚeffective¡¡java ÖУ¬´ÓÁíÒ»¸ö½Ç¶È¸æ½ëÎÒÃÇÔÚʹÓÃpublicµÄ¹¹Ô캯ÊýÇ°£¬ÏÈ¿¼ÂÇÓÃpublic µÄ¾²Ì¬º¯ÊýÀ´´´½¨¶ÔÏó.¡¡
ÆäÓŵãÈçÏ£º
£±.¡¡Ò»¸ö¾²Ì¬µÄ¹¤³§º¯Êý£¬¿ÉÒÔÈ¡²»Í¬µÄÃû×Ö.¡¡¶ø¹¹Ô캯ÊýµÄÃû×ÖÖ»ÄÜÓëÀàͬÃû.¡¡
......
¡¾Òý×Ô¼üÅÌÉϵÄÎèÕߵIJ©¿Í¡¿Í¼Ïñ±àÂëÊä³öµÄ·½·¨£¬Ìṩ±àÂë½ø¶È¼àÌý£¬ÉèÖñàÂëÖÊÁ¿µÄÖ§³Ö£¨Ìض¨¸ñʽ£¬ÀýÈçJPG£©¡£
Õâ¸ö·½·¨Ö§³ÖµÄ±àÂë¸ñʽÒÀÀµÔËÐл·¾³ÀïImageIOÒѾע²áImageWriter¼¯ºÏ¡£
Java SE 6ÖеÄImageIOĬÈÏÖ§³ÖJPG£¬BMP£¬PNG£¬GIFµÈ¸ñʽ£¬Ò²¿ÉÒÔͨ¹ý·Ç±ê×¼Àà¿âÌí¼ÓImageIO¶ÔͼÏñ¸ñʽµÄÖ§³Ö£¬±ÈÈç°²×°JAI_ImageIO¡ ......
<%@ page import="java.lang.*" %>
ÉáµôСÊýÈ¡Õû:Math.floor(2.0)=2
ÉáµôСÊýÈ¡Õû:Math.floor(2.1)=2
ÉáµôСÊýÈ¡Õû:Math.floor(2.5)=2
ÉáµôСÊýÈ¡Õû:Math.floor(2.9)=2
ÉáµôСÊýÈ¡Õû:Math.floor(-2.0)=-2
ÉáµôСÊýÈ¡Õû:Math.floor(-2.1)=-3
ÉáµôСÊýÈ¡Õû:Math.floor(-2.5)=-3
ÉáµôСÊýÈ¡Õû:Math.floor(-2.9)= ......
Servlet/JSP¼¼ÊõºÍASP¡¢PHPµÈÏà±È£¬ÓÉÓÚÆä¶àÏß³ÌÔËÐжø¾ßÓкܸߵÄÖ´ÐÐЧÂÊ¡£ÓÉÓÚServlet/JSPĬÈÏÊÇÒÔ¶àÏß³ÌģʽִÐеģ¬ËùÒÔ£¬ÔÚ±àд´úÂëʱÐèÒª·Ç³£Ï¸Öµؿ¼ÂǶàÏ̵߳ݲȫÐÔÎÊÌ⡣Ȼ¶ø£¬ºÜ¶àÈ˱àдServlet/JSP³ÌÐòʱ²¢Ã»ÓÐ×¢Òâµ½¶àḬ̈߳²È«ÐÔµÄÎÊÌ⣬ÕâÍùÍùÔì³É±àдµÄ³ÌÐòÔÚÉÙÁ¿Óû§·ÃÎÊʱûÓÐÈκÎÎÊÌ⣬¶øÔÚ²¢·¢Óû§ÉÏÉýµ ......