Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- Kotlin
- kotliln
- 알고리즘
- i18n
- 알게뭐냐
- cache-control
- 워드프레스
- 클래스레벨밸리데이션
- 랜선아미안해
- 개미수열
- etag
- 코드스피츠
- jsr303
- LastModified
- 스프링
- 지수반등
- Spring
- jsr380
- 브로틀리
- cross parameter
- 지뢰찾기
- 이렇게살아야되나자괴감이
- 리얼월드HTTP
- brotli
- HTTP
Archives
- Today
- Total
취미개발 블로그와 마음수양
자바 JEditorPane을 이용한 기초 브라우저..(그냥..읽기만하는;;) 본문
아주 열악한 환경의 브라우저 (?) ㅋㅋㅋ
책들에는 보통 잘 안나와잇는데..외국 사이트에서 조금씩 퍼옴 ㅋㅋ
package 챕25네트웤; import java.awt.*; import java.awt.event.*; import java.io.*; import javax.swing.*; class MyFrame extends JFrame implements ActionListener { JButton button; JTextField tf; JEditorPane jep; public MyFrame(){ //스크롤 패널에 들어갈 내용들 jep = new JEditorPane(); jep.setEditable(false); try { jep.setPage("http://www.google.com/"); }catch (IOException e) { jep.setContentType("text/html"); jep.setText("Could not load http://www.google.com/ "); } tf = new JTextField(50); button = new JButton("이동"); button.addActionListener(this); //패널 생성 JScrollPane scrollPane = new JScrollPane(jep); JPanel panel = new JPanel(); panel.add(tf); panel.add(button); //프레임 생성 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); add(panel, BorderLayout.NORTH); add(scrollPane); setSize(1024, 768); setVisible(true); } @Override public void actionPerformed(ActionEvent e) { if(e.getSource()==button){ try { jep.setPage(tf.getText()); } catch (IOException e1) { jep.setContentType("text/html"); jep.setText("Could not load http://www.google.com/ "); } } } } public class Quest01 { public static void main(String[] args) { new MyFrame(); } }
'Language > java소스' 카테고리의 다른 글
자바 파일 전송 간단하게 해보기 (0) | 2014.04.19 |
---|---|
자바 1:1 GUI 채팅 프로그램.. (1) | 2014.04.19 |
자바 채팅 기초 - 콘솔 채팅 (0) | 2014.04.18 |
자바 행맨 (0) | 2014.04.18 |
자바 문자열 비교 프로그램 (0) | 2014.04.18 |