📄 application1.java~10~
字号:
package texteditor;
import java.awt.*;
import javax.swing.*;
/**
* <p>Title: 文本编辑器</p>
* <p>Description: 本软件为面向对象程序设计期末作业,不得擅自修改</p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: 边缘开发室</p>
* @author 第三组 ,组长:谭XX
* @version 1.0
*/
public class Application1
{
boolean packFrame = false;
static MainFrame frame;
/**
* Construct and show the application.
*/
public Application1()
{
frame = new MainFrame();
// 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);
try
{
jbInit();
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
/**
* Application entry point.
*
* @param args String[]
*/
public static void main(String[] args)
{
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
int uiFontSize = 12;
try
{
/*UIManager.setLookAndFeel(UIManager.
getSystemLookAndFeelClassName());*/
//UIManager.setLookAndFeel("src/lib/borland");
//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();
}
});
}
private void jbInit() throws Exception
{
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -