본문 바로가기
반응형

전체 글223

자바 소스코드: paintComponent 예제(사각형 그리기: drawRect) package javaapplication3; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; class paintJPanelEx extends JFrame{ paintJPanelEx(){ this.setTitle("JPanel paintComponent 예제"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); MyPanel panel = new MyPanel(); this.add(panel, BorderLayout.CENTER); this.setLocationRelativeTo(null); this.setSize(250,200); thi.. 2016. 11. 12.
자바 소스코드: JSlider를 이용한 수직 슬라이더 만들기 예제 package javaapplication2; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; class VerticalSliderEx extends JFrame{ VerticalSliderEx(){ this.setTitle("수직 슬라이더 만들기 예제"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JSlider js = new JSlider(JSlider.VERTICAL, 0, 200, 100); js.setPaintLabels(true); js.setPaintTicks(true); js.setPaintTrack(true); js... 2016. 11. 12.
자바 소스코드: 슬라이더와 ChangeEvent 예제 package javaapplication63; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; class SliderChangeEx extends JFrame{ JLabel la; JSlider[] sl = new JSlider[3]; SliderChangeEx(){ this.setTitle("슬라이더와 ChangeEvent 예제"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLayout(new FlowLayout()); la = new JLabel(" SLIDER EXAMPLE "); for(int i=0; i 2016. 11. 12.
자바 소스코드: JSlider를 이용한 슬라이더 만들기 예제 package javaapplication62; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; class SliderEx extends JFrame{ SliderEx(){ this.setTitle("슬라이더 만들기 예제"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JSlider sl = new JSlider(JSlider.HORIZONTAL, 0, 200, 100); sl.setPaintLabels(true); sl.setPaintTicks(true); sl.setPaintTrack(true); sl.setMajorTickSpac.. 2016. 11. 12.
반응형