냉커피프리드리히
8
2018-11-09 23:25:34
1
97

윈도우빌더와 sms 연동 질문입니다.



package Main;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;

import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;

public class SMSFrame extends JFrame implements ActionListener{
	DBConnection connection = new DBConnection();
	//image icon
	public ImageIcon smsbackground_image= new ImageIcon(SMSFrame.class.getResource("/images/sms_background.jpg"));

	private static final int SMS_WIDTH = 300;
	private static final int SMS_HEIGHT = 500;
	private static final int SMS_SCREEN_WIDTH = 294;
	private static final int SMS_SCREEN_HEIGHT = 461;
	
	JPanel main_panel;
	JButton send_button;
	
	private ArrayList<String> tellist = new ArrayList<String>();
	
	public SMSFrame() {
		
		setTitle("conferencesystem/SMS");
		setSize(SMS_WIDTH, SMS_HEIGHT);
		setResizable(false);
		setLocationRelativeTo(null);
		getContentPane().setLayout(null);
		
		main_panel = new JPanel();
		main_panel.setBounds(0, 0, SMS_SCREEN_WIDTH, SMS_SCREEN_HEIGHT);
		getContentPane().add(main_panel);
		main_panel.setLayout(null);
		
		JComboBox tel_combobox = new JComboBox();
		tel_combobox.setBounds(93, 29, 120, 30);
		main_panel.add(tel_combobox);
		tellist = connection.getTel(ConferenceFrame.groupnum);
		for(int i=0; i<tellist.size(); i++) {
			tel_combobox.addItem(tellist.get(i));
		}
		
		JTextArea sms_textarea = new JTextArea();
		sms_textarea.setBounds(12, 78, 260, 162);
		main_panel.add(sms_textarea);
		
		send_button = new JButton("SEND");
		send_button.setBackground(new Color(100,200,200));
		send_button.setFont(new Font("±¼¸²", Font.BOLD, 12));
		send_button.setBounds(175, 250, 97, 23);
		send_button.addActionListener(this);
		main_panel.add(send_button);
		
		JLabel background_label = new JLabel();
		background_label.setBounds(0, 0, SMS_SCREEN_WIDTH, SMS_SCREEN_HEIGHT);
		background_label.setIcon(smsbackground_image);
		main_panel.add(background_label);
		
		setVisible(true);
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		setVisible(false);
	}
}

여기가 윈도우 빌더로한 gui 입니다.



package sms;

import java.util.HashMap;
import org.json.simple.JSONObject;
import net.nurigo.java_sdk.api.Message;
import net.nurigo.java_sdk.exceptions.CoolsmsException;

public class SendMessage {
	public static void main(String[] args) {
		String api_key = "키번호 ";
		String api_secret = "시크릿번호";
		Message coolsms = new Message(api_key, api_secret);

		// 4 params(to, from, type, text) are mandatory. must be filled
		HashMap<String, String> params = new HashMap<String, String>();
		params.put("to", "010000000"); // 수신번호
		params.put("from", "010000000"); // 발신번호
		params.put("type", "SMS"); // Message type ( SMS, LMS, MMS, ATA )
		params.put("text", "도와주세요"); // 문자내용
		params.put("app_version", "JAVA SDK v1.2"); // application name and version

				try {
			JSONObject obj = (JSONObject) coolsms.send(params);
			System.out.println(obj.toString());
		} catch (CoolsmsException e) {
			System.out.println(e.getMessage());
			System.out.println(e.getCode());
		}
	}
}


이게 sms 보내는 소스 입니다 이걸 어떻게 연동해야 할지모르겠네요 ㅠㅠ



-1
0
  • 답변 1

  • alan
    1k
    2018-11-10 03:49:59

    혹시 자바 따로 공부 어느정도 공부하셨나요?

    객체부터 공부하셔야 할 것 같은데요.

    0
  • 로그인을 하시면 답변을 등록할 수 있습니다.