📄 default.jc
字号:
/*
* default.jc
*
* This minimalistic applet will be compiled by the ScriptApp application,
* if no other script file was specified.
*/
/*
* Import used native types
*/
import Screen;
import TextLayer;
/*
* class MyApplet
*
* A simple test applet for the ScriptApp application
*/
class MyApplet : interface Applet
{
method MyApplet(Screen&);
method OnOpen();
method OnClose();
method OnClick(long button, long x, long y);
method OnKey(long key);
method Idle();
Screen& m_Screen;
}
/*
* function CreateApplet
*
* The Application calls this function to create our applet.
* We need to implement this function and return an instance of our applet.
*/
function Applet& CreateApplet(Screen& screen)
{
return new MyApplet(screen);
}
/*
* class MyApplet
*
* constructor
*/
method MyApplet::MyApplet(Screen& screen)
{
// store reference to screen for later...
m_Screen = screen;
// set background color
m_Screen.BackColor( 128, 128, 128 );
// create a text layer
TextLayer text = new TextLayer();
// set it's properties
text.Text( "Hello World!" );
text.Font( 2 );
text.SetColor( 255, 255, 255 );
text.MoveTo( 260, 225 );
text.ResizeTo( 120, 30 );
text.Show();
// add the layer to our screen's list of layers
m_Screen.AddLayer( text );
}
/*
* OnOpen
*
* Called when the ScriptApp window is opened.
*/
method MyApplet::OnOpen()
{
}
/*
* OnClose
*
* Called when the ScriptApp window is closed.
*/
method MyApplet::OnClose()
{
}
/*
* OnClick
*
* Called when the user clicks with a mouse button
*/
method MyApplet::OnClick(long button, long x, long y)
{
}
/*
* OnKey
*
* Called when the user presses a key
*/
method MyApplet::OnKey(long key)
{
}
/*
* Idle
*
* Called in regular intervals when nothing else to do
*/
method MyApplet::Idle()
{
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -