본문 바로가기
반응형

전체 글223

자바 소스코드: Menu와 JFileChooser 활용 예제 package javaapplication47; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.filechooser.*; import javax.swing.event.*; class MenuAndFileDialogEx extends JFrame{ JLabel la = new JLabel(); MenuAndFileDialogEx(){ this.setTitle("Menu와 JFileChooser 활용 예제"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.add(la); createMenu(); this.setLocationRelativeTo(n.. 2016. 12. 22.
자바 소스코드: 옵션 팬 만들기 package javaapplication46; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; class OptionPaneEx extends JFrame{ OptionPaneEx(){ this.setTitle("옵션 팬 예제"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setSize(500, 200); this.add(new MyPanel(), BorderLayout.NORTH); this.setVisible(true); } class MyPanel extends JPanel{ JButton inputBtn= new J.. 2016. 12. 22.
자바 소스코드: 다이얼로그 텍스트 바꾸기(ActionListener) package javaapplication45; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; class MyModalDialog extends JDialog{ JTextField tf=new JTextField(10); JButton okButton=new JButton("OK"); MyModalDialog(JFrame frame, String title){ super(frame,title,true); this.setLayout(new FlowLayout()); this.add(tf); this.add(okButton); this.setSize(200, 100); okButton.a.. 2016. 12. 22.
자바 소스코드: 다이얼로그 만들기 package javaapplication44; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; class MyDialog extends JDialog{ JTextField tf = new JTextField(10); JButton okButton=new JButton("OK"); MyDialog(JFrame frame, String title){ super(frame,title); this.setLayout(new FlowLayout()); this.add(tf); this.add(okButton); this.setSize(200, 100); okButton.addActionListe.. 2016. 12. 22.
반응형