Java 类javax.swing.event.MouseInputAdapter 实例源码
项目:Progetto-N
文件:GuiPrincipale.java
public void impostaJModificaPrenotazione() throws SQLException{
jModificaPrenotazione.addMouseListener(new MouseInputAdapter() {
@Override
public void mousePressed(MouseEvent me) {
GuiModificaPrenotazione mp;
try {
mp = new GuiModificaPrenotazione();
mp.setDataField(id);
mp.setVisible(true);
} catch (SQLException ex) {
Logger.getLogger(GuiPrincipale.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
}
项目:Progetto-N
文件:GuiPrincipale.java
public void impostaRimuovi(){
jRimuovi.addMouseListener(new MouseInputAdapter() {
@Override
public void mousePressed(MouseEvent me) {
for(int j=0;j<agri.getPrenotazione().size(); j++){
if(agri.getPrenotazione().get(j).getId()==id){
int choose = JOptionPane.showConfirmDialog(rootPane, "Sei sicuro di voler "
+ "eliminare la prenotazione a nome di '"+nomePrenotazione+"' ?");
if(choose==JOptionPane.YES_OPTION){
try {
createDb.deletePrenotazione(id, nomePrenotazione);
agri.getPrenotazione().remove(j);
} catch (SQLException ex) {
Logger.getLogger(GuiPrincipale.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
}
}
});
}
项目:PhET
文件:DiscreteModule.java
/**
* Sole constructor.
*
* @param component
* @param model
*/
public ThisWiggleMeGraphic( Component component, IClock clock ) {
super( component, clock );
setText( FourierResources.getString( "DiscreteModule.wiggleMe" ), WIGGLE_ME_COLOR );
addArrow( WiggleMeGraphic.TOP_CENTER, new MutableVector2D( 0, -30 ), WIGGLE_ME_COLOR );
setRange( 0, 10 );
setCycleDuration( 5 );
setEnabled( true );
_mouseListener = new MouseInputAdapter() {
// Disable the wiggle me when the mouse is pressed in the apparatus panel.
public void mousePressed( MouseEvent event ) {
// Disable
setEnabled( false );
// Unwire
getComponent().removeMouseListener( this );
}
};
component.addMouseListener( _mouseListener );
}
项目:PhET
文件:PhetAboutDialog.java
private JPanel createLogoPanel() {
BufferedImage image = PhetCommonResources.getInstance().getImage( PhetLookAndFeel.PHET_LOGO_120x50 );
JLabel logoLabel = new JLabel( new ImageIcon( image ) );
logoLabel.setCursor( Cursor.getPredefinedCursor( Cursor.HAND_CURSOR ) );
logoLabel.setToolTipText( LOGO_TOOLTIP );
logoLabel.addMouseListener( new MouseInputAdapter() {
public void mouseReleased( MouseEvent e ) {
PhetServiceManager.showPhetPage();
}
} );
String html = HTMLUtils.createStyledHTMLFromFragment( COPYRIGHT_HTML_FRAGMENT );
InteractiveHTMLPane pane = new InteractiveHTMLPane( html );
pane.setBackground( new JPanel().getBackground() );//see #1275
HorizontalLayoutPanel logoPanel = new HorizontalLayoutPanel();
logoPanel.setInsets( new Insets( 10, 10, 10, 10 ) ); // top,left,bottom,right
logoPanel.add( logoLabel );
logoPanel.add( pane );
return logoPanel;
}
项目:esadb
文件:PageView.java
public PageView(Printable printable, PageFormat pageFormat) {
super();
this.printable = printable;
this.pageFormat = pageFormat;
this.scale = 100;
pages = new Vector<Page>();
setLayout(null);
setBackground(Color.LIGHT_GRAY);
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
MouseInputAdapter dragScroll = new DragScroll(this);
addMouseMotionListener(dragScroll);
addMouseListener(dragScroll);
}
项目:harmonic-moon
文件:Menu.java
public Menu(final HarmonicMoon harmonicMoon) {
this.harmonicMoon = harmonicMoon;
addMouseListener(new MouseInputAdapter() {
@Override
public void mouseClicked(MouseEvent event) {
Font font = harmonicMoon.getTitleFont().deriveFont(16.0F);
if (SwingUtilities.isLeftMouseButton(event)) {
int x = (getWidth() - MENU_ITEM_WIDTH) / 2;
int y = 128;
for (MenuItem menuItem : getMenuItems()) {
Point mouse = MouseInfo.getPointerInfo().getLocation();
if (mouse.getX() - getLocationOnScreen().getX() >= x && mouse.getY() - getLocationOnScreen().getY() >= y && mouse.getX() - getLocationOnScreen().getX() <= getWidth() - x && mouse.getY() - getLocationOnScreen().getY() <= y + 32 + getFontMetrics(font).getMaxAscent()) {
MenuSelectEvent menuSelectEvent = new MenuSelectEvent(Menu.this, menuItem);
harmonicMoon.getEventManager().dispatchEvent(menuSelectEvent);
if (!menuSelectEvent.isCancelled()) {
menuSelectEvent.getMenuItem().doSelect();
}
return;
}
y += 1.5 * (32 + getFontMetrics(font).getMaxAscent());
}
}
}
});
}
项目:cn1
文件:SwatchesPanel.java
protected void buildChooser() {
mnemonic = Integer.parseInt(UIManager.getString("ColorChooser.swatchesMnemonic"));
displayedMnemonicIndex = Integer.parseInt(UIManager.getString("ColorChooser.swatchesDisplayedMnemonicIndex"));
swatchSize = UIManager.getDimension("ColorChooser.swatchesSwatchSize");
recentSwatchSize = UIManager.getDimension("ColorChooser.swatchesRecentSwatchSize");
JPanel right = new JPanel(new BorderLayout());
recentPanel = new SwatchPanel(createRecentColors(), null, recentSwatchSize);
MouseInputAdapter swatchMouseAdapter = new SwatchPanelMouseInputAdapter(recentPanel);
recentPanel.addMouseListener(swatchMouseAdapter);
recentPanel.addMouseMotionListener(swatchMouseAdapter);
right.add(BorderLayout.CENTER, new JLabel(UIManager.getString("ColorChooser.swatchesRecentText")));
right.add(BorderLayout.SOUTH, recentPanel);
swatchPanel = new SwatchPanel(MAIN_SWATCH_COLORS, recentPanel, swatchSize);
swatchMouseAdapter = new SwatchPanelMouseInputAdapter(swatchPanel);
swatchPanel.addMouseListener(swatchMouseAdapter);
swatchPanel.addMouseMotionListener(swatchMouseAdapter);
JPanel fullPanel = new JPanel();
fullPanel.add(swatchPanel);
fullPanel.add(right);
this.add(fullPanel);
}
项目:phon
文件:CommonModuleFrame.java
private void init() {
FormLayout layout = new FormLayout(
"fill:pref:grow, pref, 3dlu",
"3dlu, pref, fill:pref:grow");
CellConstraints cc = new CellConstraints();
this.setLayout(layout);
messageLabel = new JLabel();
messageLabel.setBackground(backColor);
messageLabel.setForeground(foreColor);
messageLabel.setOpaque(true);
messageLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
messageLabel.setToolTipText("Click to hide");
messageLabel.addMouseListener(new MouseInputAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
hideStatusComponent();
}
});
messageLabel.setHorizontalAlignment(SwingConstants.RIGHT);
add(messageLabel, cc.xy(2, 2));
}
项目:snap-desktop
文件:DiagramCanvas.java
public DiagramCanvas() {
setName("diagram");
diagramChangeHandler = new DiagramChangeHandler();
addComponentListener(new ComponentAdapter() {
/**
* Invoked when the component's size changes.
*/
@Override
public void componentResized(ComponentEvent e) {
if (diagram != null) {
diagram.invalidate();
}
}
});
MouseInputAdapter mouseHandler = new IndicatorHandler();
addMouseListener(mouseHandler);
addMouseMotionListener(mouseHandler);
setPreferredSize(new Dimension(320, 200));
}
项目:freeVM
文件:SwatchesPanel.java
protected void buildChooser() {
mnemonic = Integer.parseInt(UIManager.getString("ColorChooser.swatchesMnemonic"));
displayedMnemonicIndex = Integer.parseInt(UIManager.getString("ColorChooser.swatchesDisplayedMnemonicIndex"));
swatchSize = UIManager.getDimension("ColorChooser.swatchesSwatchSize");
recentSwatchSize = UIManager.getDimension("ColorChooser.swatchesRecentSwatchSize");
JPanel right = new JPanel(new BorderLayout());
recentPanel = new SwatchPanel(createRecentColors(), null, recentSwatchSize);
MouseInputAdapter swatchMouseAdapter = new SwatchPanelMouseInputAdapter(recentPanel);
recentPanel.addMouseListener(swatchMouseAdapter);
recentPanel.addMouseMotionListener(swatchMouseAdapter);
right.add(BorderLayout.CENTER, new JLabel(UIManager.getString("ColorChooser.swatchesRecentText")));
right.add(BorderLayout.SOUTH, recentPanel);
swatchPanel = new SwatchPanel(MAIN_SWATCH_COLORS, recentPanel, swatchSize);
swatchMouseAdapter = new SwatchPanelMouseInputAdapter(swatchPanel);
swatchPanel.addMouseListener(swatchMouseAdapter);
swatchPanel.addMouseMotionListener(swatchMouseAdapter);
JPanel fullPanel = new JPanel();
fullPanel.add(swatchPanel);
fullPanel.add(right);
this.add(fullPanel);
}
项目:PIPE
文件:TransitionView.java
/**
* Constructor
*
* @param model underlying transition model
* @param controller Petri net controller of the Petri net the transition is housed in
* @param parent parent of the view
* @param transitionHandler mouse listener actions for the transition when in edit mode
* @param animationHandler mouse listener actions for the transition when in animation mode
*/
public TransitionView(Transition model, PetriNetController controller, Container parent,
MouseInputAdapter transitionHandler, MouseListener animationHandler) {
super(model.getId(), model, controller, controller.getTransitionController(model), parent,
new Rectangle2D.Double(-model.getWidth()/2, -model.getHeight()/2, model.getWidth(), model.getHeight()));
unrotated = new Rectangle2D.Double(-model.getWidth()/2, -model.getHeight()/2, model.getWidth(), model.getHeight());
setChangeListener();
highlighted = false;
rotate(model.getAngle());
//TODO: DEBUG WHY CANT CALL THIS IN CONSTRUCTOR
// changeToolTipText();
setMouseListener(transitionHandler, animationHandler);
}
项目:MASPlanes
文件:DisplayPane.java
public DisplayPane(GUIWorld w) {
world = w;
this.addMouseListener(new MouseInputAdapter() {
@Override
public void mouseReleased(final MouseEvent me) {
// Select or deselect a Plane
Location l = world.screenToWorld(new Point2D.Double(me.getX(), me.getY()));
Plane p = world.getPlaneAt(l);
world.togglePlaneSelection(p);
// If no plane is selected, try to find a task to give its information
if (p == null) {
Task t = world.getTaskAt(l);
if (t != null) {
System.err.println(t);
}
}
} // End of 'mouseReleased(MouseEvent)' method
});
}
项目:ConsoleKit
文件:TerminalPanel.java
private void init()
{
// set up the terminal data
this.data = new TerminalData(
prefs.bufferWidthChars, prefs.bufferHeightChars);
this.lineOffset = 0;
this.setFont(prefs.font);
this.setBackground(prefs.bgColor);
this.setForeground(prefs.fgColor);
this.setFocusable(true);
this.addKeyListener(this);
this.addMouseListener(new MouseInputAdapter(){
@Override
public void mouseClicked(MouseEvent e)
{
requestFocusInWindow();
}
});
firstPaint = true;
}
项目:gate-core
文件:LuceneDataStoreSearchGUI.java
@Override
public MouseInputAdapter createListener(String... parameters) {
switch(parameters.length) {
case 3:
return new AnnotationMouseListener(parameters[1]);
case 5:
return new AnnotationMouseListener(parameters[1], parameters[2],
parameters[3]);
default:
return null;
}
}
项目:gate-core
文件:LuceneDataStoreSearchGUI.java
@Override
public MouseInputAdapter createListener(String... parameters) {
switch(parameters.length) {
case 1:
return new HeaderMouseListener(parameters[0]);
case 2:
return new HeaderMouseListener(parameters[0], parameters[1]);
default:
return null;
}
}
项目:Progetto-N
文件:GuiPrincipale.java
public void modificaPortata(){
jModificaPortata.addMouseListener(new MouseInputAdapter() {
@Override
public void mousePressed(MouseEvent me) {
try {
GuiModificaPortata gmp = new GuiModificaPortata();
gmp.setVisible(true);
} catch (SQLException ex) {
Logger.getLogger(GuiPrincipale.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
}
项目:geomapapp
文件:WWMapTools.java
public WWMapTools(MapApp app, XMap map, WorldWindowGLCanvas wwCanvas) {
super(app, map);
this.wwCanvas = wwCanvas;
wwCanvas.getInputHandler().addMouseMotionListener(
new MouseInputAdapter() {
@Override
public void mouseMoved(MouseEvent e) {
lastPoint = e.getPoint();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
updateInfo();
}
});
}
});
wwCanvas.addRenderingListener(new RenderingListener() {
public void stageChanged(RenderingEvent event) {
if (event.getStage().equals(RenderingEvent.AFTER_BUFFER_SWAP)) {
alt = WWMapTools.this.wwCanvas.getView().getEyePosition().getElevation()/1000;
SwingUtilities.invokeLater(new Runnable() {
public void run() {
updateInfo();
}
});
}
}
});
}
项目:PhET
文件:DopantPanel.java
public DopantSourceGraphic( final Dopant source, final BufferedImage image, final boolean positive, String name ) {
Dopant dopant = new Dopant( source.getPosition(), positive ? DopantType.P : DopantType.N );
final DopantGraphic dragDopantGraphic = new DopantGraphic( dopant, transform, image, 5 );
CompositeInteractiveGraphic cg = new CompositeInteractiveGraphic();
cg.addGraphic( dragDopantGraphic );
graphic = new DefaultInteractiveGraphic( cg, dragDopantGraphic );
map.put( dragDopantGraphic, graphic );
Translatable t = new Translatable() {
public void translate( double dx, double dy ) {
Point2D trf = transform.viewToModelDifferential( (int) dx, (int) dy );
trf.setLocation( trf.getX() + dragDopantGraphic.getDopant().getPosition().getX(),
trf.getY() + dragDopantGraphic.getDopant().getPosition().getY() );
// trf.x += dragDopantGraphic.getDopant().getPosition().getX();
// trf.y += dragDopantGraphic.getDopant().getPosition().getY();
if ( trf.getX() < 5.7 ) {
dx = 0;
}
// Vector2D.Double pv=dragDopantGraphic.getDestination(dx,dy);
dragDopantGraphic.translate( dx, dy );
apparatusPanel.repaint();
// System.out.println("Calling repaint, time="+System.currentTimeMillis());
}
};
graphic.addCursorHandBehavior();
graphic.addTranslationBehavior( t );
MouseInputAdapter mia = new MouseInputAdapter() {
// implements java.awt.event.MouseListener
public void mouseReleased( MouseEvent e ) {
//dropping the dopant here.
for ( int i = 0; i < dopantListeners.size(); i++ ) {
DopantDropListener dopantDropListener = (DopantDropListener) dopantListeners.get( i );
dopantDropListener.dopantDropped( dragDopantGraphic );
}
}
};
graphic.addMouseInputListener( mia );
}
项目:PhET
文件:EnergyLevelGraphic.java
public EnergyLevelGraphic( Component component, AtomicState atomicState, double groundStateEnergy, double xLoc, double width,
boolean isAdjustable, double iconLocX, boolean clampTopWorkaround ) {
super( null );
this.atomicState = atomicState;
this.groundStateEnergy = groundStateEnergy;
this.isAdjustable = isAdjustable;
this.iconLocX = iconLocX;
//workaround for Unfuddle #571 https://phet.unfuddle.com/projects/9404/tickets/by_number/571
this.clampTopWorkaround = clampTopWorkaround;
// Add a listener that will track changes in the atomic state
atomicState.addListener( new AtomicStateChangeListener() );
this.x = xLoc;
this.width = width;
energyLevelRep = new EnergyLevelRep( component );
addGraphic( energyLevelRep );
if ( this.isAdjustable ) {
setCursorHand();
addTranslationListener( new EnergyLevelTranslator() );
addMouseInputListener( new MouseInputAdapter() {
// implements java.awt.event.MouseListener
public void mouseReleased( MouseEvent e ) {
handleSnapTo();
}
} );
}
}
项目:PhET
文件:ChooseCharacterDialog.java
private void addCharacterPanel( final CharacterPanel characterPanel ) {
contentPanel.add( characterPanel, gridBagConstraints );
characterPanel.addMouseListener( new MouseInputAdapter() {
public void mousePressed( MouseEvent e ) {
EnergySkateParkLogging.println( "e = " + e );
setSelection( characterPanel );
}
} );
characterPanel.setSelected( characterPanel.getSkaterCharacter() == module.getSkaterCharacter() );
characterPanels.add( characterPanel );
}
项目:PhET
文件:DefaultInteractiveGraphic.java
public void addPopupMenuBehavior( final JPopupMenu menu ) {
MouseInputAdapter adapter = new MouseInputAdapter() {
public void mouseReleased( MouseEvent e ) {
if( SwingUtilities.isRightMouseButton( e ) ) {
menu.show( e.getComponent(), e.getX(), e.getY() );
}
}
};
addMouseInputListener( adapter );
}
项目:PhET
文件:ColorControl.java
/**
* Constructor.
*
* @param labelString
* @param color
* @param chipSize
*/
public ColorControl( Frame parentFrame, String labelString, Color color, Dimension chipSize ) {
super();
this.parentFrame = parentFrame;
this.labelString = labelString;
this.chipSize = new Dimension( chipSize );
listenerList = new EventListenerList();
MouseInputListener mouseInputListener = new MouseInputAdapter() {
public void mouseClicked( MouseEvent event ) {
openColorChooser();
}
};
JLabel label = new JLabel( labelString );
label.addMouseListener( mouseInputListener );
colorChip = new JLabel();
colorChip.addMouseListener( mouseInputListener );
add( label );
add( Box.createHorizontalStrut( 5 ) );
add( colorChip );
setColor( color );
}
项目:rplot
文件:ZoomPlotPanel.java
/**
* Creates a new <code>ZoomPlotPanel</code> using the given plot
* panel to render graphs.
*
* @param panel a <code>PlotPanel</code>
* @param container Content pane from parent container
*/
public ZoomPlotPanel(PlotPanel panel, Container container) {
final MouseInputAdapter listener = new ZoomListener();
addMouseListener(listener);
addMouseMotionListener(listener);
mPlotPanel = panel;
mContainer = container;
mGraphicsRenderer = new GraphicsRenderer();
}
项目:rplot
文件:InnerZoomPlot.java
/**
* Creates a new <code>InnerZoomPlot</code> using the given plot
* panel to render graphs.
*
*/
public InnerZoomPlot() {
final MouseInputAdapter listener = new ZoomListener();
addMouseListener(listener);
addMouseMotionListener(listener);
mGraphicsRenderer = new GraphicsRenderer();
mUndoZoomAction = new AbstractAction("Undo Zoom", null) {
@Override
public void actionPerformed(ActionEvent e) {
final Graph2D graph = InnerZoomPlot.super.getGraph();
if (graph != null && !mZoom.mStack.isEmpty()) {
mZoom.mStack.pop(); // Discard current zoom level
ZoomBounds bounds = mZoom.mStack.isEmpty() ? mZoom.mDefault : mZoom.mStack.peek();
bounds.toGraph(graph);
InnerZoomPlot.super.setGraph(graph);
setEnabled(!mZoom.mStack.isEmpty());
}
}
};
setEnabled(!mZoom.mStack.isEmpty());
mDefaultZoomAction = new AbstractAction("Default Zoom", null) {
@Override
public void actionPerformed(ActionEvent e) {
final Graph2D graph = InnerZoomPlot.super.getGraph();
if (graph != null) {
mZoom.mDefault.toGraph(graph);
InnerZoomPlot.super.setGraph(graph);
mZoom.mStack.clear();
mUndoZoomAction.setEnabled(!mZoom.mStack.isEmpty());
}
}
};
}
项目:ALEA
文件:AttributePanel.java
private void init() {
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
if (!PreferenceManager.getInstance().getAsBoolean(PreferenceManager.SHOW_ATTRIBUTE_VIEWS_KEY)) {
setSize(0, getHeight());
}
setBackground(new java.awt.Color(255, 255, 255));
setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
setPreferredSize(new java.awt.Dimension(0, 0));
setVerifyInputWhenFocusTarget(false);
MouseInputAdapter mouseAdapter = new AttributePanelMouseAdapter();
addMouseMotionListener(mouseAdapter);
addMouseListener(mouseAdapter);
}
项目:ALEA
文件:RegionOfInterestPanel.java
public RegionOfInterestPanel(ReferenceFrame frame) {
setToolTipText("Regions of Interest");
this.frame = frame;
MouseInputAdapter ma = new ROIMouseAdapater();
addMouseListener(ma);
addMouseMotionListener(ma);
}
项目:intellij-ce-playground
文件:ChooseApiLevelDialog.java
@Nullable
@Override
protected JComponent createCenterPanel() {
myDistributionChart = new DistributionChartComponent();
myDistributionChart.registerDistributionSelectionChangedListener(this);
myChartPanel.setLayout(new BorderLayout());
myChartPanel.add(myDistributionChart, BorderLayout.CENTER);
myDistributionChart.init();
myScrollPane.getViewport().setOpaque(false);
myScrollPane.setOpaque(false);
myScrollPane.setBorder(null);
myDescriptionLeft.setForeground(JBColor.foreground());
myDescriptionLeft.setBackground(JBColor.background());
myDescriptionRight.setForeground(JBColor.foreground());
myDescriptionRight.setBackground(JBColor.background());
myLearnMoreLinkLabel.setForeground(JBColor.blue);
myLearnMoreLinkLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
Font font = myLearnMoreLinkLabel.getFont();
Map attributes = font.getAttributes();
attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
myLearnMoreLinkLabel.setFont(font.deriveFont(attributes));
myLearnMoreLinkLabel.addMouseListener(new MouseInputAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
try {
BrowserUtil.browse(new URL(myLearnMoreLinkLabel.getText()));
}
catch (MalformedURLException e1) {
// Pass
}
}
});
if (mySelectedApiLevel >= 0) {
Distribution d = DistributionService.getInstance().getDistributionForApiLevel(mySelectedApiLevel);
if (d != null) {
myDistributionChart.selectDistribution(d);
}
}
return myPanel;
}
项目:confluence.keygen
文件:DefaultInputBlocker.java
BusyGlassPane()
/* 281: */ {
/* 282:296 */ super(false);
/* 283:297 */ setVisible(false);
/* 284:298 */ setOpaque(false);
/* 285:299 */ setCursor(Cursor.getPredefinedCursor(3));
/* 286:300 */ MouseInputListener blockMouseEvents = new MouseInputAdapter() {};
/* 287:301 */ addMouseMotionListener(blockMouseEvents);
/* 288:302 */ addMouseListener(blockMouseEvents);
/* 289: */ }
项目:swingx
文件:GradientPreviewPanel.java
public GradientPreviewPanel() {
start = new Point2D.Float(10,10);
end = new Point2D.Float(80,10);
checker_texture = PaintUtils.getCheckerPaint();
MouseInputAdapter ma = new GradientMouseHandler();
this.addMouseListener(ma);
this.addMouseMotionListener(ma);
}
项目:aibench-project
文件:GradientPreviewPanel.java
public GradientPreviewPanel() {
start = new Point2D.Float(10,10);
end = new Point2D.Float(80,10);
checker_texture = ColorUtil.getCheckerPaint();
MouseInputAdapter ma = new GradientMouseHandler();
this.addMouseListener(ma);
this.addMouseMotionListener(ma);
}
项目:MMClearVolumePlugin
文件:ScrollBarAnimateIcon.java
public void initialize() {
setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
setToolTipText("Toggle animation of the " + axis_ + " axis.");
addMouseListener(new MouseInputAdapter() {
@Override
public void mousePressed(MouseEvent e) {
parent_.toggleAnimation(axis_);
setIsAnimated(!isAnimated_);
}
});
}
项目:harmonic-moon-map-editor
文件:TilePanel.java
public TilePanel(TileFrame tileFrame, TileSheet tileSheet) {
setLayout(null);
this.tileFrame = tileFrame;
this.tileSheet = tileSheet;
tileFrame.addMouseListener(new MouseInputAdapter() {
@Override
public void mouseClicked(MouseEvent event) {
if (TilePanel.this.tileSheet != null) {
int x = 0;
int y = 0;
for (Tile tile : TilePanel.this.tileSheet.getTiles()) {
if (event.getXOnScreen() >= x + TilePanel.this.getLocationOnScreen().getX()
&& event.getXOnScreen() < x + TilePanel.this.getLocationOnScreen().getX() + TilePanel.this.tileSheet.getTileWidth()
&& event.getYOnScreen() >= y + TilePanel.this.getLocationOnScreen().getY()
&& event.getYOnScreen() < y + TilePanel.this.getLocationOnScreen().getY() + TilePanel.this.tileSheet.getTileHeight()) {
tile.setSelected(true);
} else {
tile.setSelected(false);
}
x += TilePanel.this.tileSheet.getTileWidth();
if (x >= getWidth()) {
x = 0;
y += 16;
}
}
TilePanel.this.repaint();
}
}
});
}
项目:cn1
文件:BasicInternalFrameUITest.java
public void testCreateBorderListener() {
MouseInputAdapter listener1 = ui.createBorderListener(frame);
assertTrue("not null", listener1 != null);
assertTrue("instanceof BorderListener",
listener1 instanceof BasicInternalFrameUI.BorderListener);
MouseInputAdapter listener2 = ui.createBorderListener(frame);
assertTrue("new instance", listener1 != listener2);
}
项目:watchdog
文件:WatchDogView.java
private void createRefreshLink(JComponent parent) {
UIUtils.createButton(parent, "Refresh.", new MouseInputAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
update();
}
});
}
项目:phon
文件:RecentProjectsList.java
private void init() {
setLayout(new BorderLayout());
final JPanel actionPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
MatteBorder lineBorder =
BorderFactory.createMatteBorder(1, 1, 1, 1, Color.lightGray);
actionPanel.setBorder(lineBorder);
clearLabel = new JLabel("<html><u style='color: rgb(0, 90, 140);'>Clear History</u></html>");
clearLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
clearLabel.setToolTipText("Clear recent projects history");
clearLabel.addMouseListener(new MouseInputAdapter() {
@Override
public void mouseClicked(MouseEvent me) {
final RecentProjects history = new RecentProjects();
history.clearHistory();
}
});
actionPanel.add(clearLabel);
add(actionPanel, BorderLayout.NORTH);
buttonPanel = new ButtonPanel();
buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.Y_AXIS));
final JScrollPane scrollPanel = new JScrollPane(buttonPanel);
add(scrollPanel, BorderLayout.CENTER);
updateProjectList();
}
项目:phon
文件:SegmentLabel.java
private void init() {
setLayout(new FlowLayout(FlowLayout.LEADING));
startTimeLbl = new JLabel();
startTimeLbl.setIcon(unlockedIcon);
startTimeLbl.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
startTimeLbl.setToolTipText("Click to lock start time to current time");
startTimeLbl.addMouseListener(new MouseInputAdapter() {
@Override
public void mouseClicked(MouseEvent evt) {
if(startLockTime >= 0) {
lockSegmentStartTime(-1L);
} else {
lockSegmentStartTime(getCurrentTime());
}
}
});
currentTimeLbl = new JLabel();
add(startTimeLbl);
add(new JLabel(" - "));
add(currentTimeLbl);
}
项目:phon
文件:DefaultPhoneMapDisplayUI.java
/** Install mouse listener for component */
private void installMouseListener() {
MouseInputAdapter mouseListener =
new AlignmentMouseHandler();
display.addMouseListener(mouseListener);
display.addMouseMotionListener(mouseListener);
}
项目:freeVM
文件:BasicInternalFrameUITest.java
public void testCreateBorderListener() {
MouseInputAdapter listener1 = ui.createBorderListener(frame);
assertTrue("not null", listener1 != null);
assertTrue("instanceof BorderListener",
listener1 instanceof BasicInternalFrameUI.BorderListener);
MouseInputAdapter listener2 = ui.createBorderListener(frame);
assertTrue("new instance", listener1 != listener2);
}
项目:freeVM
文件:BasicInternalFrameUITest.java
public void testCreateBorderListener() {
MouseInputAdapter listener1 = ui.createBorderListener(frame);
assertTrue("not null", listener1 != null);
assertTrue("instanceof BorderListener",
listener1 instanceof BasicInternalFrameUI.BorderListener);
MouseInputAdapter listener2 = ui.createBorderListener(frame);
assertTrue("new instance", listener1 != listener2);
}
项目:PIPE
文件:AnnotationView.java
/**
* Constructor
* @param annotation underlying annotation model
* @param controller Petri net controller for the Petri net the annotation belongs to
* @param parent parent container of this view
* @param handler how the annotation will handle mouse events
*/
public AnnotationView(Annotation annotation, PetriNetController controller, Container parent, MouseInputAdapter handler) {
super(annotation, controller, parent);
addChangeListener(annotation);
setDragPoints();
setMouseHandler(handler);
updateBounds();
}