本文整理匯總了Java中java.awt.Event類的典型用法代碼示例。如果您正苦於以下問題:Java Event類的具體用法?Java Event怎麽用?Java Event使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Event類屬於java.awt包,在下文中一共展示了Event類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: configVisualizationViewer
import java.awt.Event; //導入依賴的package包/類
@Override
public void configVisualizationViewer(final LayerViewer<V, E> vv) {
PluggableGraphMouse mouse = new PluggableGraphMouse();
mouse.add(new ScalingGraphMousePlugin(
new CrossoverScalingControl(), Event.CTRL_MASK, 1 / 1.1f,
1.1f));
mouse.add(new PickingGraphMousePlugin<V, E>());
mouse.add(new MyEditingPopupGraphMousePlugin<T, V, E, N>(vv, scenario));
vv.setGraphMouse(mouse);
vv.getRenderContext().setVertexFillPaintTransformer(
new NodeFillPaintTransformer<V>(vv.getPickedVertexState()));
vv.setVertexToolTipTransformer(nodeTTT);
vv.getRenderContext().setVertexLabelTransformer(nodeLT);
vv.getRenderer().getVertexLabelRenderer()
.setPosition(Position.AUTO);
vv.setEdgeToolTipTransformer(linkTTT);
vv.getRenderContext().setEdgeLabelTransformer(linkLT);
vv.getRenderContext().getEdgeLabelRenderer()
.setRotateEdgeLabels(true);
vv.getRenderContext().setEdgeDrawPaintTransformer(
new LinkDrawPaintTransformer<E>(vv.getPickedEdgeState()));
}
示例2: processKey
import java.awt.Event; //導入依賴的package包/類
private void processKey(char key) {
//out("select: '" + key);
if (((int) key) == Event.BACK_SPACE) {
init();
return;
}
myPrefix += key;
myPrefix = myPrefix.toLowerCase();
//out("prefix: " + myPrefix);
for (int i = myIndex; i < getItemCount(); i++) {
String item = getItemAt(i).toString().toLowerCase();
//out(" see: " + item);
if (item.startsWith(myPrefix)) {
myIndex = i;
return;
}
}
}
示例3: handleEvent
import java.awt.Event; //導入依賴的package包/類
/**
* Method declaration
*
*
* @param e
*/
// [email protected] 20020130 - comment by fredt
// to remove this deprecated method we need to rewrite the Tree class as a
// ScrollPane component
public boolean handleEvent(Event e) {
switch (e.id) {
case Event.SCROLL_LINE_UP :
case Event.SCROLL_LINE_DOWN :
case Event.SCROLL_PAGE_UP :
case Event.SCROLL_PAGE_DOWN :
case Event.SCROLL_ABSOLUTE :
iX = sbHoriz.getValue();
iY = iRowHeight * sbVert.getValue();
repaint();
return true;
}
return super.handleEvent(e);
}
示例4: handleEvent
import java.awt.Event; //導入依賴的package包/類
/**
* Method declaration
*
*
* @param e
*/
// [email protected] 20020130 - comment by fredt
// to remove this deprecated method we need to rewrite the Grid class as a
// ScrollPane component
// sqlbob: I believe that changing to the JDK1.1 event handler
// would require browsers to use the Java plugin.
public boolean handleEvent(Event e) {
switch (e.id) {
case Event.SCROLL_LINE_UP :
case Event.SCROLL_LINE_DOWN :
case Event.SCROLL_PAGE_UP :
case Event.SCROLL_PAGE_DOWN :
case Event.SCROLL_ABSOLUTE :
iX = sbHoriz.getValue();
iY = iRowHeight * sbVert.getValue();
repaint();
return true;
}
return super.handleEvent(e);
}
示例5: mouseDrag
import java.awt.Event; //導入依賴的package包/類
/**
* Method declaration
*
*
* @param e
* @param x
* @param y
*/
public boolean mouseDrag(Event e, int x, int y) {
if (bDrag && x < iWidth) {
int w = x - iXDrag;
if (w < 0) {
w = 0;
}
iColWidth[iColDrag] = w;
adjustScroll();
repaint();
}
return true;
}
示例6: keyTyped
import java.awt.Event; //導入依賴的package包/類
public void keyTyped(KeyEvent eKey) {
if (eKey.getKeyChar() == Event.ENTER) {
if (textArea.getText().replaceAll("[\\r\\n]+", "").equals("")) {
} else {
// Process the message
MessageControler mc = MessageControler.getInstance();
try {
mc.process(textArea.getText().replaceAll("[\\r\\n]+", ""));
} catch (MessageControlerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
textArea.setText("");
textArea.requestFocus();
}
}
示例7: handleEvent
import java.awt.Event; //導入依賴的package包/類
/**
* Method declaration
*
*
* @param e
*
* @return
*/
// [email protected] 20020130 - comment by fredt
// to remove this deprecated method we need to rewrite the Tree class as a
// ScrollPane component
public boolean handleEvent(Event e) {
switch (e.id) {
case Event.SCROLL_LINE_UP :
case Event.SCROLL_LINE_DOWN :
case Event.SCROLL_PAGE_UP :
case Event.SCROLL_PAGE_DOWN :
case Event.SCROLL_ABSOLUTE :
iX = sbHoriz.getValue();
iY = iRowHeight * sbVert.getValue();
repaint();
return true;
}
return super.handleEvent(e);
}
示例8: addMenuItems
import java.awt.Event; //導入依賴的package包/類
private void addMenuItems(JMenu f, String m[]) {
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
for (int i = 0; i < m.length; i++) {
if (m[i].equals("--")) {
f.addSeparator();
} else if (m[i].equals("---")) {
// (ulrivo): full size on screen with less than 640 width
if (d.width >= 640) {
f.addSeparator();
} else {
return;
}
} else {
JMenuItem item = new JMenuItem(m[i].substring(1));
char c = m[i].charAt(0);
if (c != '-') {
KeyStroke key =
KeyStroke.getKeyStroke(c, Event.CTRL_MASK);
item.setAccelerator(key);
}
item.addActionListener(this);
f.add(item);
}
}
}
示例9: handleEvent
import java.awt.Event; //導入依賴的package包/類
/**
* Method declaration
*
*
* @param e
*
* @return
*/
// [email protected] 20020130 - comment by fredt
// to remove this deprecated method we need to rewrite the Grid class as a
// ScrollPane component
// sqlbob: I believe that changing to the JDK1.1 event handler
// would require browsers to use the Java plugin.
public boolean handleEvent(Event e) {
switch (e.id) {
case Event.SCROLL_LINE_UP :
case Event.SCROLL_LINE_DOWN :
case Event.SCROLL_PAGE_UP :
case Event.SCROLL_PAGE_DOWN :
case Event.SCROLL_ABSOLUTE :
iX = sbHoriz.getValue();
iY = iRowHeight * sbVert.getValue();
repaint();
return true;
}
return super.handleEvent(e);
}
示例10: mouseDrag
import java.awt.Event; //導入依賴的package包/類
/**
* Method declaration
*
*
* @param e
* @param x
* @param y
*
* @return
*/
public boolean mouseDrag(Event e, int x, int y) {
if (bDrag && x < iWidth) {
int w = x - iXDrag;
if (w < 0) {
w = 0;
}
iColWidth[iColDrag] = w;
adjustScroll();
repaint();
}
return true;
}
示例11: keyDown
import java.awt.Event; //導入依賴的package包/類
@Override
public boolean keyDown(final Event event, final int i) {
if (focuson) {
if (i == 42 || i == 10 || i == 56 || i == 119 || i == 87 || i == 43 || i == 61) {
zoomi = true;
}
if (i == 47 || i == 8 || i == 50 || i == 115 || i == 83 || i == 45) {
zoomo = true;
}
if (i == 1006) {
left = true;
}
if (i == 1007) {
right = true;
}
if (i == 1005) {
down = true;
}
if (i == 1004) {
up = true;
}
}
return false;
}
示例12: keyUp
import java.awt.Event; //導入依賴的package包/類
@Override
public boolean keyUp(final Event event, final int i) {
if (i == 42 || i == 10 || i == 56 || i == 119 || i == 87 || i == 43 || i == 61) {
zoomi = false;
}
if (i == 47 || i == 8 || i == 50 || i == 115 || i == 83 || i == 45) {
zoomo = false;
}
if (i == 1006) {
left = false;
}
if (i == 1007) {
right = false;
}
if (i == 1005) {
down = false;
}
if (i == 1004) {
up = false;
}
return false;
}
示例13: keyDown
import java.awt.Event; //導入依賴的package包/類
public boolean keyDown(Event evt, int key)
{
if ( key == 's' || key == 'S' )
{
if (bStop.isEnabled())
{
action( new Event( bStop, Event.ACTION_EVENT, null), null);
}
else
{
action( new Event( bStart, Event.ACTION_EVENT, null), null);
}
return true;
}
else if( key == 't' || key == 'T' )
{
action( new Event( bStimulate, Event.ACTION_EVENT, null), null);
return true;
}
else if( key == 'o' || key == 'O' )
{
action( new Event( bOptions, Event.ACTION_EVENT, null), null);
return true;
}
return false;
}
示例14: action
import java.awt.Event; //導入依賴的package包/類
public boolean action (Event evt, Object arg)
{
for(int x = 0; x < recorder.plotSize; x++)
{
if(evt.target.equals(c[x]))
{
recorder.plot[x] = c[x].getState();
figureYaxis();
recorder.redraw();
return true;
}
}
if (evt.target.equals(cRightAxis))
{
setRightAxis();
return true;
}
return super.action(evt, arg);
}
示例15: btnRegisterHotKey_actionPerformed
import java.awt.Event; //導入依賴的package包/類
/**
* Method to register a hotkey using the RegisterHotKey Windows API call.
* <p>
* @param aEvent the ActionEvent fired.
*/
private void btnRegisterHotKey_actionPerformed(ActionEvent aEvent) {
// assign the WINDOWS+A key to the unique id 88 for identification
JIntellitype.getInstance().registerHotKey(WINDOWS_A, JIntellitype.MOD_WIN, 'A');
JIntellitype.getInstance().registerHotKey(ALT_SHIFT_B, JIntellitype.MOD_ALT + JIntellitype.MOD_SHIFT, 'B');
JIntellitype.getInstance().registerSwingHotKey(CTRL_SHIFT_C, Event.CTRL_MASK + Event.SHIFT_MASK, 'C');
// use a 0 for the modifier if you just want a single keystroke to be a
// hotkey
JIntellitype.getInstance().registerHotKey(PRINT_SCREEN, 0, 44);
JIntellitype.getInstance().registerHotKey(F11, "F11");
JIntellitype.getInstance().registerHotKey(F12, JIntellitype.MOD_ALT, 123);
JIntellitype.getInstance().registerHotKey(SEMICOLON, 0, 186);
JIntellitype.getInstance().registerHotKey(TICK, 0, 192);
// clear the text area
textArea.setText("");
output("RegisterHotKey WINDOWS+A was assigned uniqueID 88");
output("RegisterHotKey ALT+SHIFT+B was assigned uniqueID 89");
output("RegisterHotKey CTRL+SHIFT+C was assigned uniqueID 90");
output("RegisterHotKey PRINT_SCREEN was assigned uniqueID 91");
output("RegisterHotKey F9 was assigned uniqueID 92");
output("RegisterHotKey F12 was assigned uniqueID 93");
output("RegisterHotKey SEMICOLON was assigned uniqueID 94");
output("Press WINDOWS+A or ALT+SHIFT+B or CTRL+SHIFT+C in another application and you will see the debug output in the textarea.");
}