[Áú¹®] GridLayoutÀÌ Àß ¾ÈµÇ´Â ±º¿ä...HELP~~


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]

±Û¾´ÀÌ :ÀüÀç¿Ï 1998³â 8¿ù 03ÀÏ 19:07:57

±×¸®µå ·¹À̾ƿôÀÇ »ý¼ºÀÚ´Â ´ÙÀ½°ú °°Àº°ÍÀ¸·Î ¾Ë°í ÀÖ½À´Ï´Ù.
GridLayout()
GridLayout(int, int)
GridLayout(int, int, int, int)
À̶§ ù¹ø°¿Í µÎ¹ø°ÀÇ int·Î ±×¸®µåÀÇ ¼¼·Î¿Í °¡·ÎÀÇ °¹¼ö¸¦
Á¤ÇÏ´Â °ÍÀ¸·Î ¾Ë°í ÀÖ¾ú´Âµ¥....
´ÙÀ½°ú °°ÀÌ ÄÚµùÀ» Çϴϱî ÇÁ·¹ÀÓ¿¡ ²Ë Â÷Áö ¾Ê°í ¾î¼³ÇÂ(?)
¸ð½ÀÀ¸·Î ³ªÅ¸³ª´Â ±º¿ä....


ÇÁ·Î±×·¥ÀÇ ¿ä´Â ÀÓÀÇ °¹¼ö(labelNum)ÀÇ ¶óº§À» ¹ß»ý½ÃÅ°°í
±×¸®µå·¹À̾ƿô( new GridLayout(0, labelNum, 0, 0) )À»
·¹À̾ƿô°ü¸®ÀÚ·Î °¡Áö´Â Æä³Î(myPanel)¿¡ ÀÌ ·¹À̺íµéÀ» ¼ø¼­´ë·Î ºÙÀÔ´Ï´Ù..
±×¸®°í ÀÌ Æä³ÎÀ» ÇÁ·¹ÀÓ(myLay)¿¡ ºÙÀÔ´Ï´Ù.


·¹À̺íµéÀº ±³´ë·Î °ËÀº»ö°ú Èò»öÀ» ¹è°æÀ¸·Î »ïÀ¸¸é¼­ ¸¶Áö¸·
·¹ÀÌºí¸¸ ÆĶõ»öÀ» °¡Áöµµ·Ï Çß½À´Ï´Ù...


Æä³ÎÀº ÇÁ·¹ÀÓ¿¡ ²ËÂ÷°Ô ³ª¿À´Â °Í °°Àºµ¥... ·¹À̺íµéÀ» Æä³Î¿¡
ºÙÀ϶§´Â ²ËÂ÷°Ô ³ª¿ÀÁö ¾Ê´Â±º¿ä(Ç¥ÇöÀÌ ¸Â³ª???)


´ÙÀ½ÀÌ Àüü ¼Ò½ºÀÔ´Ï´Ù. ½ÇÇà½ÃÄѺ¸¸é ÇÁ·¹ÀÓÀÇ Å©±â¸¦ Á¶ÀýÇϴµ¥ µû¶ó¼­
·¹À̺íµéÀÇ Å©±â´Â º¯ÇÏ´Â°Í °°Àºµ¥ Æä³ÎÀÇ Àüü¸¦ Â÷ÁöÇϵµ·Ï Á¶ÀýµÇÁö´Â
¾Ê´Â±º¿ä.... ºÎµð ¹æ¹ýÀ» ¾Ë·Á ÁÖ½Ã±æ ºÎŹµå¸³´Ï´Ù...


//------------------------------ begin -----------------------
import java.awt.*;
import java.awt.event.*;


public class Lay extends Frame
{
private static int labelNum = 50; //»ý¼ºµÉ ·¹À̺íÀÇ °¹¼öÀÔ´Ï´Ù.
Panel myPanel = new Panel();

public Lay()
{
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e)
{
System.exit(-1);
}});
myPanel.setLayout(new GridLayout(0, labelNum, 0, 0));
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// ·¹À̾ƿô °ü¸®ÀÚ¸¦ ¼³Á¤Çß½À´Ï´Ù.
this.setSize(600,60);
}

public static void main(String args[])
{
Lay myLay = new Lay();
myLay.addLabel(myLay.makeLabel());
myLay.add(myLay.myPanel);
myLay.show();
}

public static Label[] makeLabel()
{
Label[] temp_label = new Label[labelNum];
int c = -1;

for(int i = 0 ; i < temp_label.length ; i++)
{
temp_label[i] = new Label();
c *= -1;
if(c == -1 ) {
temp_label[i].setBackground(Color.white);
}else {
temp_label[i].setBackground(Color.black);
}
if( (temp_label.length-1) == i) temp_label[i].setBackground(Color.blue);
}
return temp_label;
}

public void addLabel(Label[] l)
{
int c = l.length;

for(int i = 0 ; i < c ; i ++) myPanel.add(l[i]);
}
}
//------------------------------ end -----------------------


´ÙÀ½ ±Ûµé:



À̾ ±Û¿Ã¸®±â(´äÇϱâ)

À̸§:
E-Mail:
Á¦¸ñ:
³»¿ë:
°ü·Ã URL(¼±ÅÃ):
URL Á¦¸ñ(¼±ÅÃ):
°ü·Ã À̹ÌÁö URL:


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]