본문 바로가기
공개/Java & Oracle

project test

by Sibnt 2013. 11. 19.

 

 

 

 

 

CheckboxTest.java

 

LottoEx.java

 

NumberThread.java

,

package LottoProject;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

class LottoEx {
	public static void main(String[] args) {
		
		int arr[]={1,2,3,4,5,6};
		//첫번째 창
    	JFrame lottoExframe = new JFrame("로또 실행 프로그램");
    	lottoExframe.setPreferredSize(new Dimension(300, 120));
    	lottoExframe.setLocation(500, 400);
    	FlowLayout flow = new FlowLayout();
        

        
        
        Container contentPane = lottoExframe.getContentPane();
        
        JPanel lottoExframe_panel1 = new JPanel();
        JLabel lottoExframe_label1 = new JLabel("Test");
        
        lottoExframe_label1.setText("<html><font color=red><b>Lotto</b></font>Number</html>");
        //panel1.add(lottoExframe_label1);
        JPanel lottoExframe_panel1_2 = new JPanel();
       

        
        
        JButton lottoExframe_button1 = new JButton("직접선택");
        JButton lottoExframe_button2 = new JButton("자동선택");
        JButton lottoExframe_button3 = new JButton("당첨확인");
       
        lottoExframe_panel1.add(lottoExframe_button1);
        lottoExframe_panel1.add(lottoExframe_button2);
        lottoExframe_panel1.add(lottoExframe_button3);
        contentPane.add(lottoExframe_panel1,BorderLayout.NORTH);
        
        lottoExframe_panel1_2.setLayout(new GridLayout(1, 2));
        //lottoExframe_panel1_2.setLayout(flow);
        //lottoExframe_panel1_2.add(new JLabel("  내 번호"));
        lottoExframe_panel1_2.add(lottoExframe_label1);
        for(int i=0;i<6;i++){
			//try{
				lottoExframe_panel1_2.add(new JLabel(i+""));
		/*		Thread.sleep(30);
			}catch(InterruptedException e){
				System.out.println(e.getMessage());
			}*/
		}

        //lottoExframe_panel1_2.add(new JLabel("  당첨금"));
        contentPane.add(lottoExframe_panel1_2,BorderLayout.CENTER);
        

       // contentPane.setLayout(layout);
        
  
        
        //두번째 창
        JFrame frame2 = new JFrame("두번째 창");
        frame2.setPreferredSize(new Dimension(400, 200));
        frame2.setLocation(500, 450);
        JPanel panel2_1 = new JPanel();
        Container contentPane2 = frame2.getContentPane();
        JLabel label2_1 = new JLabel("Test2");
        contentPane2.add(label2_1);
        
        
        
       // button1.addActionListener(new ConfirmActionListener(frame2));
        lottoExframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        lottoExframe.pack();
        lottoExframe.setVisible(true);
	}

}

package LottoProject;
import java.awt.*;

import javax.swing.*;

class CheckboxTest {
	public static void main(String[] args) {
		JFrame myNumberframe = new JFrame("체크박스테스트");
		
		Container contentPane = myNumberframe.getContentPane();
		JPanel myNumberframe_panel1 = new JPanel();
		JPanel myNumberframe_panel2 = new JPanel();
		JButton myNumberframe_button1 = new JButton("입력");
		Checkbox ck[]= new Checkbox[45];
		
		for (int i=0;i<45;i++){
			if(i<9){
				ck[i]=new Checkbox("0"+(i+1));
			}else{
				ck[i] = new Checkbox((i+1)+"");	
			}			
		}
		
		for (int i=0;i<45;i++){
			myNumberframe_panel1.add(ck[i]);
		}
		
		myNumberframe_panel2.add(myNumberframe_button1);
		myNumberframe.add(myNumberframe_panel1);
		myNumberframe.add(myNumberframe_panel2);
		contentPane.add(myNumberframe_panel1,BorderLayout.CENTER);
		contentPane.add(myNumberframe_panel2,BorderLayout.SOUTH);
		myNumberframe.setSize(240,330);
		myNumberframe.setVisible(true);
	}
}

 

댓글0