Java Code Examples for java.awt.event.MouseAdapter

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project addis, under directory /application/src/main/java/org/drugis/addis/gui/components/.

Source file: JTableWithPopupEditor.java

  17 
vote

private void registerDestroyInputMouseListener(Component component){
  component.addMouseListener(new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent e){
      destroyInputWindow();
    }
  }
);
}
 

Example 2

From project codjo-standalone-common, under directory /src/main/java/net/codjo/utils/sql/.

Source file: TableRendererSorter.java

  17 
vote

/** 
 * Adds a feature to the MouseListenerToHeaderInTable attribute of the TableRendererSorter object
 * @param table The feature to be added to the MouseListenerToHeaderInTable attribute
 */
public void addMouseListenerToHeaderInTable(JTable table){
  final TableRendererSorter sorter=this;
  final JTable tableView=table;
  tableView.setColumnSelectionAllowed(false);
  MouseAdapter listMouseListener=new MouseAdapter(){
    /** 
 * Overview. <p> Description </p>
 * @param e Description of Parameter
 */
    public void mousePressed(    MouseEvent e){
      TableColumnModel columnModel=tableView.getColumnModel();
      int viewColumn=columnModel.getColumnIndexAtX(e.getX());
      int column=tableView.convertColumnIndexToModel(viewColumn);
      if (e.getClickCount() > 1 && column != -1) {
        sorter.sortByColumn(column);
      }
    }
  }
;
  JTableHeader th=tableView.getTableHeader();
  th.addMouseListener(listMouseListener);
}
 

Example 3

From project CommunityCase, under directory /src/org/community/intellij/plugins/communitycase/history/wholeTree/.

Source file: BasePopupAction.java

  17 
vote

public BasePopupAction(final Project project,final String labeltext){
  myProject=project;
  myPanel=new JPanel();
  final BoxLayout layout=new BoxLayout(myPanel,BoxLayout.X_AXIS);
  myPanel.setLayout(layout);
  myLabel=new JLabel();
  final JLabel show=new JLabel(labeltext);
  show.setFont(show.getFont().deriveFont(Font.ITALIC));
  show.setForeground(UIUtil.getInactiveTextColor());
  show.setBorder(BorderFactory.createEmptyBorder(1,2,1,1));
  myLabel.setFont(myLabel.getFont().deriveFont(Font.BOLD));
  myPanel.add(show);
  myPanel.add(myLabel);
  myPanel.setBorder(new CompoundBorder(BorderFactory.createEmptyBorder(2,2,2,2),BorderFactory.createEtchedBorder()));
  final JLabel iconLabel=new JLabel(ARROWS_ICON);
  iconLabel.setBorder(BorderFactory.createEmptyBorder(0,0,0,2));
  myPanel.add(iconLabel,myLabel);
  final MouseAdapter mouseAdapter=new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent e){
      doAction(e);
    }
  }
;
  myPanel.addMouseListener(mouseAdapter);
}
 

Example 4

From project drugis-common, under directory /common-gui/src/main/java/org/drugis/common/gui/table/.

Source file: EnhancedTableHeader.java

  17 
vote

public EnhancedTableHeader(TableColumnModel cm,JTable table){
  super(cm);
  this.d_table=table;
  addMouseListener(new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent e){
      doMouseClicked(e);
    }
  }
);
}
 

Example 5

From project en4j, under directory /NBPlatformApp/MainModule/src/main/java/com/rubenlaguna/en4j/mainmodule/.

Source file: CustomGlassPane.java

  17 
vote

public CustomGlassPane(){
  addMouseListener(new MouseAdapter(){
  }
);
  addMouseMotionListener(new MouseMotionAdapter(){
  }
);
  addKeyListener(new KeyAdapter(){
  }
);
}
 

Example 6

From project GraphLab, under directory /src/graphlab/plugins/main/core/actions/.

Source file: LastSelectedStatusAction.java

  17 
vote

private void handleMouseListener(){
  if (l == null)   return;
  if (!labelHandled) {
    l.addMouseListener(new MouseAdapter(){
      public void mouseClicked(      MouseEvent e){
        ObjectViewer.showObject(last);
      }
    }
);
    labelHandled=true;
  }
}
 

Example 7

From project groovejaar, under directory /src/groovejaar/.

Source file: ExtendedTextField.java

  17 
vote

/** 
 * Initialize's specific behaviour for this class.
 */
protected void initialize(){
  this.addMouseListener(new MouseAdapter(){
    public void mouseClicked(    MouseEvent evt){
      requestFocus();
      dealWithMousePress(evt);
    }
  }
);
}
 

Example 8

From project Haven-and-Hearth-client-modified-by-Ender, under directory /src/haven/.

Source file: HavenApplet.java

  17 
vote

public ErrorPanel(){
  setBackground(Color.BLACK);
  addMouseListener(new MouseAdapter(){
    public void mouseClicked(    MouseEvent e){
      if (ar && !running) {
        HavenApplet.this.remove(ErrorPanel.this);
        startgame();
      }
    }
  }
);
}
 

Example 9

From project hudsontrayapp-plugin, under directory /client-common/src/main/java/com/sun/swing/.

Source file: TableSorter.java

  17 
vote

public void addMouseListenerToHeaderInTable(JTable table){
  final TableSorter sorter=this;
  final JTable tableView=table;
  tableView.setColumnSelectionAllowed(false);
  MouseAdapter listMouseListener=new MouseAdapter(){
    public void mouseClicked(    MouseEvent e){
      TableColumnModel columnModel=tableView.getColumnModel();
      int viewColumn=columnModel.getColumnIndexAtX(e.getX());
      int column=tableView.convertColumnIndexToModel(viewColumn);
      if (e.getClickCount() == 1 && column != -1) {
        System.out.println("Sorting ...");
        boolean ascending=!TableSorter.this.ascending;
        sorter.sortByColumn(column,ascending);
      }
    }
  }
;
  JTableHeader th=tableView.getTableHeader();
  th.addMouseListener(listMouseListener);
}
 

Example 10

From project ISAconfigurator, under directory /src/main/java/org/isatools/isacreatorconfigurator/configui/.

Source file: DataEntryPanel.java

  17 
vote

private void setupAboutPanel(){
  aboutPanel=new AboutPanel();
  aboutPanel.addMouseListener(new MouseAdapter(){
    public void mousePressed(    MouseEvent event){
      applicationContainer.hideGlassPane();
    }
  }
);
}
 

Example 11

From project ISAcreator, under directory /src/main/java/org/isatools/isacreator/effects/.

Source file: InfiniteImageProgressPanel.java

  17 
vote

public InfiniteImageProgressPanel(ImageIcon image){
  setLayout(new BorderLayout());
  setOpaque(false);
  add(new JLabel(image));
  addMouseListener(new MouseAdapter(){
  }
);
}
 

Example 12

From project jgraphx, under directory /src/com/mxgraph/swing/.

Source file: mxGraphComponent.java

  17 
vote

/** 
 * installs a handler to set the focus to the container.
 */
protected void installFocusHandler(){
  graphControl.addMouseListener(new MouseAdapter(){
    public void mousePressed(    MouseEvent e){
      if (!hasFocus()) {
        requestFocus();
      }
    }
  }
);
}
 

Example 13

From project jMemorize, under directory /src/jmemorize/gui/swing/widgets/.

Source file: CardTable.java

  17 
vote

/** 
 * Hook the card context menu to given JComponent. Attaches a MouseListener to the given component which checks for right mouse button clicks and shows the context menu.
 */
public void hookCardContextMenu(JComponent comp){
  comp.addMouseListener(new MouseAdapter(){
    public void mouseClicked(    MouseEvent e){
      if (SwingUtilities.isRightMouseButton(e)) {
        int row=rowAtPoint(e.getPoint());
        if (!selectionModel.isSelectedIndex(row)) {
          selectionModel.setSelectionInterval(row,row);
        }
        m_cardMenu.show(e.getComponent(),e.getX(),e.getY());
      }
    }
  }
);
}
 

Example 14

