±Û¾´ÀÌ :bestking 2000³â 6¿ù 28ÀÏ 22:14:20
¾È³çÇϼ¼¿ä
Àü ¾ÖÇø´¿¡¼ ÇÁ·¹ÀÓ Ã¢À» Çϳª ¶ç¾ú½À´Ï´Ù
±×·±µ¥ ¿©±â¿¡ title bar¿Í °æ°í ¾ÖÇø´ âÀ̶ó´Â ¸Þ¼¼Áö bar¸¦ ¾ø¾Ö·Á°í Çϰŵç¿ä
Áú¹®¿¡¼ ã¾Æ º¸´Ï±î window ÄÁÆ÷³ÍÆ®¸¦ »ç¿ëÇϴµ¥ µµÀúÈ÷ Àü ¾î¶»°Ô ÇØ¾ß ÇÒ Áö ¸ð¸£°Ú½À´Ï´Ù
±ÞÇϰŵç¿ä Á¦¹ß Çѹø¸¸ µµ¿ÍÁֽʽÿä
¼Ò½º´Â
Âü À̼ҽº´Â ¾ÖÇø´ ¹öÆ°À» ´©¸£¸é ÇÁ·¹ÀÓ Ã¢ÀÌ ³ª¿Í¼ ±× âÀÇ »çÀÌÁ Á¶Á¤ÇÕ´Ï´Ù
Ç® ¼Ò½º¸¦ ¿Ã¸³´Ï´Ù
ºÎµð ¿©·¯ °í¼ö´Ôµé µµ¿ÍÁֽʽÿä
*****Framesize.java**************
import java.awt.*;
import java.awt.event.*;
public class Framesize extends Frame
{
static Frame frm;
static Choice grimCho;
Panel pnl;
int idx;
static int re_start=0;
static int x=300;
static int y=150;
static int z=0;
public Framesize()
{
setTitle("ÇÁ·¹ÀÓâ");
setResizable(false);
grimCho = new Choice();
grimCho.addItem("MENU");
grimCho.addItem("1 X");
grimCho.addItem("2 X");
grimCho.addItem("4 X");
grimCho.addItem("Max");
grimCho.addItem("Min");
grimCho.addItem("Á¾ ·á");
pnl = new Panel();
pnl.add(grimCho);
add("West", pnl);
grimCho.setBackground(Color.white);
}
public boolean action(Event evt, Object arg)
{
if (evt.target.equals(grimCho))
idx = grimCho.getSelectedIndex();
if(idx==1){
x=300;
y=150;
if(re_start > 0){
frm.setLocation(0 ,0);
}
re_start = 0;
}else if(idx==2){
x=300*2;
y=150*2;
if(re_start > 0){
frm.setLocation(0 ,0);
}
re_start = 0;
}else if(idx==3){
x=300*4;
y=150*4;
if(re_start > 0){
frm.setLocation(0 ,0);
}
re_start = 0;
}else if(idx==4){
frm.setLocation(0 ,0);
Dimension d = frm.getToolkit().getScreenSize();
x=d.width;
y=d.height;
re_start = 1;
//frm.setSize(d.width, d.height);
}else if(idx==5){
frm.setLocation(0 ,0);
Dimension dim = frm.getToolkit().getScreenSize();
frm.setLocation(0 , dim.height - getBounds().height+30);
x=dim.width;
y=100;
z= dim.height - getBounds().height;
re_start = 2;
}else if(idx==6){
System.exit(0);
}
frm.resize(x, y);
return true;
}
public void paint(Graphics g)
{
g.drawString("³»¿ëÀÔ´Ï´Ù a="+z,90,70);
}
public boolean handleEvent(Event evt)
{
if (evt.id == Event.WINDOW_DESTROY)
System.exit(0);
return super.handleEvent(evt);
}
}
*****Applet_Frame.java************
import java.awt.*;
import java.applet.Applet;
import java.awt.event.*;
public class Applet_Frame extends Applet {
Button xLauncher;
public void init(){
Framesize.frm = null;
xLauncher = new Button("ÇÁ·¹ÀÓÀ» ¸¸µì´Ï´Ù.");
xLauncher.addActionListener(xLaunchListener);
setLayout(new BorderLayout());
add(xLauncher, BorderLayout.CENTER);
}
public void start() {
if (Framesize.frm != null) {
Framesize.frm.setVisible(true);
}
}
public void stop() {
if (Framesize.frm != null) {
Framesize.frm.setVisible(false);
}
}
public void destroy() {
}
ActionListener xLaunchListener = new ActionListener() {
public void actionPerformed(ActionEvent ev){
if ( Framesize.frm == null ) {
Framesize.frm = new Framesize();
//Framesize.frm.resize(Framesize.x, Framesize.y);
Framesize.frm.resize(300, 150);
Framesize.frm.show();
Framesize.frm.addWindowListener(
xExitListener
);
}
Framesize.frm.setVisible(true);
}
};
WindowListener xExitListener = new WindowAdapter() {
public void windowClosing(WindowEvent e) {
Framesize.frm.setVisible(false);
Framesize.frm.dispose();
Framesize.frm = null;
}
};
}
******Applet_Frame.html**************
<html>
<head>
<title>Applet_Frame ÇÁ·Î±×·¥ µ¥¸ð</title>
</head>
<body>
<center>
<h2>
Applet_Frame ÇÁ·Î±×·¥
</h2>
<APPLET CODE="Applet_Frame.class" WIDTH=300 HEIGHT=50>
</APPLET>
</center>
</body>
</html>
Âü Ȥ½Ã ÇÁ·¹ÀÓ Ã¢ÀÌ Ç×»ó ÃÖ»óÀ§ À©µµ¿ì¿¡ À§Ä¡ÇÏ´Â ¹ý°ú ºÎ¸ð âÀÌ Á×À¸¸é ÀÚ½Ä ÇÁ·¹ÀÓµµ Á״µ¥ »ì¸®´Â ¹æ¹ýÀº ¾ø³ª¿ä
³Ê¹« ¸¹Àº °ÍÀ» ¹Ù¶ó´Â±º¿ä
¾îÂÁ´Ï±î ¿Õ Ãʺ¸ÀÌ°í ±ÞÇѵ¥
ºÎµð ¿©·¯ °í¼ö´Ôµé Á¶±×¸¶ÇÑ Á¶¾ðµµ Á¦°Õ Å«ÈûÀÌ µÈ´ä´Ï´Ù