Sidewinder


World


FishMusic


LaughingBaby


Tuesday, August 12, 2008

java JInternalFrame





import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class A02 extends JFrame{

JInternalFrame inframe;
JLabel l;
ImageIcon icon;
// 여기 수정
final JDesktopPane desktop;
public A02(){
super("A02 ");
JMenuBar bar = new JMenuBar();
setJMenuBar(bar);
JMenu addMenu = new JMenu("추가");
JMenuItem newInFrame = new JMenuItem("내부프레임추가");
addMenu.add(newInFrame);
bar.add(addMenu);
desktop = new JDesktopPane();
getContentPane().add(desktop,BorderLayout.CENTER);
//이부분 추가
addFrame();
newInFrame.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){


}
}
);

setSize(300,200);
setVisible(true);
}
//여기도 추가
private void addFrame() {
// TODO Auto-generated method stub
inframe = new JInternalFrame("내부프레임",true,true,true);
icon = new ImageIcon("c:/android.jpg");
l = new JLabel(icon);
inframe.getContentPane().add(l,BorderLayout.CENTER);
inframe.setSize(200,100);
inframe.show();
desktop.add(inframe);
}
public static void main(String [] args){
A02 jinter = new A02();
jinter.setDefaultCloseOperation(EXIT_ON_CLOSE);
}
}

No comments:

Post a Comment