📄 zdefaultui.java
字号:
/*
* put your module comment here
* formatted with JxBeauty (c) johann.langhofer@nextra.at
*/
package ezcell;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2001</p>
* <p>Company: </p>
* @author unascribed
* @version 1.0
*/
import java.util.*;
import javax.swing.*;
import java.awt.*;
import java.net.*;
/**
* put your documentation comment here
*/
public
class ZDefaultUI extends Hashtable {
// client
final static int NONE = 0;
final static int NUMBER_TEXT = 1; // 显示
final static int LETTER_TEXT = 2;
final static String LEFT_HEAD_VISIBLE = "1";
final static String LEFT_HEAD_TEXT = "2";
final static String TOP_HEAD_VISIBLE = "3";
final static String TOP_HEAD_TEXT = "4";
final static String SELECTION_VISIBLE ="5";
final static String SELECTION_BRUSH ="6";
final static String SELECTION_PEN ="7";
final static String RESIZE_BAR_PEN="8";
final static String GRID_X_VISIBLE="9";
final static String GRID_X_PEN="10";
final static String GRID_Y_VISIBLE="11";
final static String GRID_Y_PEN="12";
final static String RESIZE_BREAK="13";
final static String DEFAULT_HEAD_CELL="14";
final static String DEFAULT_COMM_CELL="15";
final static String CURSOR_DEFAULT="16";
final static String CURSOR_ROW_RESIZE="17";
final static String CURSOR_COL_RESIZE="18";
final static String CURSOR_THIN_CROSS="19";
final static String CURSOR_DRAG_READY="20";
final static String PAINTER_SHEET="21";
final static String PAINTER_HEAD_CELL="22";
final static String PAINTER_COMMON_CELL="23";
final static String PAINTER_SELECTION="24";
Object[] defaults = {
// header
this.LEFT_HEAD_VISIBLE , new Boolean(true), //1/0
this.LEFT_HEAD_TEXT, new Integer(NUMBER_TEXT), //
this.TOP_HEAD_VISIBLE , new Boolean(true), //1/0
this.TOP_HEAD_TEXT , new Integer(LETTER_TEXT), //
// selection
this.SELECTION_VISIBLE , new Boolean(true), //
this.SELECTION_BRUSH , new ZColorBrush(new Color(181, 200, 200)), //
this.SELECTION_PEN , new ZPen(2, Color.blue),
// resize pen
this.RESIZE_BAR_PEN , new ZPen(2, Color.red),
// grid
this.GRID_X_VISIBLE , new Boolean(true), //
this.GRID_X_PEN , new ZPen(1, new Color(192, 192, 192)), //
this.GRID_Y_VISIBLE , new Boolean(true), //
this.GRID_Y_PEN , new ZPen(1, new Color(192, 192, 192)),
// resize break size
this.RESIZE_BREAK , new Integer(2)
};
/**
* put your documentation comment here
*/
public ZDefaultUI () {
for (int i = 0; i < defaults.length; i = i + 2)
put(defaults[i], defaults[i + 1]);
ZDefaultCell headCell = new ZDefaultCell(null);
headCell.setBackBrush(new ZColorBrush(192, 200, 192));
headCell.setProperty(ZBase.PTY_BaseAll);
put(this.DEFAULT_HEAD_CELL , headCell);
ZDefaultCell commCell = new ZDefaultCell(null);
commCell.setProperty(ZBase.PTY_BaseAll);
put(this.DEFAULT_COMM_CELL , commCell);
put(this.CURSOR_DEFAULT , createCursors("/icons/cursor0.gif"));
put(this.CURSOR_ROW_RESIZE , Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR));
put(this.CURSOR_COL_RESIZE , Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR));
put(this.CURSOR_THIN_CROSS ,createCursors("/icons/thincross.gif"));
put(this.CURSOR_DRAG_READY ,Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
put(this.PAINTER_SHEET , new ZDefaultSheetPainter(this));
put(this.PAINTER_COMMON_CELL , new ZDefaultCellPainter(this));
put(this.PAINTER_HEAD_CELL , new ZDefaultHeadCellPainter(this));
put(this.PAINTER_SELECTION , new ZDefaultSelectionPainter(this));
}
/**
* put your documentation comment here
* @param imageFile
* @return
*/
public static Cursor createCursors (String imageFile) {
Toolkit tk = Toolkit.getDefaultToolkit();
Dimension d = tk.getBestCursorSize(32, 32);
int colors = tk.getMaximumCursorColors();
if (d.equals(new Dimension(0, 0)) || colors == 0)
return null;
Image image = null;
try {
image = tk.getImage(EZCell.class.getResource(imageFile));
}
catch (Exception ex) {
ex.printStackTrace() ;
}
if (image != null) {
try {
return tk.createCustomCursor(image, new Point(16, 16), imageFile);
} catch (Exception exc) {
System.err.println("Unable to create custom cursor.");
}
}
return null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -