/*
* Thinlet GUI toolkit - www.thinlet.com Copyright (C) 2002-2003 Robert Bajzat
* (robert.bajzat@thinlet.com)
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 0212111-1307 USA
*/
package thinlet;
import java.awt.*;
import java.awt.datatransfer.*;
import java.awt.image.*;
import java.awt.event.*;
import java.lang.reflect.*;
import java.io.*;
import java.net.*;
import java.util.*;
/**
*
* @version $Id: Thinlet.java,v 1.25 2005/01/21 16:30:28 abial Exp $
*/
public class Thinlet extends Container implements Runnable, Serializable {
private transient Font font;
private transient Color c_bg;
private transient Color c_text;
private transient Color c_textbg;
private transient Color c_border;
private transient Color c_disable;
private transient Color c_hover;
private transient Color c_press;
private transient Color c_focus;
private transient Color c_select;
private transient Color c_ctrl = null;
protected transient int block;
private transient Image hgradient, vgradient;
private transient Thread timer;
private transient long watchdelay;
private transient long watch;
private transient String clipboard;
private transient ResourceBundle resourcebundle; // for internationalization
private static ResourceBundle langResource = null; // for I18N
private static ResourceBundle langResourceDefault = null; // for I18N
private transient boolean allI18n = false; // for I18N
// enter the starting characters of a list item text within a short time to
// select the first matching item
private transient String findprefix = "";
private transient long findtime;
private Object content = createImpl("desktop");
private transient Object mouseinside;
private transient Object insidepart;
private transient Object mousepressed;
private transient Object pressedpart;
private transient int referencex, referencey;
private transient int mousex, mousey;
private transient Object focusowner;
private transient boolean focusinside;
private transient Object popupowner;
private transient Object tooltipowner;
//private transient int pressedkey;
private static final int DRAG_ENTERED = AWTEvent.RESERVED_ID_MAX + 1;
private static final int DRAG_EXITED = AWTEvent.RESERVED_ID_MAX + 2;
private static long WHEEL_MASK = 0;
private static int MOUSE_WHEEL = 0;
private static Method wheelrotation = null;
private static int evm = 0;
private static boolean useVectors = true;
static {
try {
WHEEL_MASK = AWTEvent.class.getField("MOUSE_WHEEL_EVENT_MASK").getLong(null);
MOUSE_WHEEL = MouseEvent.class.getField("MOUSE_WHEEL").getInt(null);
} catch (Exception exc) { /* not 1.4 */
}
}
public Thinlet() {
setFont(new Font("SansSerif", Font.PLAIN, 12));
//setFont((Font)
// getToolkit().getDesktopProperty("win.messagebox.font"));
setColors(0xe6e6e6, 0x000000, 0xffffff, 0x909090, 0xb0b0b0, 0xededed, 0xb9b9b9, 0x89899a, 0xc5c5dd);
// disable global focus-manager for this component in 1.4
if (MOUSE_WHEEL != 0) {
try {
getClass().getMethod("setFocusTraversalKeysEnabled", new Class[] { Boolean.TYPE }).invoke(this,
new Object[] { Boolean.FALSE });
} catch (Exception exc) { /* never */
}
}
// set listeners flags
enableEvents(AWTEvent.COMPONENT_EVENT_MASK | AWTEvent.FOCUS_EVENT_MASK | AWTEvent.KEY_EVENT_MASK
| AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK | WHEEL_MASK);
// EVM has larger fillRect, fillOval, and drawImage(part), others are
// correct
// contributed by Ibsen Ramos-Bonilla and AK
try {
if ((System.getProperty("java.vendor").indexOf("Insignia") != -1)
&& System.getProperty("os.name").indexOf("Windows CE") == -1) {
evm = -1;
}
} catch (Exception exc) { /* never */
}
}
/**
* Sets the 9 colors used for components, and repaints the whole UI
*
* @param background the backround of panels (dialogs, desktops), and
* disabled controls, not editable texts, lines between list items
* (the default value if <i>#e6e6e6 </i>)
* @param text for text, arrow foreground ( <i>black </i> by default)
* @param textbackground the background of text components, and lists (
* <i>white </i> by default)
* @param border for outer in inner borders of enabled components (
* <i>#909090 </i> by default)
* @param disable for text, border, arrow color in disabled components (
* <i>#b0b0b0 </i> by default)
* @param hover indicates that the mouse is inside a button area (
* <i>#ededed </i> by default)
* @param press for pressed buttons, gradient image is calculated using the
* background and this press color ( <i>#b9b9b9 </i> by default)
* @param focus for text caret and rectagle color marking the focus owner (
* <i>#89899a </i> by default)
* @param select used as the background of selected text, and list items,
* and in slider ( <i>#c5c5dd </i> by default)
*/
public void setColors(int background, int text, int textbackground, int border, int disable, int hover, int press,
int focus, int select) {
c_bg = new Color(background);
c_text = new Color(text);
c_textbg = new Color(textbackground);
c_border = new Color(border);
c_disable = new Color(disable);
c_hover = new Color(hover);
c_press = new Color(press);
c_focus = new Color(focus);
c_select = new Color(select);
hgradient = vgradient = null;
repaint();
}
//setDesktopProperty+
/**
* Sets the only one font used everywhere, and revalidates the whole UI.
* Scrollbar width/height, spinbox, and combobox button width, and slider
* size is the same as the font height
*
* @param font the default font is <i>SansSerif </i>, <i>plain </i>, and
* <i>12pt </i>
*/
public void setFont(Font font) {
block = getFontMetrics(font).getHeight();
super.setFont(font);
this.font = font;
hgradient = vgradient = null;
if (content != null) validate(content);
}
/**
*
*/
public void doLayout(Object component) {
String classname = getClass(component);
if ("combobox" == classname) {
if (getBoolean(component, "editable", true)) {
Image icon = getIcon(component, "icon", null);
layoutField(component, block, false, (icon != null) ? icon.getWidth(this) : 0);
} // set editable -> validate (overwrite textfield repaint)
else {
int selected = getInteger(component, "selected", -1);
if (selected != -1) { //...
Object choice = getItem(component, selected);
set(component, "text", get(choice, "text"));
set(component, "icon", get(choice, "icon"));
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
luke-src-0.9.1.zip (99个子文件)
.project 363B
src
thinlet
FrameLauncher.java 5KB
Thinlet.java 317KB
xml
editfield.xml 2KB
about.xml 1KB
selfont.xml 2KB
sd-plugin.xml 2KB
fnorm.xml 1KB
export.xml 2KB
qexplain.xml 488B
info.xml 444B
lukeinit.xml 2KB
cleanup.xml 966B
VerboseSimilarity.js 1KB
field.xml 1KB
WikipediaSimilarity.js 1009B
positions.xml 1KB
vector.xml 749B
DefaultSimilarity.js 2KB
luke.xml 25KB
editdoc.xml 1KB
vocab-plugin.xml 1KB
progress.xml 226B
at-plugin.xml 2KB
scr-plugin.xml 1KB
zipf-plugin.xml 963B
SampleScript.js 447B
optimize.xml 2KB
explain.xml 516B
checkindex.xml 2KB
error.xml 432B
org
apache
lucene
index
IndexGate.java 8KB
getopt
luke
AccessibleTopHitCollector.java 828B
ClassFinder.java 20KB
CountLimitedHitCollector.java 2KB
IndexInfo.java 2KB
LimitedException.java 1KB
ProgressNotification.java 211B
Progress.java 1KB
GrowableStringArray.java 2KB
PanelPrintWriter.java 1KB
Luke.java 125KB
BrowserLauncher.java 23KB
IntervalLimitedCollector.java 2KB
HighFreqTerms.java 6KB
XMLExporter.java 11KB
LukePlugin.java 3KB
KeepAllIndexDeletionPolicy.java 403B
AccessibleHitCollector.java 272B
AllHitsCollector.java 784B
Util.java 6KB
plugins
ZipfAnalysisPlugin.java 7KB
ScriptingPlugin.java 5KB
AnalyzerToolPlugin.java 4KB
VocabChart.java 3KB
SimilarityDesignerPlugin.java 12KB
VocabAnalysisPlugin.java 4KB
Shell.java 8KB
LimitedHitCollector.java 264B
Ranges.java 810B
IntPair.java 1KB
KeepLastIndexDeletionPolicy.java 823B
Prefs.java 5KB
DocReconstructor.java 9KB
.plugins 224B
img
info.gif 879B
docs.gif 288B
files.gif 914B
close.png 261B
refresh.png 196B
delete.gif 906B
prev.png 205B
search.gif 919B
simil.gif 220B
errx.gif 1KB
tools.gif 899B
scorers.png 304B
next.png 204B
terms.gif 905B
script.gif 119B
luke-big.gif 2KB
lucene.gif 1KB
open2.gif 929B
luke.gif 335B
open3.gif 922B
props2.gif 933B
open.gif 228B
CHANGES.html 10KB
luke-local.jnlp 568B
.classpath 584B
index.html 0B
luke.jnlp 565B
lib
lucene-snowball-2.4.0.jar 111KB
lucene-analyzers-2.4.0.jar 141KB
lucene-core-2.4.0.jar 800KB
js.jar 471KB
lucene-misc-2.4.0.jar 52KB
luke.gif 1KB
build.xml 4KB
共 99 条
- 1
资源评论
amw_demon
- 粉丝: 4
- 资源: 68
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功