Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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();&


Ïà¹ØÎĵµ£º

Java ¸´Ï°±Ê¼Ç_µÚ3Ìì


Êý¾Ý½á¹¹ºÍËã·¨
ðÅÝ£ºÃ¿´Î±È½Ï¶¼¿ÉÕÒ³ö×î´ó»ò×îСµÄ£¬ÓÐÐòµÄÔÚ×îÓÒ±ß
Ñ¡ÔñÅÅÐò£ºÓÐÐòµÄÔÚ×î×ó±ß
²åÈëÅÅÐò£ºËٶȱÈðÅÝ¿ìÒ»±¶£¬±ÈÑ¡ÔñÒ²¿ì¡£
    
µÝ¹é
      
µ÷ÓÃ×ÔÉí
      
ººÅµËþÎÊÌ⣺
/**
* @ººÅµËþµÄÎÊÌâ
*/ ......

Java ÖеÄÄÚ²¿¾²Ì¬Àà

Java ÖÐÄÚ²¿¶¯Ì¬Àà(ûÓÐstatic)¹Ø¼ü×ÖºÍÄÚ²¿¾²Ì¬ÀàµÄ¾ÍÔÚÓÚÄÚ²¿¶¯Ì¬À಻Äܶ¨Ò徲̬±äÁ¿»òÊǾ²Ì¬·½·¨,Èç¹ûÒªÔÚÄÚ²¿ÀàÖÐʹÓþ²Ì¬³ÉÔ±,±ØÐ뽫ÀàÉùÃ÷Ϊ¾²Ì¬Àà. ÄÚ²¿ÀàÖеľ²Ì¬·½·¨¿ÉÒÔ·ÃÎÊÍⲿÀàµÄ¾²Ì¬·½·¨ºÍ±¾ÀàÖеľ²Ì¬·½·¨»ò³ÉÔ±, ·Ç¾²Ì¬·½·¨¿ÉÒÔ·ÃÎÊÆäËûËùÓеķ½·¨»ò³ÉÔ± ......

Java Reflect ·´Éä ѧϰ±Ê¼Ç3 ²Ù×÷

       Java Reflect±àд ͨÓÃÊý×éÀ©Õ¹Àà
 
package com.accp.array;

import java.lang.reflect.Array;

public class GrowArrayTest {
public static void main(String[] args) {
Integer[] array = {1,2,3,4}; //ͨÓÃÀ©Õ¹
arrayPrint(arra ......

ʹÓÃJava½øÐÐͼÏñ´¦Àí

¡¾Òý×Ô¼üÅÌÉϵÄÎèÕߵIJ©¿Í¡¿Í¼Ïñ±àÂëÊä³öµÄ·½·¨£¬Ìṩ±àÂë½ø¶È¼àÌý£¬ÉèÖñàÂëÖÊÁ¿µÄÖ§³Ö£¨Ìض¨¸ñʽ£¬ÀýÈçJPG£©¡£
Õâ¸ö·½·¨Ö§³ÖµÄ±àÂë¸ñʽÒÀÀµÔËÐл·¾³ÀïImageIOÒѾ­×¢²áImageWriter¼¯ºÏ¡£
Java SE 6ÖеÄImageIOĬÈÏÖ§³ÖJPG£¬BMP£¬PNG£¬GIFµÈ¸ñʽ£¬Ò²¿ÉÒÔͨ¹ý·Ç±ê×¼Àà¿âÌí¼ÓImageIO¶ÔͼÏñ¸ñʽµÄÖ§³Ö£¬±ÈÈç°²×°JAI_ImageIO¡ ......

JAVA Ê÷ Rubicon

import   javax.swing.*;  
import   java.awt.*;  
import   java.awt.event.*;  
import   java.util.*; 
public class Temp {
 public Temp() {
  JFrame J = new JFrame("MENU");
  Container C = J. ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