1.����Դ��
����Դ��
import java.awt.*;/
*** @author Hardneedl
*/
interface Brush {
void doPaint(Graphics g);
}
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
/
*** @author Hardneedl
*/
final class StringPaintDemo extends JFrame {
public String getTitle() { return "String Paint";}
static private final Dimension size = new Dimension(,画板画板抖音短视频询盘获客源码 );
public Dimension getPreferredSize() { return size;}
public Dimension getMaximumSize() { return size;}
public Dimension getMinimumSize() { return size;}
public Dimension getSize() { return size;}
private String s;
private Brush stringBrush = new Brush() {
public void doPaint(Graphics g) {
Graphics gg = g.create();
gg.setColor(Color.RED);
gg.drawString(s == null ? "null" : s , , );
gg.dispose();
}
};
private JTextField txtField;
private JComponent canvas = new JComponent(){
protected void paintComponent(Graphics g) {
super.paintComponent(g);
stringBrush.doPaint(g);
}
};
private StringPaintDemo() throws HeadlessException {
init();
attachListeners();
doLay();
}
private void init() {
txtField = new JTextField();
}
private void attachListeners() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
txtField.getDocument().addDocumentListener(new DocumentListener(){
private void update(){
s = txtField.getText();
canvas.paintImmediately(canvas.getBounds());
}
public void changedUpdate(DocumentEvent e) { update();}
public void insertUpdate(DocumentEvent e) { update();}
public void removeUpdate(DocumentEvent e) { update();}
});
}
private void doLay() {
Container container = getContentPane();
container.add(txtField,BorderLayout.NORTH);
container.add(canvas, BorderLayout.CENTER);
pack();
setVisible(true);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new StringPaintDemo();
}
});
}
}
2025-01-31 02:111313人浏览
2025-01-31 00:372481人浏览
2025-01-31 00:321896人浏览
2025-01-31 00:262202人浏览
2025-01-31 00:161232人浏览
2025-01-31 00:051829人浏览
项目数量和投资总额均全省居首海峡网6月22日讯 泉州网记者林书修 通讯员庄慧滢)第十六届中国·海峡项目成果交易会以下简称“6·18”)昨天落幕,泉州
1.注解@Autowired和@Resource的区别总结2.VSCode For Web 深入浅出 -- 依赖注入设计3.请高手通俗解释一下依赖注入4.spring源码解析bean初始化与依赖注入四