From project jsmaa, under directory /gui/src/main/java/fi/smaa/jsmaa/gui/components/.

Source file: EnhancedTableHeader.java

  17 
vote

public EnhancedTableHeader(TableColumnModel cm,JTable table){
  super(cm);
  this.d_table=table;
  addMouseListener(new MouseAdapter(){
    public void mouseClicked(    MouseEvent e){
      doMouseClicked(e);
    }
  }
);
}
 

Example 15

From project maple-ide, under directory /build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/.

Source file: GlassPane.java

  17 
vote

public GlassPane(Window w){
  _window=w;
  addMouseListener(new MouseAdapter(){
  }
);
  addKeyListener(new KeyAdapter(){
  }
);
  setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
}
 

Example 16

From project mdk, under directory /ui/src/main/java/net/sf/furbelow/.

Source file: WaitIndicator.java

  17 
vote

/** 
 * Place the wait indicator over the given component. 
 */
public WaitIndicator(JComponent target){
  super(target);
  KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(this);
  getPainter().addMouseListener(new MouseAdapter(){
  }
);
  getPainter().addMouseMotionListener(new MouseMotionAdapter(){
  }
);
  getPainter().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
}
 

Example 17

From project medsavant, under directory /medsavant/MedSavantClient/src/org/ut/biolab/medsavant/view/patients/.

Source file: CohortWizard.java

  17 
vote

@Override public ButtonPanel createButtonPanel(){
  ButtonPanel bp=super.createButtonPanel();
  bp.removeButton((AbstractButton)bp.getButtonByName(ButtonNames.FINISH));
  JButton finishButton=new JButton("Finish");
  finishButton.setName(ButtonNames.FINISH);
  finishButton.addMouseListener(new MouseAdapter(){
    @Override public void mouseReleased(    MouseEvent e){
      finish();
    }
  }
);
  bp.addButton(finishButton);
  return bp;
}
 

Example 18

From project parasim, under directory /extensions/visualisation-plot-impl/src/main/java/org/sybila/parasim/visualisation/plot/impl/gui/.

Source file: CanvasPane.java

  17 
vote

/** 
 * Initiate object. Uses following configurable values: <ul> <li> {@link ResultPlotterConfiguration#getGuidesColor()} as guiding lines color.</li><li> {@link ResultPlotterConfiguration#getShowGuides()} to determine whether guiding lines should be rendered.</li></ul>
 * @param conf This extension configuration.
 * @param canvas Contained plot area.
 * @param onUpdate Listener notified when mouse position is updated.
 */
public CanvasPane(ResultPlotterConfiguration conf,Canvas canvas,PositionChangeListener onUpdate){
  contents=canvas;
  update=onUpdate;
  setContentPane(canvas);
  setGlassPane(new Overlay(conf.getGuidesColor()));
  getGlassPane().setVisible(conf.getShowGuides());
  MouseAdapter mouseActions=new MouseAdapter(){
    @Override public void mouseMoved(    MouseEvent e){
      moveMouse(e.getPoint());
    }
    @Override public void mouseDragged(    MouseEvent e){
      moveMouse(e.getPoint());
    }
    @Override public void mouseExited(    MouseEvent e){
      position=null;
      getGlassPane().repaint();
    }
  }
;
  addMouseListener(mouseActions);
  addMouseMotionListener(mouseActions);
}
 

Example 19

From project pomodoro-tm, under directory /src/ru/greeneyes/project/pomidoro/modalwindow/.

Source file: ModalForm.java

  17 
vote

public ModalForm(final FormModel model){
  this.model=model;
  $$$setupUI$$$();
  MouseAdapter mouseAdapter=new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent mouseEvent){
      if (mouseEvent.getClickCount() == 1) {
        model.userClick();
        updateUI();
      }
    }
  }
;
  rootPanel.addMouseListener(mouseAdapter);
  messageLabel.addMouseListener(mouseAdapter);
  updateUI();
}
 

Example 20

From project RomRaider, under directory /3rdparty/launch4j/src/net/sf/launch4j/formimpl/.

Source file: GlassPane.java

  17 
vote

public GlassPane(Window w){
  _window=w;
  addMouseListener(new MouseAdapter(){
  }
);
  addKeyListener(new KeyAdapter(){
  }
);
  setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
}
 

Example 21

From project sikuli, under directory /extensions/guide/src/main/java/org/sikuli/guide/.

Source file: UndoDrawing.java

  17 
vote

public UndoableDrawingPanel(){
  MouseListener mouseListener=new MouseAdapter(){
    public void mouseReleased(    MouseEvent mouseEvent){
      undoableEditSupport.postEdit(new UndoableDrawEdit(UndoableDrawingPanel.this));
      polygon.addPoint(mouseEvent.getX(),mouseEvent.getY());
      repaint();
    }
  }
;
  addMouseListener(mouseListener);
}
 

Example 22

From project SPREAD, under directory /release/tools/launch4j/src/net/sf/launch4j/formimpl/.

Source file: GlassPane.java

  17 
vote

public GlassPane(Window w){
  _window=w;
  addMouseListener(new MouseAdapter(){
  }
);
  addKeyListener(new KeyAdapter(){
  }
);
  setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
}
 

Example 23

From project Supersonic, under directory /src/main/java/be/hehehe/supersonic/panels/.

Source file: CoverPanel.java

  17 
vote

@PostConstruct public void init(){
  addMouseListener(new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent e){
      if (image != null) {
        coverDialog.open(image,songModel);
      }
    }
  }
);
}
 

Example 24

From project SwingOSC, under directory /src/main/java/de/sciss/swingosc/.

Source file: ScopeView.java

  17 
vote

public ScopeView(){
  super();
  setOpaque(true);
  setBackground(Color.black);
  setFocusable(true);
  addMouseListener(new MouseAdapter(){
    public void mousePressed(    MouseEvent e){
      requestFocus();
    }
  }
);
  timer=new Timer(1000,this);
  timer.setRepeats(true);
}
 

Example 25

From project TransFile, under directory /src/net/sourceforge/transfile/ui/swing/.

Source file: OperationComponent.java

  17 
vote

/** 
 * @param selectionModel <br>Can be null <br>Shared parameter
 * @param operation <br>Should not be null <br>Shared parameter
 */
public OperationComponent(final SelectionModel selectionModel,final Operation operation){
  this.selectionModel=selectionModel;
  this.operation=operation;
  this.addMouseListener(new MouseAdapter(){
    @Override public final void mousePressed(    final MouseEvent event){
      OperationComponent.this.select();
    }
  }
);
  this.setup();
}
 

Example 26

From project TraVis, under directory /src/travis/view/settings/.

Source file: ColorsPanel.java

  17 
vote

public ColorRow(final String text){
  super(new MigLayout("wrap 2, insets 2"));
  panel=createColorPanel();
  label=new JLabel(text);
  MouseAdapter mouseAdapter=new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent e){
      String title=String.format("%s %s",text,Messages.get("color"));
      Color c=JColorChooser.showDialog(UIHelper.getInstance().getMainFrame(),title,panel.getBackground());
      if (c != null) {
        panel.setBackground(c);
        updateColors();
        themesBox.setSelectedIndex(USER_INDEX);
      }
    }
  }
;
  panel.addMouseListener(mouseAdapter);
  label.addMouseListener(mouseAdapter);
  add(panel,COLOR_CONSTRAINTS);
  add(label);
}
 

Example 27

From project Zypr-Reference-Client---Java, under directory /source/net/zypr/gui/components/.

Source file: PressAndHoldButton.java

  17 
vote

protected void jbInit(String iconDefault,String iconPressed,String iconDisabled,float alpha){
  super.jbInit(iconDefault,iconPressed,iconDisabled,alpha);
  this.addMouseListener(new MouseAdapter(){
    public void mousePressed(    MouseEvent mouseEvent){
      this_mousePressed(mouseEvent);
    }
    public void mouseReleased(    MouseEvent mouseEvent){
      this_mouseReleased(mouseEvent);
    }
  }
);
}
 

Example 28

From project ardverk-dht, under directory /components/tools/src/main/java/org/ardverk/dht/ui/.

Source file: PainterPanel.java

  16 
vote

public PainterPanel(DHT dht){
  this.dht=dht;
  Contact localhost=dht.getIdentity();
  KUID localhostId=localhost.getId();
  painters.add(new JuicePainter(localhostId));
  painters.add(new SquashPainter(localhostId));
  addMouseListener(new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent e){
      if (!painters.isEmpty()) {
        current=(current + 1) % painters.size();
        repaint();
      }
    }
  }
);
}
 

Example 29

From project BMach, under directory /src/jsyntaxpane/components/.

Source file: LineNumbersRuler.java

  16 
vote

@Override public void install(final JEditorPane editor){
  this.editor=editor;
  setFont(editor.getFont());
  editor.getDocument().addDocumentListener(this);
  editor.addCaretListener(this);
  editor.addPropertyChangeListener(this);
  JScrollPane sp=getScrollPane(editor);
  sp.setRowHeaderView(this);
  mouseListener=new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent e){
      GotoLineDialog.showForEditor(editor);
    }
  }
;
  addMouseListener(mouseListener);
  status=Status.INSTALLING;
}
 

Example 30

From project Chess_1, under directory /src/chess/gui/.

Source file: GUIController.java

  16 
vote

/** 
 * Creates a new controller tied to the specified display and gui frame.
 * @param parent the frame for the world window
 * @param disp the panel that displays the grid
 * @param displayMap the map for occupant displays
 * @param res the resource bundle for message display
 */
public GUIController(WorldFrame<T> parent,GridPanel disp,DisplayMap displayMap,ResourceBundle res){
  resources=res;
  display=disp;
  parentFrame=parent;
  this.displayMap=displayMap;
  makeControls();
  occupantClasses=new TreeSet<Class>(new Comparator<Class>(){
    public int compare(    Class a,    Class b){
      return a.getName().compareTo(b.getName());
    }
  }
);
  World<T> world=parentFrame.getWorld();
  Grid<T> gr=world.getGrid();
  for (  Location loc : gr.getOccupiedLocations())   addOccupant(gr.get(loc));
  for (  String name : world.getOccupantClasses())   try {
    occupantClasses.add(Class.forName(name));
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
  timer=new Timer(INITIAL_DELAY,new ActionListener(){
    public void actionPerformed(    ActionEvent evt){
      step();
    }
  }
);
  display.addMouseListener(new MouseAdapter(){
    public void mousePressed(    MouseEvent evt){
      Grid<T> gr=parentFrame.getWorld().getGrid();
      Location loc=display.locationForPoint(evt.getPoint());
      if (loc != null && gr.isValid(loc) && !isRunning()) {
        display.setCurrentLocation(loc);
        locationClicked();
      }
    }
  }
);
  stop();
}
 

Example 31

From project Cinch, under directory /example/com/palantir/ptoss/cinch/example/demo/.

Source file: DrawingCanvas.java

  16 
vote

private void initializeListeners(){
  addMouseListener(new MouseAdapter(){
    @Override public void mousePressed(    MouseEvent e){
      processPoint(e);
    }
  }
);
  addMouseMotionListener(new MouseMotionAdapter(){
    @Override public void mouseDragged(    MouseEvent e){
      if (model.isAllowDrag()) {
        processPoint(e);
      }
    }
  }
);
}
 

Example 32

From project Clotho-Core, under directory /ClothoApps/CollectionViewTool/src/org/clothocad/tool/collectionview/.

Source file: GlassMessage.java

  16 
vote

/** 
 * Creates a new instance of SmoothAnimation 
 */
public GlassMessage(String msg,String secondmsg,int wide,int high,Container cont,Color bkg,ActionListener al){
  imageW=wide;
  imageH=high;
  container=cont;
  message=msg;
  bkgColor=bkg;
  actionOnClick=al;
  message2=secondmsg;
  addMouseListener(new MouseAdapter(){
    @Override public void mousePressed(    MouseEvent e){
      if (closeCircle == null) {
        return;
      }
      if (closeCircle.getBounds().contains(e.getPoint())) {
        dumpit();
      }
 else {
        if (actionOnClick != null) {
          actionOnClick.actionPerformed(null);
        }
      }
    }
  }
);
  startTimer(currentResolution);
}
 

Example 33

From project codjo-data-process, under directory /codjo-data-process-gui/src/main/java/net/codjo/dataprocess/gui/launcher/.

Source file: ManagerStateModifier.java

  16 
vote

private void initPopup(){
  popupMenu.add(new ShowDependencyAction(false));
  popupMenu.add(new ShowImplicationAction(false));
  popupMenu.addSeparator();
  popupMenu.add(new DesactivableAction("Forcer l'?at  : FAIT",true){
    public void actionPerformed(    ActionEvent e){
      changeState(launcherWindow.getSelectedExecutionListModel(),DataProcessConstants.DONE);
    }
  }
);
  popupMenu.add(new DesactivableAction("Forcer l'?at  : A FAIRE",true){
    public void actionPerformed(    ActionEvent e){
      changeState(launcherWindow.getSelectedExecutionListModel(),DataProcessConstants.TO_DO);
    }
  }
);
  popupMenu.add(new DesactivableAction("Forcer l'?at  : ECHEC",true){
    public void actionPerformed(    ActionEvent e){
      changeState(launcherWindow.getSelectedExecutionListModel(),DataProcessConstants.FAILED);
    }
  }
);
  if (ctxt.getUser().isInRole(dataProcessGuiPlugin.getConfiguration().getMaintenanceRoleName())) {
    popupMenu.addSeparator();
    popupMenu.add(new ShowTreatmentAction(true));
  }
  launcherWindow.getRequestTable().addMouseListener(new MouseAdapter(){
    @Override public void mousePressed(    MouseEvent ev){
      tableMousePressed(ev);
    }
    @Override public void mouseReleased(    MouseEvent ev){
      maybeShowPopup(ev);
    }
  }
);
}
 

Example 34

From project datavalve, under directory /samples/swingDemo/src/main/java/org/fluttercode/datavalve/samples/swingdemo/.

Source file: Main.java

  16 
vote

private void initClickableColumns(final ProviderTableModel<Person> model){
  table.getTableHeader().addMouseListener(new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent e){
      TableColumnModel cm=table.getColumnModel();
      int ci=cm.getColumnIndexAtX(e.getX());
      int idx=table.convertColumnIndexToModel(ci);
switch (idx) {
case 0:
        model.getPaginator().changeOrderKey("id");
      break;
case 1:
    model.getPaginator().changeOrderKey("name");
  break;
case 2:
model.getPaginator().changeOrderKey("phone");
break;
}
model.invalidate();
table.repaint();
}
}
);
}
 

Example 35

From project des, under directory /daemon/lib/apache-log4j-1.2.16/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/.

Source file: CategoryNodeEditor.java

  16 
vote

public CategoryNodeEditor(CategoryExplorerModel model){
  _renderer=new CategoryNodeEditorRenderer();
  _checkBox=_renderer.getCheckBox();
  _categoryModel=model;
  _checkBox.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      _categoryModel.update(_lastEditedNode,_checkBox.isSelected());
      stopCellEditing();
    }
  }
);
  _renderer.addMouseListener(new MouseAdapter(){
    public void mousePressed(    MouseEvent e){
      if ((e.getModifiers() & MouseEvent.BUTTON3_MASK) != 0) {
        showPopup(_lastEditedNode,e.getX(),e.getY());
      }
      stopCellEditing();
    }
  }
);
}
 

Example 36

From project drools-planner, under directory /drools-planner-examples/src/main/java/org/drools/planner/examples/app/.

Source file: DroolsPlannerExamplesApp.java

  16 
vote

private JButton createExampleButton(final String title,final String description,String iconResource,final Runnable runnable){
  ImageIcon icon=iconResource == null ? null : new ImageIcon(getClass().getResource(iconResource));
  JButton button=new JButton(new AbstractAction(title,icon){
    public void actionPerformed(    ActionEvent e){
      runnable.run();
    }
  }
);
  button.setHorizontalTextPosition(JButton.CENTER);
  button.setVerticalTextPosition(JButton.BOTTOM);
  button.addMouseListener(new MouseAdapter(){
    public void mouseEntered(    MouseEvent e){
      descriptionTextArea.setText(description);
    }
    public void mouseExited(    MouseEvent e){
      descriptionTextArea.setText("");
    }
  }
);
  return button;
}
 

