📄 bean1.java
字号:
package mybean;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Date;
import javax.swing.*;
import com.borland.jbcl.layout.XYConstraints;
import com.borland.jbcl.layout.XYLayout;
public class Bean1 extends JPanel {
XYLayout xYLayout1 = new XYLayout();
JLabel jLabel1 = new JLabel();
JButton jButton1 = new JButton();
private Color fontColor;
Bean1 bean11 = new Bean1();
public Bean1() {
try {
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
private void jbInit() throws Exception {
setLayout(xYLayout1);
this.setBorder(BorderFactory.createEtchedBorder());
jLabel1.setBorder(BorderFactory.createEtchedBorder());
jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
jLabel1.setText("现在的时间是:");
jButton1.setText("显示");
jButton1.addActionListener(new Bean1_jButton1_actionAdapter(this));
this.add(jLabel1, new XYConstraints(12, 18, 278, 27));
this.add(jButton1, new XYConstraints(302, 19, 84, 27));
}
public void jButton1_actionPerformed(ActionEvent e) {
Date now=new Date();
jLabel1.setText("现在的时间是:"+now.toString());
}
public void setFontColor(Color fontColor) {
jLabel1.setForeground(fontColor);
this.fontColor = fontColor;
}
public Color getFontColor() {
return fontColor;
}
}
class Bean1_jButton1_actionAdapter implements ActionListener {
private Bean1 adaptee;
Bean1_jButton1_actionAdapter(Bean1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -