IT_Programming/Java

JInternalFrame

JJun ™ 2008. 8. 20. 08:14

 

 


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);
    }
}

'IT_Programming > Java' 카테고리의 다른 글

자바 그림 불러오기   (0) 2008.08.20
DefaultTreeCellRenderer test   (0) 2008.08.20
java 24시간제를 12시간제로 바꾸기   (0) 2008.08.20
java StringTokenizer   (0) 2008.08.20
JTable setPreferredWidth 각 컬럼 너비조절  (0) 2008.08.20