1.ϵͳ?系统nodejs源码分析 PDF???Դ??
ϵͳ????Դ??
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();
}
});
}
}
2024-11-29 22:502947人浏览
2024-11-29 22:472385人浏览
2024-11-29 22:211325人浏览
2024-11-29 21:542013人浏览
2024-11-29 21:522270人浏览
2024-11-29 21:202555人浏览
1.如何将TS引入现有vue2项目2.宝藏插件--js to ts3.vscode下搭建Typescript编译环境4.撸个VSCode猫片插件,让写代码多一分快乐5.unibestuniapp+vu
1.为什么很多SEO外包公司都说现在的项目不好做?为什么很多SEO外包公司都说现在的项目不好做? 1.网站建设不符合优化要求。网站建设其实水很深,网站制作价格从几百到几万都有。很多都是直接JS调用
1.webpack 4 源码主流程分析十一):文件的生成2.FFmpeg源码分析: AVStream码流3.UE5在编辑器本地化上的Editor.ini文件源码解读分析4.Echarts-ZRende