윈도우빌더 gui 랑 sms 보내는 소스를 어떻게 합쳐야 할지 모르겠어요 ㅠㅠ
조회수 559회
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);
}
}
/////////////////////여기까지가 윈도우빌더로 만든거고요//////////////////////////////////// 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 보내는 소스인데 어떻게 합쳐야 할지모르겠네요 ㅠㅠ////////////
자린이 도와주세요 ㅠ
-
(•́ ✖ •̀)
알 수 없는 사용자
댓글 입력