本文整理了Java中javax.swing.JScrollPane.addKeyListener()
方法的一些代码示例,展示了JScrollPane.addKeyListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JScrollPane.addKeyListener()
方法的具体详情如下:
包路径:javax.swing.JScrollPane
类名称:JScrollPane
方法名:addKeyListener
暂无
代码示例来源:origin: org.icepdf.os/icepdf-viewer
/**
* Install a KeyListenerPageChanger as a KeyListener
*
* @param c SwingController that can change pages
* @param s JScrollPane that has a vertical JScrollBar, and where events come from
*/
public static KeyListenerPageChanger install(SwingController c, JScrollPane s,
AbstractDocumentView documentView) {
KeyListenerPageChanger listener = null;
if (c != null && s != null) {
listener = new KeyListenerPageChanger(c, s, documentView);
s.addKeyListener(listener);
}
return listener;
}
代码示例来源:origin: org.icepdf.os/icepdf-viewer
/**
* Install a KeyListenerPageChanger as a KeyListener
*
* @param c SwingController that can change pages
* @param s JScrollPane that has a vertical JScrollBar, and where events come from
*/
public static KeyListenerPageColumnChanger install(SwingController c, JScrollPane s,
AbstractDocumentView documentView,
CurrentPageChanger currentPageChanger) {
KeyListenerPageColumnChanger listener = null;
if (c != null && s != null) {
listener = new KeyListenerPageColumnChanger(c, s, documentView, currentPageChanger);
s.addKeyListener(listener);
}
return listener;
}
代码示例来源:origin: org.onebusaway/onebusaway-phone
private static void setupGui(AgiClientScriptImpl script) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
KeyPressHandler handler = new KeyPressHandler(script);
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
panel.addKeyListener(handler);
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new GridLayout(4, 3));
panel.add(buttonPanel, BorderLayout.CENTER);
String buttons = "123456789*0#";
for (int i = 0; i < buttons.length(); i++)
addButton(buttonPanel, script, handler, buttons.charAt(i));
Document document = script.getDocument();
final JTextArea textArea = new JTextArea(document);
textArea.setEditable(false);
textArea.addKeyListener(handler);
document.addDocumentListener(new ScrollDocumentToEnd(textArea));
JScrollPane scrollPane = new JScrollPane(textArea);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
scrollPane.setPreferredSize(new Dimension(300, 100));
scrollPane.addKeyListener(handler);
panel.add(scrollPane, BorderLayout.SOUTH);
frame.getContentPane().add(panel);
frame.pack();
frame.setVisible(true);
}
代码示例来源:origin: hltfbk/Excitement-Open-Platform
@SuppressWarnings("serial")
private JScrollPane createNewImagePane() {
ImagePaintingComponent imagePaintingComponent = new ImagePaintingComponent();
JScrollPane newImageScrollPane =
new JScrollPane(imagePaintingComponent, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
mapImagePanesToImagePaintingComponents.put(newImageScrollPane, imagePaintingComponent);
newImageScrollPane.addMouseWheelListener(actionsPerformer);
newImageScrollPane.addKeyListener(actionsPerformer);
/* add a new actions for zoomIn and zoomOut key strokes to the panel's action map */
newImageScrollPane.getActionMap().put(COMMAND_ZOOM_IN, new AbstractAction() {
public void actionPerformed(ActionEvent e) {
actionsPerformer.zoomIn();
}
});
newImageScrollPane.getActionMap().put(COMMAND_ZOOM_OUT, new AbstractAction() {
public void actionPerformed(ActionEvent e) {
actionsPerformer.zoomOut();
}
});
// listen to +/-/=/Ctrl+/Ctrl-/Ctrl= keystrokes
newImageScrollPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, InputEvent.CTRL_MASK), COMMAND_ZOOM_IN);
newImageScrollPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, InputEvent.CTRL_MASK), COMMAND_ZOOM_IN);
newImageScrollPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, InputEvent.CTRL_MASK), COMMAND_ZOOM_OUT);
newImageScrollPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(Character.valueOf('-'), 0), COMMAND_ZOOM_OUT);
newImageScrollPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(Character.valueOf('+'), 0), COMMAND_ZOOM_IN);
newImageScrollPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(Character.valueOf('='), 0), COMMAND_ZOOM_IN);
return newImageScrollPane;
}
代码示例来源:origin: net.sf.ingenias/editor
scrollLogs.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(KeyEvent e) {
jScrollPane3_keyPressed(e);
内容来源于网络,如有侵权,请联系作者删除!