当前位置: 首页>>代码示例>>Java>>正文


Java MouseInputAdapter类代码示例

本文整理汇总了Java中javax.swing.event.MouseInputAdapter的典型用法代码示例。如果您正苦于以下问题:Java MouseInputAdapter类的具体用法?Java MouseInputAdapter怎么用?Java MouseInputAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MouseInputAdapter类属于javax.swing.event包,在下文中一共展示了MouseInputAdapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: impostaJModificaPrenotazione

import javax.swing.event.MouseInputAdapter; //导入依赖的package包/类
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);
            }
           
        }
    });
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-N,代码行数:17,代码来源:GuiPrincipale.java

示例2: impostaRimuovi

import javax.swing.event.MouseInputAdapter; //导入依赖的package包/类
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);
                           
                        }
                    }  
                }
            } 
        }
    });
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-N,代码行数:23,代码来源:GuiPrincipale.java

示例3: ThisWiggleMeGraphic

import javax.swing.event.MouseInputAdapter; //导入依赖的package包/类
/**
 * 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 );
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:28,代码来源:DiscreteModule.java

示例4: createLogoPanel

import javax.swing.event.MouseInputAdapter; //导入依赖的package包/类
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;
    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:24,代码来源:PhetAboutDialog.java

示例5: PageView

import javax.swing.event.MouseInputAdapter; //导入依赖的package包/类
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);
}
 
开发者ID:SmallLars,项目名称:esadb,代码行数:17,代码来源:PageView.java

示例6: Menu

import javax.swing.event.MouseInputAdapter; //导入依赖的package包/类
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());
                }
            }
        }
    });
}
 
开发者ID:seventhroot,项目名称:harmonic-moon,代码行数:26,代码来源:Menu.java

示例7: buildChooser

import javax.swing.event.MouseInputAdapter; //导入依赖的package包/类
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);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:27,代码来源:SwatchesPanel.java

示例8: init

import javax.swing.event.MouseInputAdapter; //导入依赖的package包/类
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));
}
 
开发者ID:phon-ca,项目名称:phon,代码行数:27,代码来源:CommonModuleFrame.java

示例9: DiagramCanvas

import javax.swing.event.MouseInputAdapter; //导入依赖的package包/类
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));
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:20,代码来源:DiagramCanvas.java

示例10: TransitionView

import javax.swing.event.MouseInputAdapter; //导入依赖的package包/类
/**
 * 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);

}
 
开发者ID:sarahtattersall,项目名称:PIPE,代码行数:26,代码来源:TransitionView.java

示例11: DisplayPane

import javax.swing.event.MouseInputAdapter; //导入依赖的package包/类
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
    });

}
 
开发者ID:MASPlanes,项目名称:MASPlanes,代码行数:25,代码来源:DisplayPane.java

示例12: init

import javax.swing.event.MouseInputAdapter; //导入依赖的package包/类
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;
  }
 
开发者ID:Abstrys,项目名称:ConsoleKit,代码行数:21,代码来源:TerminalPanel.java

示例13: createListener

import javax.swing.event.MouseInputAdapter; //导入依赖的package包/类
@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;
  }
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:13,代码来源:LuceneDataStoreSearchGUI.java

示例14: modificaPortata

import javax.swing.event.MouseInputAdapter; //导入依赖的package包/类
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);
            }
           
        }
    });
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-N,代码行数:16,代码来源:GuiPrincipale.java

示例15: WWMapTools

import javax.swing.event.MouseInputAdapter; //导入依赖的package包/类
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();
					}
				});
			}
		}
	});
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:33,代码来源:WWMapTools.java


注:本文中的javax.swing.event.MouseInputAdapter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。