Java GUI JLabel ºÍ JPanel ͼƬ ºÍ×é¼þÖصþÎÊÌâ
package ui;
import java.awt.AWTEvent;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
public class MainUi extends JPanel implements ActionListener
{
protected JTextField id, psw;
protected JButton ok, register, exit;
protected JLabel idl, pswl, imgl;
protected static JLabel imgpanel;
protected ImageIcon image;
public MainUi()
{
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
image = new ImageIcon("D://java/PZ/image/bg.jpg");
imgpanel = new JLabel(image);
id = new JTextField(60);
id.setActionCommand("ID");
idl = new JLabel("ID :");
idl.setLabelFor(id);
psw = new JTextField(60);
psw.setActionCommand("password");
pswl = new JLabel("PassWord: ");
pswl.setLabelFor(psw);
ok = new JButton("OK");
register = new JButton("REGISTER");
exit = new JButton("EXIT");
JPanel login = new JPanel();
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
login.setLayout(gridbag);
// imgl.setBounds(0, 0, imgIcon.getIconWidth(), imgIcon.getIconHeight());
// login.setOpaque(false);
JLabel[] labels = { idl, pswl };
JTextField[] textFields = { id, psw };
addLabelTextRows(labels, textFields, gridbag, login);
c.gridw
Ïà¹ØÎĵµ£º
JAVAÖÐÓÃÓÚ´¦Àí×Ö·û´®³£ÓõÄÓÐÈý¸öÀࣺjava.lang.String¡¢java.lang.StringBuffer¡¢java.lang.StringBuilder£¬ÕâÈýÕߵĹ²Í¬Ö®´¦¶¼ÊÇfinalÀ࣬²»ÔÊÐí±»¼Ì³Ð£¬ÕâÖ÷ÒªÊÇ´ÓÐÔÄܺͰ²È«ÐÔÉÏ¿¼Âǵģ¬ÒòΪÕ⼸¸öÀ඼ÊǾ³£±»Ê¹ÓÃ×ŵģ¬ÇÒ¿¼Âǵ½·ÀÖ¹ÆäÖеIJÎÊý±»ÐÞ¸ÄÓ°Ïìµ½ÆäËüµÄÓ¦Óá£StringBufferÓëStringBuilderÁ½¸ö»ù±¾Éϲ¶à£ ......
ÎÒÃÇÖªµÀ£¬Vector ÀàÌṩÁËʵÏÖ¿ÉÔö³¤Êý×éµÄ¹¦ÄÜ£¬Ëæןü¶àÔªËؼÓÈëÆäÖУ¬Êý×é±äµÄ¸ü´ó¡£ÔÚɾ³ýһЩԪËØÖ®ºó£¬Êý×é±äС¡£
Vector ÓÐÈý¸ö¹¹Ô캯Êý£¬
public Vector(int initialCapacity,int capacityIncrement)
public Vector(int initialCapacity)
public Vector()
......
ÏÂÃæµÄ³ÌÐò½«´òÓ¡Ò»¸öµ¥´Ê£¬ÆäµÚÒ»¸ö×ÖĸÊÇÓÉÒ»¸öËæ»úÊýÉú³ÉÆ÷À´Ñ¡ÔñµÄ¡£ÇëÃèÊö¸Ã³ÌÐòµÄÐÐΪ£º
import java.util.Random;
public class Rhymes {
private static Random rnd = new Random();
public static void main(String[] args) {
StringBuffer word = null;
switch(rnd.nextInt(2)) {
......
ÐÂÊÖ¸ÐÎò……
¾Í¸öÈËÀí½â£¬javaÖзÖΪ»ù±¾Êý¾ÝÀàÐÍ»¹ÓжÔÏ󡣶ÔÓÚ»ù±¾Êý¾ÝÀàÐÍ¡£ÔÚ¸³Öµ²Ù×÷Öд«µÝµÄÊÇÖµ£¬¶ø²»ÊÇÒýÓá£ÀýÈç
int a = 10;
int b = a;
int b = 11;
Õâʱ£¬Êä³öa,b¿ÉÒÔ·¢ÏÖ¡£a = 10 ,b = 11;ÔÚb = aÕâ¸ö¸³Öµ²Ù×÷ÖУ¬Êǽ«a¶ÔÓ¦µÄÖµ´«µÝ¸øÁËb¡£¶ø²»Êǽ«bµÄÒýÓÃÖ¸ÏòÁËaµÄ ......