public class DataModelTest { public static void main(String[] args) {// TODO Auto-generated method stub String rows[][] = { { "수곡동", "야구" }, { "모충동", "족구" }, { "개신동", "축구" } };String headers[] = { "이름", "종목" };String sports[] = { "야구", "축구", "족구", "기타" }; JComboBox comboBox = new JComboBox(sports);comboBox.setMaximumRowCount(4); TableCellEditor editor = new DefaultCellEditor(comboBox);JFrame fra..
public class JTableTest extends JFrame { JTableTest() {super("JTable Test");String title[] = { "번호", "이름", "나이" };String data[][] = { { "1", "김 구", "40" }, { "2", "강감찬", "42" },{ "3", "이순신", "41" } };JTable table = new JTable(data,title);//테이블객체 생성, 데이터와 타이틀을 인자로 가짐JScrollPane sp = new JScrollPane(table); //스크롤페인 붙임getContentPane().add(sp, BorderLayout.CENTER);//setSize(300,150);setVisible(true)..
public class BoxLayoutTest extends JFrame { public BoxLayoutTest() {super("Box Layout Test example");JRadioButton r1, r2; setLayout(new BorderLayout());Box left = Box.createVerticalBox();left.add(Box.createVerticalStrut(30)); ButtonGroup radioGroup = new ButtonGroup();radioGroup.add(r1 = new JRadioButton("야구"));left.add(r1); left.add(Box.createVerticalStrut(30));radioGroup.add(r2 = new JRadioBut..
public class ComboTest extends JFrame {JList jl;JComboBox com;String name[] = { "수곡동", "도곡동", "용암동", "분평동", "개신동" };String count[] = { "1", "2", "3", "4", "5" }; public ComboTest() {super("JComponent practice");Container c = getContentPane(); //Returns the contentPane object for this frame.c.setLayout(new FlowLayout()); //컨테이너의 레이아웃 설정 com = new JComboBox(name); //콤보박스에 name 붙임JScrollPane s = ne..
public class JTextTest extends JFrame {JLabel lb, lb1, lb2;JTextField id;JPasswordField passwd;JPanel idPanel, paPanel, loginPanel;JButton b1, b2;JTextArea content; public JTextTest() {super("JText test");setLayout(new FlowLayout());EtchedBorder eborder = new EtchedBorder(); lb = new JLabel("아이디와 패스워드를 입력하세요");lb.setBorder(eborder);add(lb); // 메시지를 프레임에 붙임 idPanel = new JPanel();lb1 = new JLabel..
Swing은 AWT 보다 약간 더 세련 되어졌다.윈도 창의 종료 버튼의 이벤트를 추가하였다.AWT와 마찬가지로 패널을 이용한다. public class JButtonTest extends JFrame {public JButtonTest() {super("Test");JPanel panel = new JPanel();JButton btn = new JButton("Button");panel.add(btn); ImageIcon icon1 = new ImageIcon(".\\src\\1.png"); //기본 이미지ImageIcon icon2 = new ImageIcon(".\\src\\2.png"); //눌렸을 때 이미지JToggleButton tg = new JToggleButton(icon1); //토글버..
안드로이드의 프레임 레이아웃과 유사 (화면 겹침) class CardLayoutTest extends Frame {CardLayout cl = new CardLayout();Panel p[] = new Panel[5];Color color[] = { Color.red, Color.blue, Color.yellow, Color.green,Color.cyan }; public CardLayoutTest(String str) {super(str); setLayout(cl);MouseHandle mh = new MouseHandle();//마우스핸들 객체 생성 for (int i = 0; i < 5; i++) {p[i] = new Panel();p[i].setBackground(color[i]);p[i].add..
class GridLayoutTest extends Frame {public GridLayoutTest(String str) {super(str); Button btn[] = new Button[6]; setLayout(new GridLayout(3,2));for (int i = 0; i < 6; i++) {btn[i] = new Button((i + 1) + "번 버튼");add(btn[i]);}setSize(200, 200);setVisible(true); }} public class GridLayoutMain { public static void main(String[] args) {// TODO Auto-generated method stubnew GridLayoutTest("Grid Layout..
- Total
- Today
- Yesterday
- 청주
- 졸업작품
- 게임
- 안드로이드
- 정보
- HTML
- 소켓
- db
- 파이썬
- JQuery
- 도전과제
- SVN
- ERP
- 데이터베이스
- 아두이노
- 이론
- 클래스
- SQL
- jsp
- 정렬
- 자바
- 알고리즘
- 잡담
- 메모장
- 자바스크립트
- 배열
- CSS
- 오라클
- 프로젝트
- 충북대
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |