一个简单的记事本代码(三) - 编程入门网
作者 佚名技术
来源 NET编程
浏览
发布时间 2012-06-21
ist1, null);
contentPane.add(jButton1, null);
contentPane.add(jButton2, null);
contentPane.add(jList3, null);
contentPane.add(jList2, null);
contentPane.add(jTextField4, null);
contentPane.add(jTextField3, null);
contentPane.add(jTextField2, null);
contentPane.add(jTextField1, null);
jComboBox1.addItem("西方");
jComboBox1.addItem("华文");
Button1Listener fok=new Button1Listener();
jButton1.addActionListener(fok);
Button2Listener fon=new Button2Listener();
jButton2.addActionListener(fon);
MouseListener mouseListener1 = new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 1) {
index = jList1.locationToIndex(e.getPoint());
jList1.setSelectedIndex(index);
jTextField2.setText(jList1.getSelectedValue().toString());
ziti=jTextField2.getText();
}
}
};
MouseListener mouseListener2 = new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 1) {
index = jList2.locationToIndex(e.getPoint());
jList2.setSelectedIndex(index);
String zip=jList2.getSelectedValue().toString();
jTextField3.setText(zip);
if(zip.compareTo("常规")==0){
zixing=Font.PLAIN;
}
else if(zip.compareTo("斜体")==0){
zixing=Font.ITALIC;
}
else if(zip.compareTo("粗体")==0){
zixing=Font.BOLD;
}
// jTextField2.setFont(new Font(ziti, zixing, daxiao));
}
}
};
MouseListener mouseListener3 = new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 1) {
index = jList3.locationToIndex(e.getPoint());
jList3.setSelectedIndex(index);
jTextField4.setText(jList3.getSelectedValue().toString());
daxiao=Integer.parseInt(jTextField4.getText());
// jTextField2.setFont(new Font(ziti, zixing, daxiao));
}
}
};
jList1.addMouseListener(mouseListener1);
jList2.addMouseListener(mouseListener2);
jList3.addMouseListener(mouseListener3);
show();
}
void sfont(){
// String ziti=jTextField2.getText();
// int daxiao=Integer.parseInt(jTextField4.getText());
jTextArea1.setDragEnabled(true);
jTextArea1.setFont(new Font(ziti, zixing, daxiao));
}
class Button1Listener implements ActionListener {
public void actionPerformed(ActionEvent e){
sfont();
//有问题 si
// hide();
}
}
class Button2Listener implements ActionListener {
public void actionPerformed(ActionEvent e){
hide();
}
}
public void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if(e.getID() == WindowEvent.WINDOW_CLOSED) {
System.exit(0);
}
}
}
} |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于一个简单的记事本代码(三) - 编程入门网的所有评论