[Áú¹®] ¹öÆ° Ŭ¸¯½Ã »õ·Î¿î ⠶߸鼭...¿¡·¯..


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

±Û¾´ÀÌ :±Ç¿µÁØ 1999³â 3¿ù 30ÀÏ 17:55:23

±Ç¿µÁØÀÔ´Ï´Ù
¹öÆ°À» Ŭ¸¯ÇßÀ»¶§, »õ·Î¿î âÀÌ ¶ß°í,
±× ⠾ȿ¡´Â ĵ¹ö½º¿Í 3°³ÀÇ ½ºÅ©·ÑÀÌ Á¸ÀçÇϸç,
°¢°¢ÀÇ ½ºÅ©·Ñ¹Ù¸¦ ¿òÁ÷¿´À»¶§ ±×¶§ÀÇ R.G.B °ª¿¡
µû¶ó ĵ¹ö½ºÀÇ »ö±òÀÌ ¹Ù²¸Áö´Â ±×·³ ¾ÖÇø´ ÇÁ·Î±×·¥ÀÔ´Ï´Ù. ±×·±µ¥, ÄÄÆÄÀÏ ºÎÅÍ Duplicated method declaration :
actionPerformed....ÇÏ°í ¿¡·¯°¡ ¶ß´Âµ¥, ¸ø Àâ°Ú±º¿ä.
µµ¿ÍÁÖ¼¼¿ä. ±×¸®°í, ¸¸¾à ´Ù¸¥ ¿¡·¯°¡ ÀÖ´Ù¸é, ±×°Í±îÁö
Àâ¾ÆÁÖ½Ã¸é °í¸¿Áö¿ä.


±×·³ ÁÁÀº ÇÏ·ç µÇ¼¼¿ä.
¾Æ·¡¿¡ ½î¾²°¡ ÀÖ½À´Ï´Ù.



import java.applet.*;
import java.awt.*;
import java.awt.event.*;


public class ColorSelectAA extends Applet implements ActionListener
{
private Label redLabel;
private Label greenLabel;
private Label blueLabel;
private Scrollbar red;
private Scrollbar green;
private Scrollbar blue;

private Canvas c;

public void init()
{
Button button = new Button("ColorSelect");
button.addActionListener(this);
add(button);


ColorSelectAA cs = new ColorSelectAA();
cs.select();
}

public void destroy()
{
cs.setVisible(false);
cs = null;
}

public void actionPerformed(ActionEvent event)
{
cs.setSize(200, 200);
cs.setVisible(true);
}


public void select()
{
Panel p = new Panel();
GridLayout grid = new GridLayout(3,2);
GridBagConstraints gbc = new GridBagConstraints();
p.SetLayout(grid);

p.add(redLabel = new Label("Red 0"));
p.add(red = new Scrollbar(Scrollbar.HORIZONTAL, 0, 0, 0, 255));
red.addSeparetor();
red.addActionListener(this);
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.fill = GridBagConstraints.VERTICAL;

p.add(blueLabel = new Label("Blue 0"));
p.add(blue = new Scrollbar(Scrollbar.HORIZONTAL, 0, 0, 0, 255));
blue.setPageIncrement(16);
blue.addActionListener(this);
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.fill = GridBagConstraints.VERTICAL;

p.add(greenLabel = new Label("Green 0"));
p.add(green = new Scrollbar(Scrollbar.HORIZONTAL, 0, 0, 0, 255));
green.setPageIncrement(16);
green.addActionListener(this);
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.fill = GridBagConstraints.VERTICAL;
add("south", p);

c = new Canvas();
c.setBackground(new Color(0, 0, 0));
add("Center", c);

addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent event) {
setVisible(false);
}
});
}

public void actionPerformed (ActionEvent event)
{
redLabel.setText("Red" + red.getValue());
greenLabel.setText("Green" + green.getValue());
blueLabel.setText("Blue" + blue.getValue());
c.setBackground(new Color(red.getValue(), green.getValue(), blue.getValue()));

c.repaint();
}
}





´ÙÀ½ ±Ûµé:



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

À̸§:
E-Mail:
Á¦¸ñ:
³»¿ë:
HTML ÅÂ±× Æ÷ÇÔ ¿©ºÎ: HTML ¹®¼­ÀÏ °æ¿ì üũ
°ü·Ã URL(¼±ÅÃ):
URL Á¦¸ñ(¼±ÅÃ):
°ü·Ã À̹ÌÁö URL:


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