import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;
class mainFrame extends JFrame
{
public mainFrame(){
this.setSize(300,200);
this.setVisible(true);
new parentDLG();
}
public static void main(String[] ar){
new mainFrame();
}
}
class parentDLG implements MenuListener{
Container con;
mainFrame frame;
JDialog dlg = new JDialog(frame, true);
JMenu menu = new JMenu("메뉴");
JEditorPane edPane = new JEditorPane();
JScrollPane jsp = new JScrollPane(edPane);
public parentDLG(){
dlg.getContentPane().add(jsp);
JMenuBar jmb = new JMenuBar();
jmb.add(menu);
dlg.setJMenuBar(jmb);
menu.addMenuListener(this);
edPane.setContentType("text/html");
edPane.setText("hi");
dlg.setSize(200,200);
dlg.setVisible(true);
dlg.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
}
public void menuCanceled(MenuEvent e){}
public void menuDeselected(MenuEvent e){}
public void menuSelected(MenuEvent e){
if(e.getSource() == menu){
new subDLG(this.dlg);
}
}
}
class subDLG
{
JDialog ddd;
JDialog subdlg = new JDialog(ddd, true);
//// 소유자가 parentDLG다이얼로그이어야하고, parentDLG 다이얼로그 앞쪽에 보여져야함..
public subDLG(JDialog dlg) {
ddd=dlg;
subdlg.getContentPane().add(new JButton("aaa"));
subdlg.setSize(100,100);
subdlg.setVisible(true);
subdlg.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
}
};
'IT_Programming > Java' 카테고리의 다른 글
JEditorPane 에서 특정문자열에 포커스 설정하기 (0) | 2008.08.20 |
---|---|
JTabbedPane & JEditorPane Example (0) | 2008.08.20 |
JPopupMenu Example (0) | 2008.08.20 |
image view (이미지 여러 방향으로 뒤집기) (0) | 2008.08.20 |
java HTML Parsing & ParserCallback (0) | 2008.08.20 |