Example 37

From project droolsjbpm-integration, under directory /droolsjbpm-integration-examples/src/main/java/org/drools/examples/conway/ui/.

Source file: CellGridCanvas.java

  16 
vote

/** 
 * Constructs a CellGridCanvas.
 * @param cellGrid the GoL cellgrid
 */
public CellGridCanvas(final CellGrid cellGrid){
  this.cellGrid=cellGrid;
  this.cellSize=this.liveCellImage.getWidth(this);
  setBackground(CellGridCanvas.GRID_COLOR);
  addMouseListener(new MouseAdapter(){
    /** 
 * Invoked when a mouse button has been pressed on a component.
 */
    public void mousePressed(    final MouseEvent e){
      toggleCellAt(e.getX(),e.getY());
    }
  }
);
  addMouseMotionListener(new MouseMotionAdapter(){
    public void mouseDragged(    final MouseEvent e){
      final Cell cell=getCellAtPoint(e.getX(),e.getY());
      if (cell != null) {
        cellGrid.updateCell(cell,CellState.LIVE);
        repaint();
      }
    }
  }
);
}
 

Example 38

From project extension_libero_manufacturing, under directory /extension/eevolution/libero/src/main/java/it/cnr/imaa/essi/lablib/gui/checkboxtree/.

Source file: QuadristateCheckbox.java

  16 
vote

public QuadristateCheckbox(String text,Icon icon,State state){
  super(text,icon);
  super.addMouseListener(new MouseAdapter(){
    @Override public void mousePressed(    MouseEvent e){
      grabFocus();
      getModel().nextState();
    }
  }
);
  ActionMap map=new ActionMapUIResource();
  map.put("pressed",new AbstractAction(){
    public void actionPerformed(    ActionEvent e){
      grabFocus();
      getModel().nextState();
    }
  }
);
  map.put("released",null);
  SwingUtilities.replaceUIActionMap(this,map);
  setState(state);
}
 

Example 39

From project FBReaderJ, under directory /obsolete/swing/src/org/geometerplus/zlibrary/ui/swing/dialogs/.

Source file: ZLBoolean3OptionView.java

  16 
vote

public TristateCheckBox(String text,State initial){
  super(text);
  Icon icon=new TristateCheckBoxIcon();
  super.setIcon(icon);
  super.addMouseListener(new MouseAdapter(){
    public void mousePressed(    MouseEvent e){
      TristateCheckBox.this.mousePressed();
    }
    public void mouseReleased(    MouseEvent e){
      TristateCheckBox.this.mouseReleased();
    }
  }
);
  ActionMap map=new ActionMapUIResource();
  map.put("pressed",new AbstractAction(){
    public void actionPerformed(    ActionEvent e){
      TristateCheckBox.this.mousePressed();
    }
  }
);
  map.put("released",new AbstractAction(){
    public void actionPerformed(    ActionEvent e){
      TristateCheckBox.this.mouseReleased();
    }
  }
);
  SwingUtilities.replaceUIActionMap(this,map);
  model=new TristateModel(getModel());
  setModel(model);
  setState(initial);
}
 

Example 40

From project flyingsaucer, under directory /flying-saucer-examples/src/main/java/.

Source file: ImageMapReplacedElementFactory.java

  16 
vote

public ImageMapReplacedElement(Image image,Node map,int targetWidth,int targetHeight,final ImageMapListener listener){
  super(create(image,targetWidth,targetHeight));
  areas=parseMap(map);
  getJComponent().addMouseListener(new MouseAdapter(){
    public void mouseClicked(    MouseEvent e){
      final Point point=e.getPoint();
      final Set set=areas.entrySet();
      for (Iterator iterator=set.iterator(); iterator.hasNext(); ) {
        Map.Entry entry=(Map.Entry)iterator.next();
        if (((Shape)entry.getKey()).contains(point)) {
          listener.areaClicked(new ImageMapEvent(this,(String)entry.getValue()));
        }
      }
    }
    public void mouseExited(    MouseEvent e){
      getJComponent().setCursor(Cursor.getDefaultCursor());
    }
  }
);
  getJComponent().addMouseMotionListener(new MouseMotionAdapter(){
    public void mouseMoved(    MouseEvent e){
      final JComponent c=getJComponent();
      final Point point=e.getPoint();
      final Set set=areas.entrySet();
      for (Iterator iterator=set.iterator(); iterator.hasNext(); ) {
        Map.Entry entry=(Map.Entry)iterator.next();
        if (((Shape)entry.getKey()).contains(point)) {
          updateCursor(c,Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
          return;
        }
      }
      updateCursor(c,Cursor.getDefaultCursor());
    }
  }
);
}
 

Example 41

From project freemind, under directory /freemind/freemind/common/.

Source file: ColorProperty.java

  16 
vote

public void layout(DefaultFormBuilder builder,TextTranslator pTranslator){
  JLabel label=builder.append(pTranslator.getText(getLabel()),mButton);
  label.setToolTipText(pTranslator.getText(getDescription()));
  JMenuItem item=new JMenuItem(mTranslator.getText("ColorProperty.ResetColor"));
  item.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      setValue(defaultColor);
    }
  }
);
  menu.add(item);
  mButton.addMouseListener(new MouseAdapter(){
    public void mousePressed(    MouseEvent evt){
      if (evt.isPopupTrigger()) {
        menu.show(evt.getComponent(),evt.getX(),evt.getY());
      }
    }
    public void mouseReleased(    MouseEvent evt){
      if (evt.isPopupTrigger()) {
        menu.show(evt.getComponent(),evt.getX(),evt.getY());
      }
    }
  }
);
}
 

Example 42

From project GAIL, under directory /src/gail/.

Source file: GraphDemo.java

  16 
vote

private void makeDraggable(Node n){
  n.addMouseListener(new MouseAdapter(){
    @Override public void mousePressed(    MouseEvent e){
      dragStart=e.getPoint();
    }
  }
);
  n.addMouseMotionListener(new MouseMotionAdapter(){
    @Override public void mouseDragged(    MouseEvent e){
      Component dragTarget=(Component)e.getSource();
      Point location=dragTarget.getLocation();
      dragTarget.setLocation(location.x + e.getX() - dragStart.x,location.y + e.getY() - dragStart.y);
      repaint();
    }
  }
);
}
 

Example 43

From project gridland, under directory /src/org/grid/server/.

Source file: ClientsPanel.java

  16 
vote

private ClientPanel(Client cl){
  super();
  this.client=cl;
  client.addListener(this);
  setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  setLayout(new BorderLayout(3,3));
  Box box=new Box(BoxLayout.Y_AXIS);
  add(box,BorderLayout.CENTER);
  clientInfo.setPreferredSize(new Dimension(500,30));
  clientInfo.setFont(getFont().deriveFont(Font.BOLD,12.0f));
  agentInfo.setFont(getFont().deriveFont(Font.PLAIN,9.0f));
  box.add(clientInfo);
  box.add(agentInfo);
  clientInfo.setText(client.toString());
  agentInfo.setText("n/a");
  Box side=new Box(BoxLayout.X_AXIS);
  add(side,BorderLayout.EAST);
  side.add(traffic);
  buttons=new JPanel(new StackLayout(Orientation.HORIZONTAL));
  buttons.setOpaque(false);
  buttons.add(Box.createHorizontalStrut(5));
  buttons.add(disconnect);
  buttons.add(Box.createHorizontalStrut(5));
  buttons.add(kill);
  addMouseListener(new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent e){
      ClientsPanel.this.select(ClientPanel.this.client);
    }
  }
);
}
 

Example 44

From project ISAvalidator-ISAconverter-BIImanager, under directory /val_conv_manager_gui/src/main/java/org/isatools/effects/.

Source file: FooterPanel.java

  16 
vote

public FooterPanel(final JFrame container,Color bgColor,ImageIcon resizeIcon){
  this.container=container;
  setLayout(new GridBagLayout());
  setBackground(bgColor);
  this.resizeIcon=resizeIcon;
  instantiateComponent();
  installListeners();
  this.container.getContentPane().addMouseListener(new MouseAdapter(){
    public void mousePressed(    MouseEvent e){
      resizing=container.getCursor().equals(Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR));
      if (!e.isMetaDown()) {
        point.x=e.getX();
        point.y=e.getY();
      }
    }
  }
);
}
 

Example 45

From project jASM_16, under directory /src/main/java/de/codesourcery/jasm16/ide/ui/views/.

Source file: BreakpointView.java

  16 
vote

private JPanel createPanel(){
  table.setFillsViewportHeight(true);
  table.setFont(getMonospacedFont());
  table.addMouseListener(new MouseAdapter(){
    public void mouseClicked(    java.awt.event.MouseEvent e){
      if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) {
        final int viewRow=table.rowAtPoint(e.getPoint());
        if (viewRow != -1) {
          final int modelRow=table.convertRowIndexToModel(viewRow);
          final Breakpoint breakPoint=tableModel.getBreakpoint(modelRow);
          disView.setViewStartingAddress(breakPoint.getAddress());
          if (sourceLevelDebugView != null) {
            sourceLevelDebugView.scrollToVisible(breakPoint.getAddress());
          }
        }
      }
    }
  }
);
  table.getActionMap().put("deleteRow",new AbstractAction("deleteRow"){
    @Override public void actionPerformed(    ActionEvent e){
      final int viewRow=table.getSelectedRow();
      final int modelRow=table.convertRowIndexToModel(viewRow);
      Breakpoint bp=tableModel.getBreakpoint(modelRow);
      emulator.deleteBreakpoint(bp);
    }
  }
);
  final KeyStroke stroke=KeyStroke.getKeyStroke(KeyEvent.VK_DELETE,0);
  table.getInputMap().put(stroke,"deleteRow");
  setColors(table);
  final JScrollPane pane=new JScrollPane(table);
  setColors(pane);
  final JPanel panel=new JPanel();
  setColors(panel);
  panel.setLayout(new GridBagLayout());
  final GridBagConstraints cnstrs=constraints(0,0,true,true,GridBagConstraints.BOTH);
  panel.add(pane,cnstrs);
  return panel;
}
 

Example 46

From project jchempaint, under directory /src/main/org/openscience/jchempaint/.

Source file: JChemPaintPanel.java

  16 
vote

protected void init(){
  this.setLayout(new BorderLayout());
  topContainer=new JPanel(new BorderLayout());
  topContainer.setLayout(new BorderLayout());
  this.add(topContainer,BorderLayout.NORTH);
  renderPanel.getHub().addChangeModeListener(this);
  renderPanel.setName("renderpanel");
  centerContainer=new JPanel();
  centerContainer.setLayout(new BorderLayout());
  centerContainer.add(new JScrollPane(renderPanel),BorderLayout.CENTER);
  this.add(centerContainer);
  customizeView();
  updateUndoRedoControls();
  SwingPopupModule inputAdapter=new SwingPopupModule(renderPanel,renderPanel.getHub());
  setupPopupMenus(inputAdapter,blacklist);
  renderPanel.getHub().registerGeneralControllerModule(inputAdapter);
  renderPanel.getHub().setEventHandler(this);
  renderPanel.getRenderer().getRenderer2DModel().addCDKChangeListener(this);
  instances.add(this);
  renderPanel.getHub().getController2DModel().setAutoUpdateImplicitHydrogens(true);
  this.addKeyListener(this);
  renderPanel.addMouseListener(new MouseAdapter(){
    public void mouseExited(    MouseEvent e){
      JChemPaintPanel.this.get2DHub().clearPhantoms();
      JChemPaintPanel.this.get2DHub().updateView();
    }
  }
);
  handler=new JCPTransferHandler(this);
  renderPanel.setTransferHandler(handler);
}
 

Example 47

From project jenkins-control-plugin, under directory /src/main/java/org/codinjutsu/tools/jenkins/view/.

Source file: JenkinsWidget.java

  16 
vote

private JComponent createStatusIcon(BuildStatusAggregator aggregator){
  JComponent statusIcon=BuildStatusIcon.createIcon(aggregator);
  statusIcon.addMouseListener(new MouseAdapter(){
    @Override public void mousePressed(    MouseEvent e){
      handle(e);
    }
    @Override public void mouseReleased(    MouseEvent e){
      handle(e);
    }
  }
);
  setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
  setBorder(StatusBarWidget.WidgetBorder.INSTANCE);
  return statusIcon;
}
 

Example 48

From project JoshEdit, under directory /org/lateralgm/joshedit/.

Source file: CompletionMenu.java

  16 
vote

public CompletionMenu(Frame owner,JoshText a,int y,int x1,int x2,int caret,Completion[] c){
  area=a;
  row=y;
  wordStart=x1;
  wordEnd=x2;
  this.caret=caret;
  completions=c;
  keyHandler=new KeyHandler();
  completionList=new JList();
  completionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  completionList.addKeyListener(keyHandler);
  completionList.addMouseListener(new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent e){
      if (apply())       e.consume();
 else       dispose();
    }
  }
);
  scroll=new JScrollPane(completionList);
  scroll.setBorder(BorderFactory.createLineBorder(Color.BLACK));
  ph=new PopupHandler(owner,scroll);
  ph.addHideListener(new PopupHandler.HideListener(){
    @Override public void hidePerformed(    boolean wasVisible){
      dispose();
    }
  }
);
  reset();
}
 

Example 49

From project jPOS, under directory /jpos/src/main/java/org/jpos/iso/gui/.

Source file: ISOMeter.java

  16 
vote

public ISOMeter(ISOChannelPanel parent){
  super();
  this.parent=parent;
  fontBig=new Font("Helvetica",Font.ITALIC,mass * 3 / 4);
  fontSmall=new Font("Helvetica",Font.PLAIN,10);
  yPoints=new int[width];
  xPoints=new int[width];
  for (int i=0; i < width; i++) {
    xPoints[i]=i;
    yPoints[i]=mass;
  }
  positiveText=null;
  negativeText=null;
  positiveCounter=negativeCounter="";
  connected=false;
  MouseListener mouseListener=new MouseAdapter(){
    public void mouseClicked(    MouseEvent e){
      showLogList();
    }
  }
;
  addMouseListener(mouseListener);
}
 

Example 50

From project knime-scripting, under directory /scriptingcore/src/de/mpicbg/tds/knime/knutils/scripting/templatewizard/.

Source file: PreviewImagePanel.java

  16 
vote

public PreviewImagePanel(){
  addComponentListener(new ComponentAdapter(){
    @Override public void componentResized(    ComponentEvent componentEvent){
      if (isDisplayable())       rescaleImage();
    }
  }
);
  addMouseListener(new MouseAdapter(){
    @Override public void mouseReleased(    MouseEvent mouseEvent){
      if (mouseEvent.getClickCount() == 2) {
        JDialog jDialog=new JDialog(TemplateConfigurator.getOwnerDialog(PreviewImagePanel.this));
        jDialog.setSize(new Dimension(image.getWidth() + 20,image.getHeight() + 20));
        jDialog.setLayout(new BorderLayout());
        PreviewImagePanel imagePanel=new PreviewImagePanel();
        imagePanel.setImage(image);
        jDialog.setTitle("Preview" + getTitle());
        jDialog.getContentPane().add(imagePanel);
        jDialog.setModal(true);
        jDialog.setVisible(true);
      }
    }
  }
);
}
 

Example 51

From project LanguageSpecCreator, under directory /src/SpecificationCreation/look/.

Source file: LiberLabel.java

  16 
vote

/** 
 * Constructor with value and parent frame
 * @param as AnchorString contains label and anchor
 * @param parent Parent Frame
 */
public LiberLabel(AnchorString as,SpecificationPane parent){
  super(" [" + as.toString() + "] ");
  this.parent=parent;
  anchor=(TemplateAnchor)as.getAnchor();
  if (anchor == null)   return;
  setFont(makeFont());
  if (anchor.isRed())   setForeground(Color.red);
 else   setForeground(Color.blue);
  addMenu();
  addMouseListener(new MouseAdapter(){
    public void mousePressed(    MouseEvent e){
      if ((menu != null) && (e.getButton() == MouseEvent.BUTTON3))       menu.show(e.getComponent(),e.getX(),e.getY());
    }
  }
);
}
 

Example 52

From project LateralGM, under directory /org/lateralgm/jedit/.

Source file: CompletionMenu.java

  16 
vote

public CompletionMenu(Frame f,JEditTextArea a,int offset,int pos,int length,Completion[] c){
  super(f);
  area=a;
  wordOffset=offset;
  wordPos=pos;
  wordLength=length;
  completions=c;
  keyHandler=new KeyHandler();
  completionList=new JList();
  completionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  completionList.addKeyListener(keyHandler);
  completionList.addMouseListener(new MouseAdapter(){
    public void mouseClicked(    MouseEvent e){
      if (apply())       e.consume();
 else       dispose();
    }
  }
);
  scroll=new JScrollPane(completionList);
  scroll.setBorder(BorderFactory.createLineBorder(Color.BLACK));
  add(scroll);
  getContentPane().setFocusTraversalKeysEnabled(false);
  addWindowFocusListener(new WindowFocusListener(){
    public void windowGainedFocus(    WindowEvent e){
      area.setCaretVisible(true);
    }
    public void windowLostFocus(    WindowEvent e){
      dispose();
    }
  }
);
  reset();
}
 

Example 53

From project log4jna, under directory /thirdparty/log4j/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/.

Source file: CategoryNodeEditor.java

  16 
vote

public CategoryNodeEditor(CategoryExplorerModel model){
  _renderer=new CategoryNodeEditorRenderer();
  _checkBox=_renderer.getCheckBox();
  _categoryModel=model;
  _checkBox.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      _categoryModel.update(_lastEditedNode,_checkBox.isSelected());
      stopCellEditing();
    }
  }
);
  _renderer.addMouseListener(new MouseAdapter(){
    public void mousePressed(    MouseEvent e){
      if ((e.getModifiers() & MouseEvent.BUTTON3_MASK) != 0) {
        showPopup(_lastEditedNode,e.getX(),e.getY());
      }
      stopCellEditing();
    }
  }
);
}
 

Example 54

From project Maimonides, under directory /src/com/codeko/apps/maimonides/convivencia/.

Source file: PanelExpulsiones.java

  16 
vote

public static Expulsion mostrarSelectorExpulsiones(Alumno alumno){
  Expulsion e=null;
  if (alumno != null && alumno.getId() != null) {
    PanelExpulsiones p=new PanelExpulsiones();
    p.setModoCompacto();
    p.barraHerramientas.setVisible(false);
    p.tabla.addMouseListener(new MouseAdapter(){
      @Override public void mouseClicked(      MouseEvent e){
      }
    }
);
    p.tabla.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    p.tabla.setEditable(false);
    p.setAlumno(alumno);
    p.setPreferredSize(new Dimension(400,500));
    int op=JOptionPane.showConfirmDialog(MaimonidesApp.getApplication().getMainFrame(),p,"Seleccione la expulsi?n a asignar",JOptionPane.OK_CANCEL_OPTION,JOptionPane.PLAIN_MESSAGE);
    if (op == JOptionPane.OK_OPTION) {
      int row=p.tabla.getSelectedRow();
      if (row > -1) {
        e=p.modelo.getElemento(p.tabla.convertRowIndexToModel(row));
      }
    }
  }
  return e;
}
 

Example 55

From project Media-Markup, under directory /java-client/src/main/java/com/company/annotation/audio/gui/.

Source file: WaveFormPanel.java

  16 
vote

public WaveFormPanel(AudioAnnotationService annotationService,String indexName){
  this.annotationService=annotationService;
  this.indexName=indexName;
  this.panel_main=new JPanel();
  this.panel_time=new JPanel();
  this.panel_wave=new JPanel();
  this.panel_selection=new JPanel();
  this.panel_selection.setOpaque(false);
  this.panel_main.setLayout(new BorderLayout());
  this.panel_time.add(new JLabel("Time"));
  this.panel_time.setBorder(new LineBorder(Color.BLACK,1));
  this.panel_main.add(panel_time,BorderLayout.NORTH);
  this.panel_main.add(panel_wave,BorderLayout.CENTER);
  this.add(panel_main);
  panel_selection.addMouseListener(new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent mouseEvent){
      System.out.println("clocuasdf");
    }
  }
);
}
 

Example 56

From project mtc, under directory /mtc-gui/src/main/java/org/drugis/mtc/gui/results/.

Source file: ConvergenceSummaryDialog.java

  16 
vote

private JComponent buildConvergenceTable(){
  ConvergenceDiagnosticTableModel tableModel=convergenceTable();
  final JTable convergenceTable=new JTable(tableModel);
  convergenceTable.getColumnModel().getColumn(0).setPreferredWidth(200);
  convergenceTable.addMouseListener(new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent e){
      if (e.getClickCount() > 1) {
        JTable table=(JTable)e.getComponent();
        int row=table.convertRowIndexToModel(table.rowAtPoint(e.getPoint()));
        Parameter[] parameters=d_wrapper.getParameters();
        if (row <= parameters.length) {
          Parameter p=parameters[row];
          showConvergencePlots(d_wrapper,p);
        }
      }
    }
  }
);
  JPanel jPanel=new JPanel(new BorderLayout());
  jPanel.add(convergenceTable,BorderLayout.CENTER);
  jPanel.add(convergenceTable.getTableHeader(),BorderLayout.NORTH);
  return jPanel;
}
 

Example 57

From project niravCS2103, under directory /CS2103/lib/apache-log4j-1.2.16/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/.

Source file: CategoryNodeEditor.java

  16 
vote

public CategoryNodeEditor(CategoryExplorerModel model){
  _renderer=new CategoryNodeEditorRenderer();
  _checkBox=_renderer.getCheckBox();
  _categoryModel=model;
  _checkBox.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      _categoryModel.update(_lastEditedNode,_checkBox.isSelected());
      stopCellEditing();
    }
  }
);
  _renderer.addMouseListener(new MouseAdapter(){
    public void mousePressed(    MouseEvent e){
      if ((e.getModifiers() & MouseEvent.BUTTON3_MASK) != 0) {
        showPopup(_lastEditedNode,e.getX(),e.getY());
      }
      stopCellEditing();
    }
  }
);
}
 

Example 58

From project nodebox, under directory /src/main/java/nodebox/client/.

Source file: NetworkPane.java

  16 
vote

public NetworkPane(NodeBoxDocument document){
  this.document=document;
  setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
  paneHeader=new PaneHeader("Network");
  paneHeader.setAlignmentX(JComponent.LEFT_ALIGNMENT);
  NButton newNodeButton=new NButton("New Node","res/network-new-node.png");
  newNodeButton.setToolTipText("New Node (TAB)");
  newNodeButton.setActionMethod(this,"showNodeSelectionDialog");
  paneHeader.add(newNodeButton);
  add(paneHeader);
  errorLabel=new MessageBar("Error");
  errorLabel.addMouseListener(new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent e){
      ExceptionDialog ed=new ExceptionDialog(null,nodeRenderException,"",false);
      ed.setVisible(true);
    }
  }
);
  errorLabel.setVisible(false);
  add(errorLabel);
  networkView=new NetworkView(document);
  networkView.setAlignmentX(JComponent.LEFT_ALIGNMENT);
  add(networkView);
}
 

Example 59

From project OpenLogViewer, under directory /src/main/java/org/diyefi/openlogviewer/.

Source file: NavBarPanel.java

  16 
vote

private void setupFileButtons(){
  final JButton openFile=new JButton();
  openFile.addMouseListener(new MouseAdapter(){
    @Override public void mouseReleased(    final MouseEvent e){
      if (openFile.contains(e.getPoint())) {
        openButtonMouseReleased();
      }
    }
  }
);
  setupAndAddButton(openFile,Images.OPEN_FILE);
  final JButton openLast=new JButton();
  openLast.addMouseListener(new MouseAdapter(){
    @Override public void mouseReleased(    final MouseEvent e){
      if (openLast.contains(e.getPoint())) {
        openLastButtonMouseReleased();
      }
    }
  }
);
  setupAndAddButton(openLast,Images.OPEN_LAST);
}
 

Example 60

From project OWASP-WebScarab, under directory /src/org/owasp/webscarab/plugin/fuzz/swing/.

Source file: FuzzerPanel.java

  16 
vote

private void addTableListeners(){
  _showAction=new ShowConversationAction(_model.getConversationModel());
  conversationTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
    public void valueChanged(    ListSelectionEvent e){
      _logger.info("Selection changed");
      if (e.getValueIsAdjusting())       return;
      int row=conversationTable.getSelectedRow();
      TableModel tm=conversationTable.getModel();
      if (row > -1) {
        ConversationID id=(ConversationID)tm.getValueAt(row,0);
        _showAction.putValue("CONVERSATION",id);
        _logger.info("Conversation " + id + " selected");
      }
 else {
        _showAction.putValue("CONVERSATION",null);
      }
    }
  }
);
  conversationTable.addMouseListener(new MouseAdapter(){
    public void mouseClicked(    MouseEvent e){
      _logger.info("Mouse clicked in the table");
      int row=conversationTable.rowAtPoint(e.getPoint());
      conversationTable.getSelectionModel().setSelectionInterval(row,row);
      if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) {
        ActionEvent evt=new ActionEvent(conversationTable,0,(String)_showAction.getValue(Action.ACTION_COMMAND_KEY));
        if (_showAction.isEnabled())         _showAction.actionPerformed(evt);
      }
    }
  }
);
}
 

Example 61

From project packetsamurai, under directory /src/com/l2j/packetsamurai/gui/.

Source file: Main.java

  16 
vote

public void showInterfaceSelector(String[] interfaceNames){
  _selectInterfaceWindow=new JDialog(_frame);
  _selectInterfaceWindow.setTitle("Double-Click to Select the Interface");
  _selectInterfaceWindow.setLocationRelativeTo(_frame);
  _interfaceList=new JList(interfaceNames);
  _interfaceList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  JScrollPane scrollPane=new JScrollPane(_interfaceList);
  MouseListener mouseListener=new MouseAdapter(){
    public void mouseClicked(    MouseEvent e){
      if (e.getClickCount() == 2) {
        int index=_interfaceList.locationToIndex(e.getPoint());
        if (Captor.getInstance().getCurrentDeviceId() == index) {
          _selectInterfaceWindow.dispose();
          return;
        }
        Captor.getInstance().openDevice(index);
        PacketSamurai.setConfigProperty("NetworkInterface",Integer.toString(index));
        _selectInterfaceWindow.dispose();
      }
    }
  }
;
  _interfaceList.addMouseListener(mouseListener);
  _selectInterfaceWindow.add(scrollPane);
  _selectInterfaceWindow.setSize(400,350);
  _selectInterfaceWindow.setVisible(true);
}
 

Example 62

From project pegadi, under directory /client/src/main/java/org/pegadi/articlelist/.

Source file: ArticleList.java

  16 
vote

/** 
 * Add a popup context menu. As this is a standard menu, listeners will receive an action event, and must then query this component to find the currently selected article.
 * @param popup The menu.
 */
public void setPopupMenu(JPopupMenu popup){
  this.popupMenu=popup;
  if (popupListener != null && groupedArticles != null) {
    this.removeMouseListener(popupListener);
    for (int i=0; i < groupedArticles.getNumberOfGroups(); i++) {
      groupTables[i].removeMouseListener(popupListener);
      groupLabels[i].removeMouseListener(popupListener);
      groupSums[i].removeMouseListener(popupListener);
    }
    popupListener=null;
  }
  popupListener=new MouseAdapter(){
    public void mousePressed(    MouseEvent e){
      maybeShowPopup(e);
    }
    public void mouseReleased(    MouseEvent e){
      maybeShowPopup(e);
    }
  }
;
  this.addMouseListener(popupListener);
  if (groupedArticles != null) {
    for (int i=0; i < groupedArticles.getNumberOfGroups(); i++) {
      groupTables[i].addMouseListener(popupListener);
      groupLabels[i].addMouseListener(popupListener);
      groupSums[i].addMouseListener(popupListener);
    }
  }
}
 

Example 63

From project PenguinCMS, under directory /PenguinCMS/tests/vendor/sahi/src/net/sf/sahi/ui/.

Source file: LinkButton.java

  16 
vote

public LinkButton(final String text,final String uri){
  super();
  setText(text);
  if (uri != null)   setToolTipText(uri.toString());
  addMouseListener(new MouseAdapter(){
    public void mouseClicked(    MouseEvent e){
      open(uri);
    }
    public void mouseEntered(    MouseEvent e){
      setCursor(new Cursor(Cursor.HAND_CURSOR));
      setText(text,true);
    }
    public void mouseExited(    MouseEvent e){
      setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
      setText(text,false);
    }
  }
);
}
 

Example 64

From project RegexTagForMusic, under directory /src/org/essembeh/rtfm/gui/tables/.

Source file: MusicTable.java

  16 
vote

/** 
 * Constructor
 * @param model
 */
public MusicTable(final GuiController controller){
  super(controller.getModel());
  addMouseListener(new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent e){
      if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 2) {
        controller.inspectMusicFile();
      }
 else       if (SwingUtilities.isRightMouseButton(e)) {
        JPopupMenu menu=new ContextualMenu(controller);
        menu.show(e.getComponent(),e.getX(),e.getY());
      }
    }
  }
);
  setDefaultRenderer(Boolean.class,new ThreeStatesBooleanRenderer());
  setDefaultRenderer(IMusicFile.class,new MusicFileRenderer());
  getColumn(0).setMaxWidth(200);
  getColumn(2).setMaxWidth(70);
}
 

Example 65

From project SandpilesApp, under directory /src/org/headb/sandpile/.

Source file: Sandpile3dDrawer.java

  16 
vote

public Sandpile3dDrawer(GLAutoDrawable canvas){
  System.err.println("Construct");
  colorMode=ColorMode.NUM_OF_GRAINS;
  this.canvas=canvas;
  this.canvas.addGLEventListener(this);
  try {
    tris=new DelaunayTriangulation(new Float2dArrayList(0,2));
  }
 catch (  InterruptedException e) {
  }
  config=new SandpileConfiguration();
  firings=new TIntArrayList();
  graph=new SandpileGraph();
  final Sandpile3dDrawer me=this;
  canvas.addMouseListener(new MouseAdapter(){
    @Override public void mousePressed(    MouseEvent evt){
      me.mousePressed(evt);
    }
  }
);
  canvas.addMouseMotionListener(new MouseMotionAdapter(){
    @Override public void mouseDragged(    MouseEvent evt){
      me.mouseDragged(evt);
    }
  }
);
  canvas.addMouseWheelListener(new MouseWheelListener(){
    public void mouseWheelMoved(    MouseWheelEvent evt){
      me.mouseWheelMoved(evt);
    }
  }
);
  canvas.addKeyListener(new KeyAdapter(){
    @Override public void keyPressed(    KeyEvent evt){
      me.keyPressed(evt);
    }
  }
);
}
 

Example 66

From project ScissLib, under directory /src/main/java/de/sciss/gui/.

Source file: UnitLabel.java

  16 
vote

/** 
 * Creates a new empty label.
 */
