semi project 진행중
package com.tech.semiprj;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Font;
import java.awt.GridLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class TabFrame1 extends JFrame{
JPanel tF1Tab[]=new JPanel[3];
JLabel tF1TabLab[]=new JLabel[3];
JPanel tF1pan[]=new JPanel[8];
JLabel tF1lab[]=new JLabel[8];
JButton tF1btn[]=new JButton[8];
Container tF1=getContentPane(); // 전체 프레임
JButton homeButton=new JButton(); // 홈버튼
JPanel tF1BackgroundPanel=new JPanel(); // 맨 뒷 배경
JPanel tF1MenuBackgroundPanel=new JPanel(); // 메뉴 칸 배경
JPanel tF1ShoppingCart=new JPanel();
JLabel tF1SCLabel=new JLabel();
JTextField SCPrice=new JTextField();
JPanel tF1Price=new JPanel();
JLabel tF1PrcLabel=new JLabel();
JTextField Price=new JTextField();
JButton tF1paybtn=new JButton();
public TabFrame1() {
setTitle("키오스크1");
setSize(640,600);
setDefaultCloseOperation(EXIT_ON_CLOSE);
tF1.setLayout(null);
homeButton.setSize(70,50);
homeButton.setLocation(530,30);
homeButton.setBackground(Color.yellow);
homeButton.setText("Home");
tF1BackgroundPanel.setSize(640,600);
tF1BackgroundPanel.setLocation(0,0);
tF1BackgroundPanel.setBackground(Color.DARK_GRAY);
tF1MenuBackgroundPanel.setLayout(null);
tF1MenuBackgroundPanel.setSize(580,360);
tF1MenuBackgroundPanel.setLocation(20,90);
tF1MenuBackgroundPanel.setBackground(Color.white);
for (int i=0;i<3;i++) {
tF1Tab[i]=new JPanel(new GridLayout(0,1));
tF1Tab[i].setSize(100,50);
tF1Tab[i].setBackground(Color.yellow);
tF1Tab[i].setLocation(20+120*i, 30);
tF1TabLab[i]=new JLabel("Tab"+i,JLabel.CENTER);
tF1Tab[i].add(tF1TabLab[i]);
tF1.add(tF1Tab[i]);
}
for(int i=0;i<8;i++) {
tF1pan[i]=new JPanel(new BorderLayout());
tF1pan[i].setBackground(Color.gray);
tF1lab[i]=new JLabel("asdf",JLabel.CENTER);
tF1btn[i]=new JButton("▶ 구매 ◀");
tF1btn[i].setForeground(Color.black);
tF1btn[i].setFont(new Font("Gothic",Font.BOLD,20));
tF1btn[i].setBackground(Color.cyan);
tF1pan[i].add(tF1lab[i]);
tF1pan[i].add(tF1btn[i],BorderLayout.SOUTH);
tF1MenuBackgroundPanel.add(tF1pan[i]);
}
for(int i=0;i<4;i++) {
tF1pan[i].setBounds(15+140*i,10,130,165);
tF1pan[i+4].setBounds(15+140*i,185,130,165);
}
tF1ShoppingCart.setLayout(new BorderLayout());
tF1ShoppingCart.setSize(310,90);
tF1ShoppingCart.setLocation(20,460);
tF1ShoppingCart.setBackground(Color.LIGHT_GRAY);
tF1SCLabel.setText(" ☞ 담은 상품");
tF1SCLabel.setFont(new Font("Gothic",Font.BOLD,20));
tF1ShoppingCart.add(tF1SCLabel,"North");
SCPrice.setFont(new Font("Gothic",Font.BOLD,20));
tF1ShoppingCart.add(SCPrice,"Center");
tF1Price.setLayout(new BorderLayout());
tF1Price.setSize(260,90);
tF1Price.setLocation(340,460);
tF1Price.setBackground(Color.pink);
tF1PrcLabel.setText(" ▼ 총액");
tF1PrcLabel.setFont(new Font("Gothic",Font.BOLD,20));
tF1Price.add(tF1PrcLabel,"North");
Price.setFont(new Font("Gothic",Font.BOLD,20));
tF1Price.add(Price,"Center");
tF1paybtn.setText("결제");
tF1paybtn.setFont(new Font("Gothic",Font.BOLD,30));
tF1paybtn.setForeground(Color.white);
tF1paybtn.setBackground(Color.DARK_GRAY);
tF1Price.add(tF1paybtn,"East");
tF1.add(homeButton);
tF1.add(tF1ShoppingCart);
tF1.add(tF1Price);
tF1.add(tF1MenuBackgroundPanel);
tF1.add(tF1BackgroundPanel);
setVisible(true);
}
public static void main(String[] args) {
new TabFrame1();
}
}
TabFrame1.java
for문 이용해서 코드 압축중.
main 화면에서 버튼을 누르면 TabFrame1 로 넘어가게,
homeButton 을 누르면 다시 메인화면으로 돌아가게 구현중
Tab0 을 누르면 TabFrame1 이, Tab1을 누르면 TabFrame2가, Tab2를 누르면 TabFrame3 창이 나오게 구현중
목요일 (24.01.11) 7교시
semi-project 중간점검
방법 : 실행화면을 캡쳐한 ppt로 중간 결과물 받을 예정ppt 파일명 : 세미중간_홍길동.pptx
방법은 내일 공지할 예정.
semi-project 자체 중간점검
program 실행 영상
추가할 내용