?? frame1.java~1~
字號:
import javax.swing.*;
import javax.swing.text.*;
import java.awt.*;
import java.awt.event.*;
public class Frame1 extends JFrame implements ActionListener{
JTextPane privateChat=new JTextPane();
JButton button;
public Frame1() {
button=new JButton("ok");
button.addActionListener(this);
this.getContentPane().add(button,BorderLayout.NORTH);
this.getContentPane().add(privateChat,BorderLayout.CENTER);
}
public void actionPerformed(ActionEvent e){
if(e.getSource()==button){
JButton jbutton=new JButton("確定");
try{
StyledDocument doc = privateChat.getStyledDocument();
//Styles.addStylesToDocument(doc, jbutton);
doc.insertString(doc.getLength()," 他們的故事",doc.getStyle("bold"));
// doc.insertString(doc.getLength()," ", doc.getStyle("jpanel"));
//privateChat.validate();
//System.out.println("dao le ");
privateChat.setEditable(false);
}catch(Exception e2){
}
}
}
public static void main(String[] args){
Frame1 frame=new Frame1();
frame.setVisible(true);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -