java Swing gui 기본 - button 만들기 Java

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

public class ProjectMain {

JFrame m_MainFrame = null;
JPanel m_SomeFuncPanel = null;
JButton m_Btn = null;
public ProjectMain()
{
init();
}
public static void main(String[] args) {
ProjectMain projectMain = new ProjectMain();
}
void init()
{
m_MainFrame = new JFrame();
m_SomeFuncPanel = new JPanel();
m_Btn = new JButton("button");
m_MainFrame.setBounds(100,100, 300,300);
m_MainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
m_MainFrame.setVisible(true);
m_MainFrame.add(m_SomeFuncPanel);
m_SomeFuncPanel.add(m_Btn);
}
}

덧글

댓글 입력 영역