임베디드 프로그래밍  

         
전체 기타 | WinCE | Delphi | VisualC | ARM | Media | SE | 마리오네트 | Java | wdm | JTAG | 영상처리 | 인증 | 질문/답변 | H/W | 알고리즘 | Platform | .net | VB | PPC | Network | android | QT | WWW | Linux |
java 간단한 다이얼로그 띄우기
하창호08-29 05:07 | HIT : 8,371

UPLOAD 2 :: UITestDoc.zip (1.98 MB) | DOWN : 50


import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.Checkbox;
import java.awt.CheckboxGroup;
import java.awt.Dialog;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.Label;
import java.awt.Panel;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

/**
* This example shows AWT Dialog.
* @author TogetherSoft
*/
public class TestDialog extends Dialog {
    public TestDialog(Frame frame) {
        super(frame);
        initGUI();
    }

    /** This method is called from within the constructor to initialize the form. */
    void initGUI() {
        addWindowListener(
            new WindowAdapter() {
                public void windowClosing(WindowEvent e) { thisWindowClosing(e); }
            });
        setBounds(new Rectangle(0, 0, 500, 300));
        setResizable(false);
        setTitle("Test Dialog");
        add(buttonPanel, BorderLayout.SOUTH);
        add(contentPanel, BorderLayout.CENTER);
        buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
        buttonPanel.add(butttonHolder);
        butttonHolder.setLayout(new GridLayout(1, 0, 5, 0));
        butttonHolder.add(okButton);
        butttonHolder.add(cancelButton);
        okButton.setLabel("OK");
        cancelButton.setLabel("Cancel");
        okButton.addActionListener(
            new ActionListener() {
                public void actionPerformed(ActionEvent e) { okButtonActionPerformed(e); }
            });
        cancelButton.addActionListener(
            new ActionListener() {
                public void actionPerformed(ActionEvent e) { cancelButtonActionPerformed(e); }
            });
        contentPanel.setLayout(null);
        contentPanel.add(optionLabel);
        optionLabel.setText("Select one of the options below");
        optionLabel.setBounds(new java.awt.Rectangle(121, 70, 186, 35));
    }

    void cancel() {
        dispose();
        System.exit(0);
    }

    void ok() {
        Checkbox box = checkboxGroup1.getSelectedCheckbox();
        System.out.println(box.getLabel() + " is selected");
        cancel();
    }

    public void thisWindowClosing(WindowEvent e) {
        cancel();
    }

    public void okButtonActionPerformed(ActionEvent e) {
        ok();
    }

    public void cancelButtonActionPerformed(ActionEvent e) {
        cancel();
    }

    public static void main(String[] args) {
        Frame frame = new Frame();
        TestDialog dialog = new TestDialog(frame);
        dialog.show();
    }

    private Panel contentPanel = new Panel();
    private Panel buttonPanel = new Panel();
    private Panel butttonHolder = new Panel();
    private Button okButton = new Button();
    private Button cancelButton = new Button();
    private CheckboxGroup checkboxGroup1 = new CheckboxGroup();
    private Label optionLabel = new Label();
}



 Java :: java 간단한 다이얼로그 띄우기    하창호 2007·08·29 8371
2  Java :: Together 로 만든 모양만 계산기인 프로그램 (시간...    하창호 2004·08·31 3794
1  Java :: 자바 기초 I/O 문법 예제  …1  하창호 2004·08·30 3475
1
   
Copyright 1999-2018 Zeroboard / skin by GGAMBO
....