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

📄 application1.java

📁 我用java写的词法分析器
💻 JAVA
字号:
package 编译技术;import java.awt.*;import javax.swing.*;/** * <p>Title: </p> * <p>Description: 词法分析</p> * <p>Copyright: Copyright (c) 2004</p> * <p>Company: 边缘开发室</p> * @author 谭正辉 * @version 1.0 */public class Application1{  boolean packFrame = false;  //Construct the application  public Application1()  {    Frame1 frame = new Frame1();    //Validate frames that have preset sizes    //Pack frames that have useful preferred size info, e.g. from their layout    if (packFrame)    {      frame.pack();    }    else    {      frame.validate();    }    //Center the window    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();    Dimension frameSize = frame.getSize();    if (frameSize.height > screenSize.height)    {      frameSize.height = screenSize.height;    }    if (frameSize.width > screenSize.width)    {      frameSize.width = screenSize.width;    }    frame.setLocation( (screenSize.width - frameSize.width) / 2,                      (screenSize.height - frameSize.height) / 2);    frame.setVisible(true);  }  //Main method  public static void main(String[] args)  {    //设置默认字体大小为12    int uiFontSize = 13;    try    {      //UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());      //use defalt UI//设置系统默认字体      if (uiFontSize > 0)      {        java.awt.Font nbDialogPlain = new javax.swing.plaf.            FontUIResource(                "宋体", java.awt.Font.TRUETYPE_FONT,                uiFontSize); // NOI18N        java.awt.Font nbDialogBold = new javax.swing.plaf.            FontUIResource(                "宋体", java.awt.Font.BOLD, uiFontSize); // NOI18N        java.awt.Font nbSerifPlain = new javax.swing.plaf.            FontUIResource(                "宋体", java.awt.Font.TRUETYPE_FONT,                uiFontSize); // NOI18N        java.awt.Font nbSansSerifPlain = new javax.swing.plaf.            FontUIResource(                "宋体", java.awt.Font.TRUETYPE_FONT,                uiFontSize); // NOI18N        java.awt.Font nbMonospacedPlain = new javax.swing.plaf.            FontUIResource(                "宋体", java.awt.Font.TRUETYPE_FONT,                uiFontSize); // NOI18N        UIManager.getDefaults().put("Button.font",                                    nbDialogPlain); // NOI18N        UIManager.getDefaults().put("ToggleButton.font",                                    nbDialogPlain); // NOI18N        UIManager.getDefaults().put("RadioButton.font",                                    nbDialogPlain); // NOI18N        UIManager.getDefaults().put("CheckBox.font",                                    nbDialogPlain); // NOI18N        UIManager.getDefaults().put("ColorChooser.font",                                    nbDialogPlain); // NOI18N        UIManager.getDefaults().put("ComboBox.font",                                    nbDialogPlain); // NOI18N        UIManager.getDefaults().put("Label.font", nbDialogPlain); // NOI18N        UIManager.getDefaults().put("List.font", nbDialogPlain); // NOI18N        UIManager.getDefaults().put("MenuBar.font",                                    nbDialogPlain); // NOI18N        UIManager.getDefaults().put("MenuItem.font",                                    nbDialogPlain); // NOI18N        UIManager.getDefaults().put("MenuItem.acceleratorFont",                                    nbDialogPlain); // NOI18N        UIManager.getDefaults().put("RadioButtonMenuItem.font",                                    nbDialogPlain); // NOI18N        UIManager.getDefaults().put("CheckBoxMenuItem.font",                                    nbDialogPlain); // NOI18N        UIManager.getDefaults().put("Menu.font", nbDialogPlain); // NOI18N        UIManager.getDefaults().put("PopupMenu.font",                                    nbDialogPlain); // NOI18N        UIManager.getDefaults().put("OptionPane.font",                                    nbDialogPlain); // NOI18N        UIManager.getDefaults().put("Panel.font", nbDialogPlain); // NOI18N        UIManager.getDefaults().put("ProgressBar.font",                                    nbDialogPlain); // NOI18N        UIManager.getDefaults().put("ScrollPane.font",                                    nbDialogPlain); // NOI18N        UIManager.getDefaults().put("Viewport.font",                                    nbDialogPlain); // NOI18N        UIManager.getDefaults().put("TabbedPane.font",                                    nbDialogPlain); // NOI18N        UIManager.getDefaults().put("Table.font", nbDialogPlain); // NOI18N        UIManager.getDefaults().put("TableHeader.font",                                    nbDialogPlain); // NOI18N        UIManager.getDefaults().put("TextField.font",                                    nbSansSerifPlain); // NOI18N        UIManager.getDefaults().put("PasswordField.font",                                    nbMonospacedPlain); // NOI18N        UIManager.getDefaults().put("TextArea.font",                                    nbMonospacedPlain); // NOI18N        UIManager.getDefaults().put("TextPane.font",                                    nbSerifPlain); // NOI18N        UIManager.getDefaults().put("EditorPane.font",                                    nbSerifPlain); // NOI18N        UIManager.getDefaults().put("TitledBorder.font",                                    nbDialogPlain); // NOI18N        UIManager.getDefaults().put("ToolBar.font",                                    nbDialogPlain); // NOI18N        UIManager.getDefaults().put("ToolTip.font",                                    nbSansSerifPlain); // NOI18N        UIManager.getDefaults().put("Tree.font", nbDialogPlain); // NOI18N        UIManager.getDefaults().put("InternalFrame.titleFont",                                    nbDialogBold); // NOI18N        UIManager.getDefaults().put("windowTitleFont",                                    nbDialogBold); // NOI18N        UIManager.getDefaults().put("controlFont",                                    nbDialogPlain); // NOI18N      }    }    catch (Exception exception)    {      exception.printStackTrace();    }    new Application1();  }}

⌨️ 快捷键说明

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