⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nwfontchoosers.java

📁 java实现的画板程序
💻 JAVA
字号:
package drawpane;import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.event.*;import java.math.*;import java.awt.image.BufferedImage;//瀛椾綋閫夋嫨public class NwFontChooserS extends JDialog{  String[] styleList = new String[] {      "Plain", "Bold", "Italic"};  String[] sizeList = new String[] {      "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15",      "16", "17",      "18", "19", "20", "22", "24", "27", "30", "34", "39", "45", "51", "60"};  NwList StyleList;  NwList FontList;  NwList SizeList;  static JLabel Sample = new JLabel();  boolean ob = false;  private NwFontChooserS(Frame parent, boolean modal, Font font) {    super(parent, modal);    initAll();    setTitle("閫夋嫨瀛椾綋");    if (font == null) font = Sample.getFont();    FontList.setSelectedItem(font.getName());    SizeList.setSelectedItem(font.getSize() + "");    StyleList.setSelectedItem(styleList[font.getStyle()]);  }  public static Font showDialog(Frame parent, String s, Font font) {    NwFontChooserS fd = new NwFontChooserS(parent, true, font);    if (s != null) fd.setTitle(s);    fd.setVisible(true);    Font fo = font;    if (fd.ob) fo = Sample.getFont();    fd.dispose();    return (fo);  }  private void initAll() {    getContentPane().setLayout(null);    setBounds(50, 50, 425, 405);    addLists();    addButtons();    Sample.setBounds(10, 320, 415, 25);    Sample.setForeground(Color.black);    getContentPane().add(Sample);    addWindowListener(new WindowAdapter() {      public void windowClosing(java.awt.event.WindowEvent e) {        setVisible(false);      }    });  }  private void addLists() {    FontList = new NwList(GraphicsEnvironment.getLocalGraphicsEnvironment                          ().getAvailableFontFamilyNames());    StyleList = new NwList(styleList);    SizeList = new NwList(sizeList);    FontList.setBounds(10, 10, 260, 295);    StyleList.setBounds(280, 10, 80, 295);    SizeList.setBounds(370, 10, 40, 295);    getContentPane().add(FontList);    getContentPane().add(StyleList);    getContentPane().add(SizeList);  }  private void addButtons() {    JButton ok = new JButton("纭

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -