Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
f9198a75
提交
f9198a75
authored
2月 24, 2008
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
91eb57ed
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
46 行增加
和
18 行删除
+46
-18
h2b.png
h2/src/main/org/h2/res/h2b.png
+0
-0
Console.java
h2/src/main/org/h2/tools/Console.java
+40
-16
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+6
-2
没有找到文件。
h2/src/main/org/h2/res/h2b.png
0 → 100644
浏览文件 @
f9198a75
277 Bytes
h2/src/main/org/h2/tools/Console.java
浏览文件 @
f9198a75
...
...
@@ -26,10 +26,13 @@ import java.awt.event.MouseListener;
import
java.awt.event.WindowAdapter
;
import
java.awt.event.WindowEvent
;
import
org.h2.util.IOUtils
;
import
java.io.IOException
;
import
java.io.InputStream
;
//#endif
import
java.sql.SQLException
;
import
org.h2.constant.SysProperties
;
import
org.h2.server.ShutdownHandler
;
import
org.h2.util.StartBrowser
;
...
...
@@ -46,11 +49,12 @@ ShutdownHandler {
//#ifdef AWT
private
Font
font
;
private
Image
icon
;
private
Image
icon
16
,
icon24
;
private
Frame
frame
;
//#endif
private
static
final
int
EXIT_ERROR
=
1
;
private
Server
web
,
tcp
,
pg
;
private
boolean
isWindows
;
/**
* The command line interface for this tool.
...
...
@@ -69,6 +73,7 @@ ShutdownHandler {
}
private
int
run
(
String
[]
args
)
{
isWindows
=
SysProperties
.
getStringSetting
(
"os.name"
,
""
).
startsWith
(
"Windows"
);
int
exitCode
=
0
;
try
{
web
=
Server
.
createWebServer
(
args
);
...
...
@@ -103,13 +108,14 @@ ShutdownHandler {
}
//#ifdef AWT
if
(!
GraphicsEnvironment
.
isHeadless
())
{
font
=
new
Font
(
"Dialog"
,
Font
.
PLAIN
,
11
);
if
(
isWindows
)
{
font
=
new
Font
(
"Dialog"
,
Font
.
PLAIN
,
11
);
}
else
{
font
=
new
Font
(
"Dialog"
,
Font
.
PLAIN
,
12
);
}
try
{
InputStream
in
=
Console
.
class
.
getResourceAsStream
(
"/org/h2/res/h2.png"
);
if
(
in
!=
null
)
{
byte
[]
imageData
=
IOUtils
.
readBytesAndClose
(
in
,
-
1
);
icon
=
Toolkit
.
getDefaultToolkit
().
createImage
(
imageData
);
}
icon16
=
loadImage
(
"/org/h2/res/h2.png"
);
icon24
=
loadImage
(
"/org/h2/res/h2b.png"
);
if
(!
createTrayIcon
())
{
showWindow
(
true
);
}
...
...
@@ -129,6 +135,15 @@ ShutdownHandler {
return
exitCode
;
}
private
Image
loadImage
(
String
name
)
throws
IOException
{
InputStream
in
=
Console
.
class
.
getResourceAsStream
(
name
);
if
(
in
!=
null
)
{
byte
[]
imageData
=
IOUtils
.
readBytesAndClose
(
in
,
-
1
);
return
Toolkit
.
getDefaultToolkit
().
createImage
(
imageData
);
}
return
null
;
}
/**
* INTERNAL
*/
...
...
@@ -187,16 +202,23 @@ ShutdownHandler {
itemExit
.
addActionListener
(
this
);
menuConsole
.
add
(
itemExit
);
// TrayIcon icon = new TrayIcon(image, "H2 Database Engine", menuConsole);
Object
trayIcon
=
Class
.
forName
(
"java.awt.TrayIcon"
).
getConstructor
(
new
Class
[]
{
Image
.
class
,
String
.
class
,
PopupMenu
.
class
}).
newInstance
(
new
Object
[]
{
icon
,
"H2 Database Engine"
,
menuConsole
});
// SystemTray tray = SystemTray.getSystemTray();
Object
tray
=
Class
.
forName
(
"java.awt.SystemTray"
).
getMethod
(
"getSystemTray"
,
new
Class
[
0
]).
invoke
(
null
,
new
Object
[
0
]);
// Dimension d = tray.getTrayIconSize();
Dimension
d
=
(
Dimension
)
Class
.
forName
(
"java.awt.SystemTray"
).
getMethod
(
"getTrayIconSize"
,
new
Class
[
0
]).
invoke
(
tray
,
new
Object
[
0
]);
Image
icon
=
(
d
.
width
>=
24
&&
d
.
height
>=
24
)
?
icon24
:
icon16
;
// TrayIcon icon = new TrayIcon(image, "H2 Database Engine", menuConsole);
Object
trayIcon
=
Class
.
forName
(
"java.awt.TrayIcon"
).
getConstructor
(
new
Class
[]
{
Image
.
class
,
String
.
class
,
PopupMenu
.
class
}).
newInstance
(
new
Object
[]
{
icon
,
"H2 Database Engine"
,
menuConsole
});
// trayIcon.addMouseListener(this);
trayIcon
.
getClass
().
getMethod
(
"addMouseListener"
,
new
Class
[]{
MouseListener
.
class
}).
...
...
@@ -224,8 +246,8 @@ ShutdownHandler {
}
}
});
if
(
icon
!=
null
)
{
frame
.
setIconImage
(
icon
);
if
(
icon
16
!=
null
)
{
frame
.
setIconImage
(
icon
16
);
}
frame
.
setResizable
(
false
);
frame
.
setBackground
(
SystemColor
.
control
);
...
...
@@ -250,7 +272,9 @@ ShutdownHandler {
text
.
setEditable
(
false
);
text
.
setFont
(
font
);
text
.
setText
(
web
.
getURL
());
text
.
setFocusable
(
false
);
if
(
isWindows
)
{
text
.
setFocusable
(
false
);
}
c
.
anchor
=
GridBagConstraints
.
EAST
;
c
.
gridwidth
=
GridBagConstraints
.
REMAINDER
;
frame
.
add
(
text
,
c
);
...
...
@@ -269,7 +293,7 @@ ShutdownHandler {
c
.
gridwidth
=
GridBagConstraints
.
REMAINDER
;
frame
.
add
(
startBrowser
,
c
);
int
width
=
25
0
,
height
=
120
;
int
width
=
30
0
,
height
=
120
;
frame
.
setSize
(
width
,
height
);
Dimension
screenSize
=
Toolkit
.
getDefaultToolkit
().
getScreenSize
();
frame
.
setLocation
((
screenSize
.
width
-
width
)
/
2
,
(
screenSize
.
height
-
height
)
/
2
);
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
f9198a75
...
...
@@ -155,7 +155,11 @@ java org.h2.test.TestAll timer
/*
test startBrowser in Linux
larger H2 tray icon for ubuntu
Can not select URL
Strange font
fix or disable the linear hash index
...
...
@@ -165,8 +169,8 @@ link to new changelog and roadmap, remove pages from google groups
Can sometimes not delete log file? need test case
History:
New function FILE_READ to read a file or from an URL
.
Both binary and text data is supported.
H2 Console: on Linux, Firefox is now started if available. This has been tested on Ubuntu
.
Roadmap:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论