Java基础之扩展GUI——使用字体对话框(Sketcher 5 displaying a font dialog)
控制台程序。
为了可以选择系统支持的字体,我们定义了一个FontDialog类:
// Class to define a dialog to choose a font
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;
import static Constants.SketcherConstants.*; @SuppressWarnings("serial")
class FontDialog extends JDialog
implements ActionListener, // For buttons etc.
ListSelectionListener, // For list box
ChangeListener { // For the spinner
// Constructor
public FontDialog(SketcherFrame window) {
// Call the base constructor to create a modal dialog
super(window, "Font Selection", true);
font = window.getFont(); // Get the current font // Create the dialog button panel
JPanel buttonPane = new JPanel(); // Create a panel to hold buttons // Create and add the buttons to the buttonPane
buttonPane.add(ok = createButton("OK")); // Add the OK button
buttonPane.add(cancel = createButton("Cancel")); // Add the Cancel button
getContentPane().add(buttonPane, BorderLayout.SOUTH); // Add pane // Code to create the data input panel
JPanel dataPane = new JPanel(); // Create the data entry panel
dataPane.setBorder(BorderFactory.createCompoundBorder( // Pane border
BorderFactory.createLineBorder(Color.BLACK),
BorderFactory.createEmptyBorder(5, 5, 5, 5)));
GridBagLayout gbLayout = new GridBagLayout(); // Create the layout
dataPane.setLayout(gbLayout); // Set the pane layout
GridBagConstraints constraints = new GridBagConstraints(); // Create the font choice and add it to the input panel
JLabel label = new JLabel("Choose a Font");
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.gridwidth = GridBagConstraints.REMAINDER;
gbLayout.setConstraints(label, constraints);
dataPane.add(label); // Code to set up font list choice component
GraphicsEnvironment e = GraphicsEnvironment.getLocalGraphicsEnvironment();
String[] fontNames = e.getAvailableFontFamilyNames(); // Get font names fontList = new JList<>(fontNames); // Create list of font names
fontList.setValueIsAdjusting(true); // single event selection
fontList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
fontList.setSelectedValue(font.getFontName(),true);
fontList.addListSelectionListener(this);
fontList.setToolTipText("Choose a font");
JScrollPane chooseFont = new JScrollPane(fontList); // Scrollable list
chooseFont.setMinimumSize(new Dimension(400,100));
chooseFont.setWheelScrollingEnabled(true); // Enable mouse wheel scroll // Panel to display font sample
JPanel display = new JPanel(true);
fontDisplay = new JLabel("Sample Size: x X y Y z Z");
fontDisplay.setFont(font);
fontDisplay.setPreferredSize(new Dimension(350,100));
display.add(fontDisplay); //Create a split pane with font choice at the top and font display at the bottom
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
true,
chooseFont,
display);
gbLayout.setConstraints(splitPane, constraints); // Split pane constraints
dataPane.add(splitPane); // Add to the data pane // Set up the size choice using a spinner
JPanel sizePane = new JPanel(true); // Pane for size choices
label = new JLabel("Choose point size: "); // Prompt for point size
sizePane.add(label); // Add the prompt chooseSize = new JSpinner(new SpinnerNumberModel(font.getSize(),
POINT_SIZE_MIN, POINT_SIZE_MAX, POINT_SIZE_STEP));
chooseSize.setValue(font.getSize()); // Set current font size
chooseSize.addChangeListener(this);
sizePane.add(chooseSize); // Add spinner to pane
gbLayout.setConstraints(sizePane, constraints); // Set pane constraints
dataPane.add(sizePane); // Add the pane // Set up style options using radio buttons
bold = new JRadioButton("Bold", (font.getStyle() & Font.BOLD) > 0);
italic = new JRadioButton("Italic", (font.getStyle() & Font.ITALIC) > 0);
bold.addItemListener(new StyleListener(Font.BOLD)); // Add button listeners
italic.addItemListener(new StyleListener(Font.ITALIC));
JPanel stylePane = new JPanel(true); // Create style pane
stylePane.add(bold); // Add buttons
stylePane.add(italic); // to style pane...
gbLayout.setConstraints(stylePane, constraints); // Set pane constraints
dataPane.add(stylePane); // Add the pane getContentPane().add(dataPane, BorderLayout.CENTER);
pack();
setVisible(false);
} // Create a dialog button
JButton createButton(String label) {
JButton button = new JButton(label); // Create the button
button.setPreferredSize(new Dimension(80,20)); // Set the size
button.addActionListener(this); // Listener is the dialog
return button; // Return the button
} // Handler for button events
public void actionPerformed(ActionEvent e) {
if(e.getSource()== ok) { // If it's the OK button
((SketcherFrame)getOwner()).setFont(font); // ...set selected font
} else {
font = ((SketcherFrame)getOwner()).getFont(); // Restore the current font
fontDisplay.setFont(font);
chooseSize.setValue(font.getSize()); // Restore the point size
fontList.setSelectedValue(font.getName(),true);
int style = font.getStyle();
bold.setSelected((style & Font.BOLD) > 0); // Restore the
italic.setSelected((style & Font.ITALIC) > 0); // style options
}
// Now hide the dialog - for ok or cancel
setVisible(false);
} // List selection listener method
public void valueChanged(ListSelectionEvent e) {
if(!e.getValueIsAdjusting()) {
font = new Font(fontList.getSelectedValue(), font.getStyle(), font.getSize());
fontDisplay.setFont(font);
fontDisplay.repaint();
}
} // Handle spinner state change events
public void stateChanged(ChangeEvent e) {
int fontSize = ((Number)(((JSpinner)e.getSource()).getValue())).intValue();
font = font.deriveFont((float)fontSize);
fontDisplay.setFont(font);
fontDisplay.repaint();
} // Iner class defining listeners for radio buttons
class StyleListener implements ItemListener {
public StyleListener(int style) {
this.style = style;
} // Event handler for font style changes
public void itemStateChanged(ItemEvent e) {
int fontStyle = font.getStyle();
if(e.getStateChange()==ItemEvent.SELECTED) { // If style was selected
fontStyle |= style; // turn it on in the font style
} else {
fontStyle &= ~style; // otherwise turn it off
}
font = font.deriveFont(fontStyle); // Get a new font
fontDisplay.setFont(font); // Change the label font
fontDisplay.repaint(); // repaint
}
private int style; // Style for this listener
} private JList<String> fontList; // Font list
private JButton ok; // OK button
private JButton cancel; // Cancel button
private JRadioButton bold; // Bold style button
private JRadioButton italic; // Italic style button
private Font font; // Currently selected font
private JSpinner chooseSize; // Font size options
private JLabel fontDisplay; // Font sample
}
然后在SketcherFrame中添加选择字体的菜单项:
// Frame for the Sketcher application
import javax.swing.*;
import javax.swing.border.*;
import java.awt.event.*;
import java.awt.*; import static java.awt.event.InputEvent.*;
import static java.awt.Color.*;
import static Constants.SketcherConstants.*;
import static javax.swing.Action.*; @SuppressWarnings("serial")
public class SketcherFrame extends JFrame implements ActionListener {
// Constructor
public SketcherFrame(String title, Sketcher theApp) {
setTitle(title); // Set the window title
this.theApp = theApp; // Save app. object reference
setJMenuBar(menuBar); // Add the menu bar to the window
setDefaultCloseOperation(EXIT_ON_CLOSE); // Default is exit the application createFileMenu(); // Create the File menu
createElementMenu(); // Create the element menu
createColorMenu(); // Create the element menu
JMenu optionsMenu = new JMenu("Options"); // Create options menu
optionsMenu.setMnemonic('O'); // Create shortcut
menuBar.add(optionsMenu); // Add options to menu bar createPopupMenu(); // Create popup // Add the font choice item to the options menu
fontItem = new JMenuItem("Choose font...");
fontItem.addActionListener(this);
optionsMenu.add(fontItem); fontDlg = new FontDialog(this); // Create the font dialog createToolbar();
toolBar.setRollover(true); JMenu helpMenu = new JMenu("Help"); // Create Help menu
helpMenu.setMnemonic('H'); // Create Help shortcut // Add the About item to the Help menu
aboutItem = new JMenuItem("About"); // Create About menu item
aboutItem.addActionListener(this); // Listener is the frame
helpMenu.add(aboutItem); // Add item to menu
menuBar.add(helpMenu); // Add Help menu to menu bar getContentPane().add(toolBar, BorderLayout.NORTH); // Add the toolbar
getContentPane().add(statusBar, BorderLayout.SOUTH); // Add the statusbar
} // Create File menu item actions
private void createFileMenuActions() {
newAction = new FileAction("New", 'N', CTRL_DOWN_MASK);
openAction = new FileAction("Open", 'O', CTRL_DOWN_MASK);
closeAction = new FileAction("Close");
saveAction = new FileAction("Save", 'S', CTRL_DOWN_MASK);
saveAsAction = new FileAction("Save As...");
printAction = new FileAction("Print", 'P', CTRL_DOWN_MASK);
exitAction = new FileAction("Exit", 'X', CTRL_DOWN_MASK); // Initialize the array
FileAction[] actions = {openAction, closeAction, saveAction, saveAsAction, printAction, exitAction};
fileActions = actions; // Add toolbar icons
newAction.putValue(LARGE_ICON_KEY, NEW24);
openAction.putValue(LARGE_ICON_KEY, OPEN24);
saveAction.putValue(LARGE_ICON_KEY, SAVE24);
saveAsAction.putValue(LARGE_ICON_KEY, SAVEAS24);
printAction.putValue(LARGE_ICON_KEY, PRINT24); // Add menu item icons
newAction.putValue(SMALL_ICON, NEW16);
openAction.putValue(SMALL_ICON, OPEN16);
saveAction.putValue(SMALL_ICON, SAVE16);
saveAsAction.putValue(SMALL_ICON,SAVEAS16);
printAction.putValue(SMALL_ICON, PRINT16); // Add tooltip text
newAction.putValue(SHORT_DESCRIPTION, "Create a new sketch");
openAction.putValue(SHORT_DESCRIPTION, "Read a sketch from a file");
closeAction.putValue(SHORT_DESCRIPTION, "Close the current sketch");
saveAction.putValue(SHORT_DESCRIPTION, "Save the current sketch to file");
saveAsAction.putValue(SHORT_DESCRIPTION, "Save the current sketch to a new file");
printAction.putValue(SHORT_DESCRIPTION, "Print the current sketch");
exitAction.putValue(SHORT_DESCRIPTION, "Exit Sketcher");
} // Create the File menu
private void createFileMenu() {
JMenu fileMenu = new JMenu("File"); // Create File menu
fileMenu.setMnemonic('F'); // Create shortcut
createFileMenuActions(); // Create Actions for File menu item // Construct the file drop-down menu
fileMenu.add(newAction); // New Sketch menu item
fileMenu.add(openAction); // Open sketch menu item
fileMenu.add(closeAction); // Close sketch menu item
fileMenu.addSeparator(); // Add separator
fileMenu.add(saveAction); // Save sketch to file
fileMenu.add(saveAsAction); // Save As menu item
fileMenu.addSeparator(); // Add separator
fileMenu.add(printAction); // Print sketch menu item
fileMenu.addSeparator(); // Add separator
fileMenu.add(exitAction); // Print sketch menu item
menuBar.add(fileMenu); // Add the file menu
} // Create Element menu actions
private void createElementTypeActions() {
lineAction = new TypeAction("Line", LINE, 'L', CTRL_DOWN_MASK);
rectangleAction = new TypeAction("Rectangle", RECTANGLE, 'R', CTRL_DOWN_MASK);
circleAction = new TypeAction("Circle", CIRCLE,'C', CTRL_DOWN_MASK);
curveAction = new TypeAction("Curve", CURVE,'U', CTRL_DOWN_MASK);
textAction = new TypeAction("Text", TEXT,'T', CTRL_DOWN_MASK); // Initialize the array
TypeAction[] actions = {lineAction, rectangleAction, circleAction, curveAction, textAction};
typeActions = actions; // Add toolbar icons
lineAction.putValue(LARGE_ICON_KEY, LINE24);
rectangleAction.putValue(LARGE_ICON_KEY, RECTANGLE24);
circleAction.putValue(LARGE_ICON_KEY, CIRCLE24);
curveAction.putValue(LARGE_ICON_KEY, CURVE24);
textAction.putValue(LARGE_ICON_KEY, TEXT24); // Add menu item icons
lineAction.putValue(SMALL_ICON, LINE16);
rectangleAction.putValue(SMALL_ICON, RECTANGLE16);
circleAction.putValue(SMALL_ICON, CIRCLE16);
curveAction.putValue(SMALL_ICON, CURVE16);
textAction.putValue(SMALL_ICON, TEXT16); // Add tooltip text
lineAction.putValue(SHORT_DESCRIPTION, "Draw lines");
rectangleAction.putValue(SHORT_DESCRIPTION, "Draw rectangles");
circleAction.putValue(SHORT_DESCRIPTION, "Draw circles");
curveAction.putValue(SHORT_DESCRIPTION, "Draw curves");
textAction.putValue(SHORT_DESCRIPTION, "Draw text");
} // Create the Elements menu
private void createElementMenu() {
createElementTypeActions();
elementMenu = new JMenu("Elements"); // Create Elements menu
elementMenu.setMnemonic('E'); // Create shortcut
createRadioButtonDropDown(elementMenu, typeActions, lineAction);
menuBar.add(elementMenu); // Add the element menu
} // Create Color menu actions
private void createElementColorActions() {
redAction = new ColorAction("Red", RED, 'R', CTRL_DOWN_MASK|ALT_DOWN_MASK);
yellowAction = new ColorAction("Yellow", YELLOW, 'Y', CTRL_DOWN_MASK|ALT_DOWN_MASK);
greenAction = new ColorAction("Green", GREEN, 'G', CTRL_DOWN_MASK|ALT_DOWN_MASK);
blueAction = new ColorAction("Blue", BLUE, 'B', CTRL_DOWN_MASK|ALT_DOWN_MASK); // Initialize the array
ColorAction[] actions = {redAction, greenAction, blueAction, yellowAction};
colorActions = actions; // Add toolbar icons
redAction.putValue(LARGE_ICON_KEY, RED24);
greenAction.putValue(LARGE_ICON_KEY, GREEN24);
blueAction.putValue(LARGE_ICON_KEY, BLUE24);
yellowAction.putValue(LARGE_ICON_KEY, YELLOW24); // Add menu item icons
redAction.putValue(SMALL_ICON, RED16);
greenAction.putValue(SMALL_ICON, GREEN16);
blueAction.putValue(SMALL_ICON, BLUE16);
yellowAction.putValue(SMALL_ICON, YELLOW16); // Add tooltip text
redAction.putValue(SHORT_DESCRIPTION, "Draw in red");
greenAction.putValue(SHORT_DESCRIPTION, "Draw in green");
blueAction.putValue(SHORT_DESCRIPTION, "Draw in blue");
yellowAction.putValue(SHORT_DESCRIPTION, "Draw in yellow");
} // Create the Color menu
private void createColorMenu() {
createElementColorActions();
colorMenu = new JMenu("Color"); // Create Elements menu
colorMenu.setMnemonic('C'); // Create shortcut
createRadioButtonDropDown(colorMenu, colorActions, blueAction);
menuBar.add(colorMenu); // Add the color menu
} // Menu creation helper
private void createRadioButtonDropDown(JMenu menu, Action[] actions, Action selected) {
ButtonGroup group = new ButtonGroup();
JRadioButtonMenuItem item = null;
for(Action action : actions) {
group.add(menu.add(item = new JRadioButtonMenuItem(action)));
if(action == selected) {
item.setSelected(true); // This is default selected
}
}
} // Create pop-up menu
private void createPopupMenu() {
// Element menu items
popup.add(new JMenuItem(lineAction));
popup.add(new JMenuItem(rectangleAction));
popup.add(new JMenuItem(circleAction));
popup.add(new JMenuItem(curveAction));
popup.add(new JMenuItem(textAction)); popup.addSeparator(); // Color menu items
popup.add(new JMenuItem(redAction));
popup.add(new JMenuItem(yellowAction));
popup.add(new JMenuItem(greenAction));
popup.add(new JMenuItem(blueAction));
} // Create toolbar buttons on the toolbar
private void createToolbar() {
for(FileAction action: fileActions){
if(action != exitAction && action != closeAction)
addToolbarButton(action); // Add the toolbar button
}
toolBar.addSeparator(); // Create Color menu buttons
for(ColorAction action:colorActions){
addToolbarButton(action); // Add the toolbar button
} toolBar.addSeparator(); // Create Elements menu buttons
for(TypeAction action:typeActions){
addToolbarButton(action); // Add the toolbar button
}
} // Create and add a toolbar button
private void addToolbarButton(Action action) {
JButton button = new JButton(action); // Create from Action
button.setBorder(BorderFactory.createCompoundBorder( // Add button border
new EmptyBorder(2,5,5,2), // Outside border
BorderFactory.createRaisedBevelBorder())); // Inside border
button.setHideActionText(true); // No label on the button
toolBar.add(button); // Add the toolbar button
} // Return the current drawing color
public Color getElementColor() {
return elementColor;
} // Return the current element type
public int getElementType() {
return elementType;
} // Return current text font
public Font getFont() {
return textFont;
} // Method to set the current font
public void setFont(Font font) {
textFont = font;
} // Retrieve the pop-up menu
public JPopupMenu getPopup() {
return popup;
} // Set radio button menu checks
private void setChecks(JMenu menu, Object eventSource) {
if(eventSource instanceof JButton){
JButton button = (JButton)eventSource;
Action action = button.getAction();
for(int i = 0 ; i<menu.getItemCount() ; ++i) {
JMenuItem item = menu.getItem(i);
item.setSelected(item.getAction() == action);
}
}
} // Handle About menu events
public void actionPerformed(ActionEvent e) {
if(e.getSource() == aboutItem) {
// Create about dialog with the app window as parent
JOptionPane.showMessageDialog(this, // Parent
"Sketcher Copyright Ivor Horton 2011", // Message
"About Sketcher", // Title
JOptionPane.INFORMATION_MESSAGE); // Message type
} else if(e.getSource() == fontItem) { // Set the dialog window position
fontDlg.setLocationRelativeTo(this);
fontDlg.setVisible(true); // Show the dialog
}
} // Inner class defining Action objects for File menu items
class FileAction extends AbstractAction {
// Create action with a name
FileAction(String name) {
super(name);
} // Create action with a name and accelerator
FileAction(String name, char ch, int modifiers) {
super(name);
putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(ch, modifiers)); // Now find the character to underline
int index = name.toUpperCase().indexOf(ch);
if(index != -1) {
putValue(DISPLAYED_MNEMONIC_INDEX_KEY, index);
}
} // Event handler
public void actionPerformed(ActionEvent e) {
// You will add action code here eventually...
}
} // Inner class defining Action objects for Element type menu items
class TypeAction extends AbstractAction {
// Create action with just a name property
TypeAction(String name, int typeID) {
super(name);
this.typeID = typeID;
} // Create action with a name and an accelerator
private TypeAction(String name,int typeID, char ch, int modifiers) {
this(name, typeID);
putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(ch, modifiers)); // Now find the character to underline
int index = name.toUpperCase().indexOf(ch);
if(index != -1) {
putValue(DISPLAYED_MNEMONIC_INDEX_KEY, index);
}
} public void actionPerformed(ActionEvent e) {
elementType = typeID;
setChecks(elementMenu, e.getSource());
statusBar.setTypePane(typeID);
} private int typeID;
} // Handles color menu items
class ColorAction extends AbstractAction {
// Create an action with a name and a color
public ColorAction(String name, Color color) {
super(name);
this.color = color;
} // Create an action with a name, a color, and an accelerator
public ColorAction(String name, Color color, char ch, int modifiers) {
this(name, color);
putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(ch, modifiers)); // Now find the character to underline
int index = name.toUpperCase().indexOf(ch);
if(index != -1) {
putValue(DISPLAYED_MNEMONIC_INDEX_KEY, index);
}
} public void actionPerformed(ActionEvent e) {
elementColor = color;
setChecks(colorMenu, e.getSource());
statusBar.setColorPane(color);
} private Color color;
} // File actions
private FileAction newAction, openAction, closeAction, saveAction, saveAsAction, printAction, exitAction;
private FileAction[] fileActions; // File actions as an array // Element type actions
private TypeAction lineAction, rectangleAction, circleAction, curveAction, textAction;
private TypeAction[] typeActions; // Type actions as an array // Element color actions
private ColorAction redAction, yellowAction,greenAction, blueAction;
private ColorAction[] colorActions; // Color actions as an array private JMenuBar menuBar = new JMenuBar(); // Window menu bar
private JMenu elementMenu; // Elements menu
private JMenu colorMenu; // Color menu
private JMenu optionsMenu; // Options menu private StatusBar statusBar = new StatusBar(); // Window status bar
private FontDialog fontDlg; // The font dialog private JMenuItem aboutItem; // About menu item
private JMenuItem fontItem; // Font chooser menu item private JPopupMenu popup = new JPopupMenu("General"); // Window pop-up
private Color elementColor = DEFAULT_ELEMENT_COLOR; // Current element color
private int elementType = DEFAULT_ELEMENT_TYPE; // Current element type
private Font textFont = DEFAULT_FONT; // Default font for text elements
private JToolBar toolBar = new JToolBar(); // Window toolbar
private Sketcher theApp; // The application object
}
Java基础之扩展GUI——使用字体对话框(Sketcher 5 displaying a font dialog)的更多相关文章
- Java基础之扩展GUI——显示About对话框(Sketcher 2 displaying an About dialog)
控制台程序. 最简单的对话框仅仅显示一些信息.为了说明这一点,可以为Sketcher添加Help菜单项和About菜单项,之后再显示About对话框来提供有关应用程序的信息. 要新建的对话框类从JDi ...
- Java基础之扩展GUI——添加状态栏(Sketcher 1 with a status bar)
控制台程序. 为了显示各个应用程序参数的状态,并且将各个参数显示在各自的面板中,在应用程序窗口的底部添加状态栏是常见且非常方便的方式. 定义状态栏时没有Swing类可用,所以必须自己建立StatusB ...
- Java基础之扩展GUI——高亮元素、上下文菜单、移动旋转元素、自定义颜色(Sketcher 10)
窗口应用程序. 本例在上一版的基础上实现了高亮元素.移动元素.上下文菜单.旋转元素.设置自定义颜色. 1.自定义常量包: // Defines application wide constants p ...
- Java基础之扩展GUI——使用对话框创建文本元素(Sketcher 4 creating text elements)
控制台程序. 为了与Sketcher中的其他元素类型保持一致,需要为Elements菜单添加Text菜单项和工具栏按钮.还需要定义用来表示文本元素的类Element.Text. 1.修改Sketche ...
- Java基础--Java---IO流------GUI(布局)、Frame、事件监听机制、窗体事件、Action事件、鼠标事件、对话框Dialog、键盘事件、菜单
* 创建图形化界面 * 1.创建frame窗体 * 2.对窗体进行基本设置 * 比如大小.位置.布局 * 3.定义组件 * 4.将组件通过窗体的add方法添加到窗体 * 5.让窗体显 ...
- java基础学习总结——GUI编程(一)
一.AWT介绍
- java基础学习总结——GUI编程(一) 还未仔细阅读
一.AWT介绍
- 【Java基础总结】GUI
GUI(Graphical User Interface),图形用户接口 CLI(Command Line User Interface),命令行用户接口 1. 容器 Container GUI主要位 ...
- java基础学习总结——GUI编程(二)
一.事件监听
随机推荐
- background常用属性
background-image:url('图片位置');//设置背景图片的位置 background-repeat:no-repeat;//图片是否重复显示(不重复) background-posi ...
- 硬盘分区工具gparted使用
一.介绍 GParted是一款linux下的功能非常强大的分区工具,和windows下的‘分区魔术师’类似,操作和显示上也很相似.GParted可以方便的创建.删除分区,也可以调整分区的大小和移动分区 ...
- LaTeX算法排版
需要包含的 \usepackage[noend]{algpseudocode} \usepackage{algorithmicx,algorithm} 源码 \begin{algorithm}[t]\ ...
- 高德地图 室内地图 API 的一些坑
开发指南 http://lbs.amap.com/api/javascript-api/guide/create-map/indoormap/ demo 大全: http://lbs.amap.com ...
- Unity3d优化
检测方式: 一,Unity3D 渲染统计窗口 Game视窗的Stats去查看渲染统计的信息: 1.FPS fps其实就是 frames per second,也就是每一秒游戏执行的帧数,这个数值越小, ...
- stdout( 标准输出流)和 stderr( 标准输入流) 重定向问题
我想把提示信息和错误信息列表都写入到同一个文件里, /* ** 设置流, 使输出与错误流都指向指定的文件 */ if( (output1 = freopen( PATH, "a", ...
- Ubuntu下VIM的安装及其配置——Linux篇
一.Ubuntu系统默认内置: 实际上ubuntu默认没有安装老版本的vi,只装了vim.vi是vim.tiny(vim的最小化版本,不含 GUI,并且仅含有一小部分功能,并且默认与vi兼容.此软件包 ...
- IOS第十天(1:QQ好友列表 ,自定义的headview,代理 ,通知 ,black的使用)
*****HMViewController.m #import "HMViewController.h" #import "HMFriendsGroupModel.h&q ...
- 【应用笔记】【AN004】VB环境下基于RS-485的4-20mA电流采集
版本:第一版作者:周新稳 杨帅 日期:20160226 =========================== 本资料高清PDF 下载: http://pan.baidu.com/s/1c1uuhLQ ...
- [办公自动化]一次制作、多场合多次使用的PPT
面试或汇报总结时,你可能需要制作一份PPT来介绍自己.但是这些场合你不一定能讲完所有的内容. 你可以尝试分1分钟.3分钟.5分钟.10分钟的版本来准备. 使用同一份PPT. 没错. 在office20 ...