본문 바로가기
반응형

자바102

자바 소스코드: MouseListener(마우스 올릴 시 색깔 바꾸기) package javaapplication11; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; class ListenerMouseEx extends JFrame{ ListenerMouseEx(){ this.setTitle("버튼에 Mouse 이벤트 리스너 작성"); this.setLayout(new FlowLayout()); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JButton btn = new JButton("Mouse Event 테스트 버튼"); MyMouseListener listener = new MyMouseListene.. 2016. 10. 12.
자바 소스코드: Action 이벤트리스너(클릭시 문자열 바꾸기) package javaapplication10; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; class ListenerSample extends JFrame { ListenerSample() { this.setTitle("Action 이벤트 리스너 작성"); this.setLayout(new FlowLayout()); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //버튼 컴포넌트를 생성하고 ActionListener를 단다. JButton btn = new JButton("Action"); MyActionListener listene.. 2016. 10. 9.
자바 소스코드: 간단한 스윙 응용프로그램 만들기(오픈 챌린지 9) package javaapplication9; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; class NorthPanel extends JPanel { NorthPanel() { this.setBackground(Color.LIGHT_GRAY); this.setLayout(new FlowLayout()); add(new JButton("Open")); add(new JButton("Read")); add(new JButton("Cancel")); } } class CenterPanel extends JPanel { CenterPanel() { setLayout(null); JLabe.. 2016. 10. 7.
자바 소스코드: 절대적 위치 설정(반복을 이용한 버튼 겹치기) package javaapplication7; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; class NullCon extends JFrame { NullCon() { this.setTitle("절대적 위치 설정"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container c = getContentPane(); c.setLayout(null); JLabel l = new JLabel("Hellow, press button"); l.setLocation(130,50); l.setSize(200,20); c.add(l); for(.. 2016. 10. 5.
반응형