jndefaultlookandfeel.java
来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 105 行
JAVA
105 行
package org.jnode.wt.components;
/**
* @author Kishore
*/
import org.jnode.wt.image.JNBufferedImage;
import org.jnode.wt.image.JNImage;
import java.awt.Color;
import java.awt.Graphics;
public class JNDefaultLookAndFeel {
public static Color BackgroundColor = new Color(207, 207, 207);
public static Color ScrollBar_BackgroundColor = new Color(180, 180, 180);
public static Color MenuGray = new Color(223, 223, 223);
public static Color JavaGray = new Color(96, 96, 96);
public static final int TOP = 1;
public static final int BOTTOM = 2;
public static final int LEFT = 3;
public static final int RIGHT = 4;
/* All these vriables are for temporary, they will be changed in soon.*/
public static final int WIN_STYLE_BUTTON = 1;
public static final int JAVA_STYLE_BUTTON = 2;
public static final int MENU_BUTTON = 3;
public static final int WIN_STYLE_MENU = 3;
public static final int JAVA_STYLE_MENU = 4;
protected static JNImage selectedDropDownImage = null;
protected static JNImage unSelectedDropDownImage = null;
/**
* JNDefaultLookAndFeel constructor comment.
*/
public JNDefaultLookAndFeel() {
super();
}
protected JNImage getSelectedDropDownImage(int w, int h) {
if (null == selectedDropDownImage) {
selectedDropDownImage = new JNBufferedImage(w, h, JNBufferedImage.TYPE_INT_RGB);
Graphics g = selectedDropDownImage.getGraphics();
g.setColor(Color.gray);
g.fillRect(0, 0, w, h);
g.setColor(Color.black);
int[] x_coordinates = new int[3];
int[] y_coordinates = new int[3];
Triangle arrow = new Triangle(w, h, Triangle.BOTTOM);
// arrow.setInsets(6,6,6,6);
// arrow.setInsets(8,8,8,8);
arrow.setInsets(4, 4, 4, 4);
Object[] xyarrs = arrow.getTriangleXYArrays();
x_coordinates = (int[]) xyarrs[0];
y_coordinates = (int[]) xyarrs[1];
g.fillPolygon(x_coordinates, y_coordinates, 3);
}
return selectedDropDownImage;
}
protected JNImage getUnSelectedDropDownImage(int w, int h) {
if (null == unSelectedDropDownImage) {
unSelectedDropDownImage = new JNBufferedImage(w, h, JNBufferedImage.TYPE_INT_RGB);
Graphics g = unSelectedDropDownImage.getGraphics();
g.setColor(JNDefaultLookAndFeel.BackgroundColor);
g.fillRect(0, 0, w, h);
g.setColor(Color.black);
int[] x_coordinates = new int[3];
int[] y_coordinates = new int[3];
Triangle arrow = new Triangle(w, h, Triangle.BOTTOM);
// arrow.setInsets(6,6,6,6);
// arrow.setInsets(8,8,8,8);
arrow.setInsets(4, 4, 4, 4);
Object[] xyarrs = arrow.getTriangleXYArrays();
x_coordinates = (int[]) xyarrs[0];
y_coordinates = (int[]) xyarrs[1];
g.fillPolygon(x_coordinates, y_coordinates, 3);
}
return unSelectedDropDownImage;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?