public UnitLabel(){
  super();
  setHorizontalTextPosition(LEFT);
  setFocusable(true);
  addMouseListener(new MouseAdapter(){
    public void mousePressed(    MouseEvent e){
      if (isEnabled() && units.size() > 1) {
        requestFocus();
        if (cycle) {
          ((UnitAction)units.get((selectedIdx + 1) % units.size())).setLabel();
          ((JCheckBoxMenuItem)pop.getComponent(selectedIdx)).setSelected(true);
        }
 else {
          pop.show(UnitLabel.this,0,UnitLabel.this.getHeight());
        }
      }
    }
  }
);
  this.addPropertyChangeListener("font",this);
  this.addPropertyChangeListener("enabled",this);
  this.addPropertyChangeListener("insets",this);
}
 

Example 67

From project SIARD-Val, under directory /SIARD-Val/external-sources/log4j-1.2.12/java/org/apache/log4j/lf5/viewer/categoryexplorer/.

Source file: CategoryNodeEditor.java

  16 
vote

public CategoryNodeEditor(CategoryExplorerModel model){
  _renderer=new CategoryNodeEditorRenderer();
  _checkBox=_renderer.getCheckBox();
  _categoryModel=model;
  _checkBox.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      _categoryModel.update(_lastEditedNode,_checkBox.isSelected());
      stopCellEditing();
    }
  }
);
  _renderer.addMouseListener(new MouseAdapter(){
    public void mousePressed(    MouseEvent e){
      if ((e.getModifiers() & MouseEvent.BUTTON3_MASK) != 0) {
        showPopup(_lastEditedNode,e.getX(),e.getY());
      }
      stopCellEditing();
    }
  }
);
}
 

Example 68

From project skmclauncher, under directory /src/main/java/com/sk89q/mclauncher/.

Source file: LinkButton.java

  16 
vote

public void setupLink(){
  setBorder(LINK_BORDER);
  setForeground(LINK_COLOR);
  setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
  setFocusPainted(false);
  setRequestFocusEnabled(false);
  setContentAreaFilled(false);
  addMouseListener(new MouseAdapter(){
    @Override public void mouseEntered(    MouseEvent e){
      ((JComponent)e.getComponent()).setBorder(HOVER_BORDER);
    }
    @Override public void mouseReleased(    MouseEvent e){
      ((JComponent)e.getComponent()).setBorder(LINK_BORDER);
    }
    @Override public void mouseExited(    MouseEvent e){
      ((JComponent)e.getComponent()).setBorder(LINK_BORDER);
    }
  }
);
}
 

Example 69

From project syncany, under directory /syncany/src/org/syncany/gui/settings/.

Source file: FoldersTablePanel.java

  16 
vote

private void initTable(){
  tblFolders.setModel(new FolderTableModel());
  tblFolders.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
  TableColumn colActive=tblFolders.getColumnModel().getColumn(FolderTableModel.COLUMN_INDEX_ACTIVE);
  colActive.setPreferredWidth(50);
  colActive.setMaxWidth(50);
  colActive.setResizable(false);
  TableColumn colRemote=tblFolders.getColumnModel().getColumn(FolderTableModel.COLUMN_INDEX_REMOTE);
  colRemote.setPreferredWidth(70);
  TableColumn colLocal=tblFolders.getColumnModel().getColumn(FolderTableModel.COLUMN_INDEX_LOCAL);
  colLocal.setPreferredWidth(320);
  tblFolders.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  tblFolders.setShowHorizontalLines(false);
  tblFolders.setShowVerticalLines(false);
  tblFolders.setBorder(BorderFactory.createEmptyBorder());
  tblFolders.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
    @Override public void valueChanged(    ListSelectionEvent e){
      btnEdit.setEnabled(e.getFirstIndex() >= 0);
    }
  }
);
  tblFolders.addMouseListener(new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent e){
      if (e.getClickCount() == 2 && tblFolders.getSelectedRow() >= 0) {
        btnEditActionPerformed(null);
      }
    }
  }
);
}
 

Example 70

From project tomighty, under directory /tomighty-swing/src/main/java/org/tomighty/ui/swing/.

Source file: CheckableFileField.java

  16 
vote

public CheckableFileField(){
  setLayout(new BorderLayout());
  JPanel south=new JPanel(new BorderLayout());
  south.add(filenameField=new JTextField(),CENTER);
  south.add(defaultButton=new JButton(),EAST);
  add(checkBox=new JCheckBox(),NORTH);
  add(south);
  filenameField.setEditable(false);
  filenameField.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
  filenameField.addMouseListener(new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent e){
      if (e.getButton() == MouseEvent.BUTTON1 && filenameField.isEnabled()) {
        chooseFile();
      }
    }
  }
);
  checkBox.addChangeListener(new ChangeListener(){
    @Override public void stateChanged(    ChangeEvent e){
      updateFileSelectionState();
    }
  }
);
  defaultButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      file(null);
    }
  }
);
  updateFileSelectionState();
  file(null);
}
 

Example 71

From project twistDemo, under directory /twist-libs/com.thoughtworks.webdriver.recorder_1.0.0.11288/sahi/src/net/sf/sahi/ui/.

Source file: LinkButton.java

  16 
vote

public LinkButton(final String text,final String uri){
  super();
  setText(text);
  if (uri != null)   setToolTipText(uri.toString());
  addMouseListener(new MouseAdapter(){
    public void mouseClicked(    MouseEvent e){
      open(uri);
    }
    public void mouseEntered(    MouseEvent e){
      setCursor(new Cursor(Cursor.HAND_CURSOR));
      setText(text,true);
    }
    public void mouseExited(    MouseEvent e){
      setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
      setText(text,false);
    }
  }
);
}
 

Example 72

From project Twister, under directory /src/client/userinterface/java/src/.

Source file: ExplorerPanel.java

  16 
vote

public ExplorerPanel(int x,int y,TreeDropTargetListener tdtl,boolean applet,ChannelSftp c){
  Repository.intro.setStatus("Started Explorer interface initialization");
  Repository.intro.addPercent(0.035);
  Repository.intro.repaint();
  root=new DefaultMutableTreeNode("root",true);
  DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
  try {
    Repository.c.cd(Repository.getTestSuitePath());
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  Repository.intro.setStatus("Started retrieving tc directories");
  Repository.intro.addPercent(0.035);
  Repository.intro.repaint();
  getList(root,Repository.c);
  Repository.intro.setStatus("Finished retrieving tc directories");
  Repository.intro.addPercent(0.035);
  Repository.intro.repaint();
  tree=new JTree(root);
  tree.expandRow(1);
  tree.addMouseListener(new MouseAdapter(){
    public void mousePressed(    MouseEvent ev){
      treeClick(ev);
    }
    public void mouseReleased(    MouseEvent ev){
      treeClickReleased(ev);
    }
  }
);
  DragSource ds=new DragSource();
  ds.getDefaultDragSource();
  ds.createDefaultDragGestureRecognizer(this,DnDConstants.ACTION_COPY_OR_MOVE,new TreeDragGestureListener());
  tree.setDragEnabled(true);
  tree.setRootVisible(false);
  Repository.intro.setStatus("Finished Explorer interface initialization");
  Repository.intro.addPercent(0.035);
  Repository.intro.repaint();
}
 

Example 73

From project uniquery, under directory /src/org/uniquery/gui/.

Source file: ServerTreeView.java

  16 
vote

private void buildServerTree(){
  treeModel=new DefaultTreeModel(new DefaultMutableTreeNode("Servers"));
  tree=new JTree(treeModel);
  tree.setRootVisible(false);
  tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  treeView=new JScrollPane(tree);
  treeView.setDoubleBuffered(true);
  tree.setCellRenderer(new IconRenderer());
  tree.addTreeSelectionListener(new ServerTreeSelectionListener());
  tree.addMouseListener(new MouseAdapter(){
    @Override public void mousePressed(    MouseEvent e){
      int button=e.getButton();
      if (button == MouseEvent.BUTTON3) {
        int selectedRow=tree.getRowForLocation(e.getX(),e.getY());
        tree.setSelectionRow(selectedRow);
      }
    }
    @Override public void mouseReleased(    MouseEvent e){
      int button=e.getButton();
      if (button == MouseEvent.BUTTON3) {
        treePopup.show((JTree)e.getSource(),e.getX(),e.getY());
      }
    }
  }
);
}