本文整理汇总了Java中com.alee.managers.hotkey.Hotkey类的典型用法代码示例。如果您正苦于以下问题:Java Hotkey类的具体用法?Java Hotkey怎么用?Java Hotkey使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Hotkey类属于com.alee.managers.hotkey包,在下文中一共展示了Hotkey类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import com.alee.managers.hotkey.Hotkey; //导入依赖的package包/类
public static void main ( final String[] args )
{
SwingUtilities.invokeLater(() -> {
WebLookAndFeel.install();
UIManagers.initialize();
final CustomSkin defaultSkin = new CustomSkin ( Example.class, "ExampleSkin.xml" );
final CustomSkin darkSkin = new CustomSkin ( Example.class, "DarkExampleSkin.xml" );
StyleManager.setSkin ( defaultSkin );
HotkeyManager.registerHotkey ( Hotkey.CTRL_SPACE, new HotkeyRunnable ()
{
@Override
public void run ( final KeyEvent e )
{
StyleManager.setSkin ( StyleManager.getSkin () == defaultSkin ? darkSkin : defaultSkin );
}
} );
final WebPanel panel = new WebPanel ( ExampleStyles.shaded, new VerticalFlowLayout ( true, true ) );
final WebLabel title = new WebLabel ( ExampleStyles.title.at ( panel ), "Panel Title" );
panel.add ( title );
final WebSeparator separator = new WebSeparator ( ExampleStyles.line.at ( panel ) );
panel.add ( separator );
final WebScrollPane scrollPane = new WebScrollPane ( ExampleStyles.scroll.at ( panel ) );
scrollPane.setHorizontalScrollBarPolicy ( WebScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
scrollPane.getViewport ().setView ( new WebTextArea ( ExampleStyles.text.at ( scrollPane ), 3, 20 ) );
panel.add ( scrollPane );
TestFrame.show ( panel );
});
}
示例2: setHotkeys
import com.alee.managers.hotkey.Hotkey; //导入依赖的package包/类
void setHotkeys(final boolean enterSends) {
mTextComposingArea.setHotkeys(enterSends);
mSendButton.removeHotkeys();
HotkeyData sendHotkey = enterSends ? Hotkey.ENTER : Hotkey.CTRL_ENTER;
mSendButton.addHotkey(sendHotkey, TooltipWay.up);
}