本文整理汇总了Java中java.awt.event.MouseEvent.isShiftDown方法的典型用法代码示例。如果您正苦于以下问题:Java MouseEvent.isShiftDown方法的具体用法?Java MouseEvent.isShiftDown怎么用?Java MouseEvent.isShiftDown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.event.MouseEvent
的用法示例。
在下文中一共展示了MouseEvent.isShiftDown方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mouseClicked
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public void mouseClicked(MouseEvent e) {
JTableHeader h = (JTableHeader) e.getSource();
TableColumnModel columnModel = h.getColumnModel();
int viewColumn = columnModel.getColumnIndexAtX(e.getX());
int column = columnModel.getColumn(viewColumn).getModelIndex();
if (column != -1) {
int status = getSortingStatus(column);
if (!e.isControlDown()) {
cancelSorting();
}
// Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING} or
// {NOT_SORTED, DESCENDING, ASCENDING} depending on whether shift is pressed.
status = status + (e.isShiftDown() ? -1
: 1);
status = (status + 4) % 3 - 1; // signed mod, returning {-1, 0, 1}
setSortingStatus(column, status);
}
}
示例2: mouseClicked
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public void mouseClicked(MouseEvent e) {
JTableHeader h = (JTableHeader) e.getSource();
TableColumnModel columnModel = h.getColumnModel();
int viewColumn = h.columnAtPoint(e.getPoint());
int column = columnModel.getColumn(viewColumn).getModelIndex();
if (column != -1) {
int status = getSortingStatus(column);
if (!e.isControlDown()) {
cancelSorting();
}
// Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING} or
// {NOT_SORTED, DESCENDING, ASCENDING} depending on whether shift is pressed.
status = status + (e.isShiftDown() ? -1
: 1);
status = (status + 4) % 3 - 1; // signed mod, returning {-1, 0, 1}
setSortingStatus(column, status);
}
}
示例3: mousePressed
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mousePressed(MouseEvent e) {
stopEditing(table);
row0 = rowAtPoint(e.getPoint());
int row0b = row0;
if (row0 >= 0) {
if (e.isShiftDown()) {
row0b = table.getSelectionModel().getAnchorSelectionIndex();
}
table.setRowSelectionInterval(row0b, row0);
table.setColumnSelectionInterval(0, table.getColumnCount() - 1);
//selectionModel.setAnchorSelectionIndex(0);
//columnModel.getSelectionModel().setAnchorSelectionIndex(col0);
table.requestFocus();
}
}
示例4: mouseClicked
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseClicked(MouseEvent e) {
JTableHeader h = (JTableHeader) e.getSource();
TableColumnModel columnModel = h.getColumnModel();
int viewColumn = getSortingColumnIndex(h, e.getPoint());
if (viewColumn != -1) {
int column = columnModel.getColumn(viewColumn).getModelIndex();
if (column != -1) {
int status = getSortingStatus(column);
if (!SwingTools.isControlOrMetaDown(e)) {
cancelSorting();
}
// Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING} or
// {NOT_SORTED, DESCENDING, ASCENDING} depending on whether shift is
// pressed.
status = status + (e.isShiftDown() ? -1 : 1);
status = (status + 4) % 3 - 1; // signed mod, returning {-1, 0, 1}
setSortingStatus(column, status);
}
e.consume();
}
}
示例5: mouseClicked
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseClicked(MouseEvent e)
{
JTableHeader h = (JTableHeader) e.getSource();
TableColumnModel columnModel = h.getColumnModel();
int viewColumn = columnModel.getColumnIndexAtX(e.getX());
int column = columnModel.getColumn(viewColumn).getModelIndex();
if( column != -1 )
{
int status = getSortingStatus(column);
if( !e.isControlDown() )
{
cancelSorting();
}
// Cycle the sorting states through {NOT_SORTED, ASCENDING,
// DESCENDING} or
// {NOT_SORTED, DESCENDING, ASCENDING} depending on whether
// shift is pressed.
status = status + (e.isShiftDown() ? -1 : 1);
status = (status + 4) % 3 - 1; // signed mod, returning {-1, 0,
// 1}
setSortingStatus(column, status);
}
}
示例6: select
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
void select( MouseEvent e) {
if( !map.isSelectable() ) return;
double zoom = map.getZoom();
double radius = 3./Math.pow(zoom, .75);
double r2 = radius*radius;
double wrap = map.getWrap();
Point2D p = map.getScaledPoint(e.getPoint());
if( !e.isShiftDown() ) table.clearSelection();
int xyIndex = headings.size()+1;
for( int k=0 ; k<currentRowsIndices.size() ; k++) {
Vector row = getCurrentRow(k);
float[] xy = (float[])row.get(xyIndex);
double offset = 0.;
while( xy[0]+offset<p.getX()-radius ) offset+=wrap;
while( xy[0]+offset>p.getX()+radius ) offset-=wrap;
if( xy[0]+offset<p.getX()-radius )continue;
double r = p.distanceSq( offset+xy[0], (double)xy[1]);
if( r < r2) {
table.getSelectionModel().addSelectionInterval(k,k);
table.ensureIndexIsVisible(k);
}
}
}
示例7: mousePressed
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public void mousePressed(MouseEvent e) {
if (station){
//This will detect if the mouse clicks on a datapoint
//and will set the selectedRow value. Used for dragging.
selectedRow = -1;
selectPoint(e);
}
if (e.isControlDown()) return;
if (e.isConsumed()||!map.isSelectable()) return;
if (db.panTB.isSelected()) return;
if (e.isShiftDown()) {
p1=e.getPoint();
p2=new Point(p1.x+1,p1.y+1);
drawSelectionBox();
}
else {
poly = new Polygon();
poly.addPoint(e.getPoint().x, e.getPoint().y);
}
}
示例8: mouseDragged
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseDragged(MouseEvent e) {
if (currentProfile == null) {
return;
}
int idx = -1;
if ((idx = getIndex(e)) == -1) {
return;
}
if (idx != lastEditIdx) {
if (e.isAltDown() && e.isShiftDown()) {
// brake point
currentProfile.editClearBrake(idx);
currentProfile.log();
editState = EditState.None;
glCanvas.repaint();
} else if (e.isAltDown() && !e.isShiftDown()) {
// brake point
currentProfile.editSetBrake(idx);
currentProfile.log();
editState = EditState.None;
glCanvas.repaint();
} else if (isShift(e)) {
currentProfile.editIncreaseThrottle(idx);
currentProfile.log();
editState = EditState.Increae;
glCanvas.repaint();
} else if (isControl(e)) {
currentProfile.editDecreaseThrottle(idx);
currentProfile.log();
editState = EditState.Decrease;
glCanvas.repaint();
} else {
editState = EditState.None;
}
}
lastEditIdx = idx;
}
示例9: isMultiselectPressed
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public static boolean isMultiselectPressed(MouseEvent evt) {
if(evt.isShiftDown()) {
return true;
}
if(!isAqua() && evt.isControlDown()) {
return true;
}
return false;
}
示例10: mouseDragged
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public void mouseDragged(MouseEvent e) {
if (e.isShiftDown()) {
return; //ignore drag when shift is pressed
}
int col1 = columnAtPoint(e.getPoint());
if (col0 >= 0 && col1 >= 0) {
table.setColumnSelectionInterval(col0, col1);
table.setRowSelectionInterval(0, table.getRowCount() - 1);
}
}
示例11: canHandleEvent
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
protected boolean canHandleEvent(MouseEvent e) {
return !e.isShiftDown() &&
!e.isControlDown() &&
!e.isMetaDown() &&
e.getClickCount() < 2 &&
!e.isConsumed();
}
示例12: mouseDragged
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseDragged(MouseEvent e) {
if (e.isShiftDown()) return;
if (bAllowDrag) {
if (!bDragging) { // Cas particulier de la surcharge du mouse pressed par la classe fille
mousePressed(e);
} else {
dragAnim.updateVelocity(dragMem, e.getPoint(), dragWhen, e.getWhen());
map.onDragged(e.getX() - dragMem.getX(), e.getY() - dragMem.getY());
dragMem = e.getPoint();
dragWhen = e.getWhen();
}
}
}
示例13: mouseReleased
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseReleased(MouseEvent e) {
if (e.isShiftDown()) return;
if (bDragging) {
dragAnim.start(e.getWhen());
}
}
示例14: mouseClicked
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseClicked(MouseEvent e) {
if (e.isControlDown() || e.isShiftDown() && e.getButton() != MouseEvent.BUTTON3) {
VideoViewer viewer = VideoViewer.INSTANCE;
if (viewer.PLAYER.isPlaying()) {
Dimension dim = viewer.PLAYER.getVideoDimension();
if (e.getButton() == MouseEvent.BUTTON1) {
updateVisibility(false);
} else {
updateVisibility(true);
}
YtQueueFrame frame = YtQueueFrame.INSTANCE;
int x = frame.getX(), y = frame.getY(), w = frame.getWidth(), h = frame.getHeight();
double simillar = dim.width / (double) w;
if (e.isShiftDown()) {
simillar = 1;
}
dim.width = (int) (dim.width / simillar);
dim.height = (int) (dim.height / simillar) +
(e.getButton() != MouseEvent.BUTTON2 ? 0 : SearchPanel.INSTANCE.getHeight() +
VideoViewer.INSTANCE.MANAGER.getHeight());
frame.setBounds(x + w - dim.width, y + h - dim.height, dim.width, dim.height);
}
}
if (e.getClickCount() == 2) {
if (e.getButton() == MouseEvent.BUTTON1) {
updateVisibility(!SearchPanel.INSTANCE.isVisible());
} else if (e.getButton() == MouseEvent.BUTTON2) {
close();
}
}
}
示例15: mousePressed
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mousePressed(MouseEvent e) {
if (e.isShiftDown()) return;
e.getComponent().requestFocus();
if (e.getButton() == MouseEvent.BUTTON1) {
dragAnim.stop();
bDragging = true;
dragMem = e.getPoint();
dragWhen = e.getWhen();
}
}