本文整理汇总了Java中com.google.gwt.user.client.ui.TextBox.addKeyDownHandler方法的典型用法代码示例。如果您正苦于以下问题:Java TextBox.addKeyDownHandler方法的具体用法?Java TextBox.addKeyDownHandler怎么用?Java TextBox.addKeyDownHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.TextBox
的用法示例。
在下文中一共展示了TextBox.addKeyDownHandler方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createOpenALExample
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
private void createOpenALExample(ArrayBuffer data) throws AudioContextException
{
ALContext context = ALContext.create();
AL.setCurrentContext(context);
alSource = AL10.alGenSources();
FlowPanel panel = new FlowPanel();
panel.add(new Label("OpenAL example: "));
Button playButton = new Button("Play");
playButton.addClickHandler(event -> AL10.alSourcePlay(alSource));
playButton.setEnabled(false);
Button stopButton = new Button("Stop");
stopButton.addClickHandler(event -> AL10.alSourceStop(alSource));
Button pauseButton = new Button("Pause");
pauseButton.addClickHandler(event -> AL10.alSourcePause(alSource));
Button loopButton = new Button("Looping: Off");
loopButton.addClickHandler(event -> {
openALLooping = !openALLooping;
AL10.alSourcei(alSource, AL10.AL_LOOPING, openALLooping ? AL10.AL_TRUE : AL10.AL_FALSE);
loopButton.setText("Looping: " + (openALLooping ? "On" : "Off"));
});
TextBox pitchBox = new TextBox();
pitchBox.setValue("" + alPitch);
pitchBox.addKeyDownHandler(event -> {
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER)
try
{
alPitch = Float.parseFloat(pitchBox.getValue());
}
catch (Exception e)
{
GWT.log(e.getMessage());
}
});
panel.add(playButton);
panel.add(stopButton);
panel.add(pauseButton);
panel.add(loopButton);
panel.add(new Label("Pitch: "));
panel.add(pitchBox);
AudioDecoder.decodeAudio
(
data,
// On success, set the buffer on the source, and start the animation loop
alBufferID ->
{
AL10.alSourcei(alSource, AL10.AL_BUFFER, alBufferID);
playButton.setEnabled(true);
AnimationScheduler.get().requestAnimationFrame(this::openalTimeStep);
},
GWT::log // Log with GWT on error
);
RootPanel.get().add(panel);
}