Java Code Examples for java.awt.event.ActionListener

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 autopsy, under directory /Core/src/org/sleuthkit/autopsy/corecomponents/.

Source file: DataContentViewerArtifact.java

  35 
vote

private void customizeComponents(){
  outputViewPane.setComponentPopupMenu(rightClickMenu);
  ActionListener actList=new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      JMenuItem jmi=(JMenuItem)e.getSource();
      if (jmi.equals(copyMenuItem))       outputViewPane.copy();
 else       if (jmi.equals(selectAllMenuItem))       outputViewPane.selectAll();
    }
  }
;
  copyMenuItem.addActionListener(actList);
  selectAllMenuItem.addActionListener(actList);
  outputViewPane.setContentType("text/html");
}
 

Example 2

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

Source file: SwingUtils.java

  32 
vote

/** 
 * FIXME:  These two addEscapeListener can be called on a new interface that implements RootPainCOntainer (Swing) and a new method that is called
 * @param dialog
 */
public static void addEscapeListener(final EscapeListener dialog){
  ActionListener escListener=new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      dialog.escapePressed();
    }
  }
;
  dialog.getRootPane().registerKeyboardAction(escListener,KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE,0),JComponent.WHEN_IN_FOCUSED_WINDOW);
}
 

Example 3

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

Source file: LogBrokerMonitor.java

  32 
vote

protected void makeLogTableListenToCategoryExplorer(){
  ActionListener listener=new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      _table.getFilteredLogTableModel().refresh();
      updateStatusLabel();
    }
  }
;
  _categoryExplorerTree.getExplorerModel().addActionListener(listener);
}
 

Example 4

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

Source file: MetaBenefitRiskView.java

  31 
vote

private JButton createRunAllButton(){
  final JButton button=new JButton(MainWindow.IMAGELOADER.getIcon(org.drugis.mtc.gui.FileNames.ICON_RUN));
  button.setText("Run all required sub-analyses");
  button.setToolTipText("Run all simulations");
  button.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    final ActionEvent e){
      d_pm.startAllSimulations();
    }
  }
);
  return button;
}
 

Example 5

From project androvoip, under directory /src/com/mexuar/corraleta/faceless/.

Source file: Faceless.java

  31 
vote

/** 
 * Register with the infrastructure so that calls may be made. This method is called via javascript in the register() method. The value is passed from the webpage via javascript. <p> This method will be called in javascript, which is not trusted (even though the jar itself is signed). For that reason we use the Timer ActionListener, so the swing thread will 'transfer' this method from an untrusted to a trusted environment. Also, it will make sure the method 'registered' isn't called too soon, this might cause an re-entrant problem with javascript. </p>
 * @see #registered
 */
public void register(){
  if (_peer == null && _bind != null && _user != null && _pass != null) {
    ActionListener ans=new ActionListener(){
      public void actionPerformed(      ActionEvent e){
        if (isExpired() == false) {
          try {
            Log.debug("register() _bind = " + _bind);
            _bind.register(_user,_pass,_pevl,_incoming);
          }
 catch (          Exception ex) {
            Log.warn("register " + ex.getClass().getName() + ": "+ ex.getMessage());
            show("register " + ex.getMessage());
          }
          showTrialDaysLeft();
        }
 else {
          showTrialExpired();
        }
      }
    }
;
    Timer timer=new Timer(100,ans);
    timer.setRepeats(false);
    timer.start();
  }
 else {
    show("can't register");
  }
}
 

Example 6

From project BDSup2Sub, under directory /src/main/java/bdsup2sub/gui/support/.

Source file: Progress.java

  31 
vote

private JButton getJButtonCancel(){
  if (jButtonCancel == null) {
    jButtonCancel=new JButton();
    jButtonCancel.setText("Cancel");
    jButtonCancel.addActionListener(new ActionListener(){
      @Override public void actionPerformed(      ActionEvent e){
        Core.cancel();
      }
    }
);
  }
  return jButtonCancel;
}
 

Example 7

From project beam-meris-icol, under directory /src/main/java/org/esa/beam/meris/icol/ui/.

Source file: IcolForm.java

  31 
vote

private JPanel createCTPPanel(){
  TableLayout layout=new TableLayout(3);
  layout.setTableAnchor(TableLayout.Anchor.WEST);
  layout.setTableFill(TableLayout.Fill.HORIZONTAL);
  layout.setColumnWeightX(0,0.1);
  layout.setColumnWeightX(1,0.1);
  layout.setColumnWeightX(2,1);
  layout.setCellColspan(0,0,3);
  layout.setCellColspan(1,0,3);
  layout.setTablePadding(2,2);
  layout.setCellPadding(2,0,new Insets(0,24,0,0));
  layout.setCellPadding(3,0,new Insets(0,24,0,0));
  JPanel panel=new JPanel(layout);
  panel.setBorder(BorderFactory.createTitledBorder("Cloud Top Pressure"));
  ctpGroup=new ButtonGroup();
  icolCtp=new JRadioButton("Compute by algorithm");
  icolCtp.setSelected(true);
  panel.add(icolCtp);
  ctpGroup.add(icolCtp);
  userCtp=new JRadioButton("Use constant value");
  userCtp.setSelected(false);
  panel.add(userCtp);
  ctpGroup.add(userCtp);
  ctpValue=new JFormattedTextField("1013.0");
  userCtpLabel=new JLabel("CTP: ");
  panel.add(userCtpLabel);
  panel.add(ctpValue);
  panel.add(new JPanel());
  ActionListener ctpActionListener=new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      updateCtpUIstate();
    }
  }
;
  icolCtp.addActionListener(ctpActionListener);
  userCtp.addActionListener(ctpActionListener);
  return panel;
}
 

Example 8

From project Calendar-Application, under directory /com/toedter/calendar/demo/.

Source file: JCalendarDemo.java

  31 
vote

/** 
 * Creates the menu bar
 * @return Description of the Return Value
 */
public JToolBar createToolBar(){
  toolBar=new JToolBar();
  toolBar.putClientProperty("jgoodies.headerStyle","Both");
  toolBar.setRollover(true);
  toolBar.setFloatable(false);
  for (int i=0; i < beans.length; i++) {
    Icon icon;
    JButton button;
    try {
      final JComponent bean=beans[i];
      URL iconURL=bean.getClass().getResource("images/" + bean.getName() + "Color16.gif");
      icon=new ImageIcon(iconURL);
      button=new JButton(icon);
      ActionListener actionListener=new ActionListener(){
        public void actionPerformed(        ActionEvent e){
          installBean(bean);
        }
      }
;
      button.addActionListener(actionListener);
    }
 catch (    Exception e) {
      System.out.println("JCalendarDemo.createToolBar(): " + e);
      button=new JButton(beans[i].getName());
    }
    button.setFocusPainted(false);
    toolBar.add(button);
  }
  return toolBar;
}
 

Example 9

From project ceres, under directory /ceres-ui/src/test/java/com/bc/ceres/swing/.

Source file: ActionLabelTest.java

  31 
vote

public void testConstructors(){
  ActionLabel label=new ActionLabel();
  assertEquals(null,label.getText());
  assertNotNull(label.getActionListeners());
  assertEquals(0,label.getActionListeners().length);
  label=new ActionLabel("X");
  assertEquals("X",label.getText());
  assertNotNull(label.getActionListeners());
  assertEquals(0,label.getActionListeners().length);
  final ActionListener testAction=new ActionListener(){
    public void actionPerformed(    ActionEvent e){
    }
  }
;
  label=new ActionLabel("Y",testAction);
  assertEquals("Y",label.getText());
  assertNotNull(label.getActionListeners());
  assertEquals(1,label.getActionListeners().length);
  assertSame(testAction,label.getActionListeners()[0]);
}
 

Example 10

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

Source file: viewer.java

  31 
vote

public void tableClicked(final java.awt.event.MouseEvent evt){
  if (evt.getModifiers() == 4) {
    int numSelected=objectListTable.getSelectedRows().length;
    if (numSelected > 1) {
      for (      int i : objectListTable.getSelectedRows()) {
        ObjBase o=getObjectAt(i);
        System.out.println(o.getName());
      }
      return;
    }
    if (numSelected == 1) {
      final ObjBase selObj=getObjectAt(objectListTable.getSelectedRow());
      final ObjBasePopup pop=new ObjBasePopup(viewer.this,selObj,evt.getPoint());
      final ActionListener al=new ActionListener(){
        @Override public void actionPerformed(        ActionEvent e){
          _myCollection.removeItem(selObj);
        }
      }
;
      SwingUtilities.invokeLater(new Runnable(){
        @Override public void run(){
          pop.addMenuItem("Remove from collection",al);
        }
      }
);
      return;
    }
  }
  if (evt.getClickCount() == 2) {
    System.out.println("double clicked");
    ObjBase selObj=getObjectAt(objectListTable.getSelectedRow());
    System.out.println(selObj.getName());
    selObj.launchDefaultViewer();
  }
  return;
}
 

Example 11

From project codjo-broadcast, under directory /codjo-broadcast-gui/src/main/java/net/codjo/broadcast/gui/.

Source file: BroadcastColumnsDetailWindow.java

  31 
vote

private void installListeners(){
  tableNameCombo.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent event){
      onTableNameComboChange();
    }
  }
);
  fieldNameCombo.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent event){
      onFieldNameComboChange();
    }
  }
);
}
 

Example 12

From project codjo-data-process, under directory /codjo-data-process-common/src/test/java/net/codjo/dataprocess/common/eventsbinder/dynalistener/.

Source file: DynamicListenerTest.java

  31 
vote

@Test public void actionListener(){
  assertThat(eventReactionMock.getEventObject(),nullValue());
  assertThat(eventReactionMock.getMethodCalled(),nullValue());
  ActionEvent actionEvent=new ActionEvent("t",1,"t");
  ActionListener actionListener=(ActionListener)DynamicListener.createEventListener(ActionListener.class,eventReactionMock,eventCheckerMock);
  actionListener.actionPerformed(actionEvent);
  assertThat("actionPerformed",equalTo(eventReactionMock.getMethodCalled()));
  assertThat(actionEvent,is(sameInstance(eventReactionMock.getEventObject())));
  eventReactionMock.clear();
  assertThat(eventReactionMock.getEventObject(),nullValue());
  assertThat(eventReactionMock.getMethodCalled(),nullValue());
  eventCheckerMock.setMockCkeckEvent(false);
  actionListener.actionPerformed(actionEvent);
  assertThat(eventReactionMock.getEventObject(),nullValue());
  assertThat(eventReactionMock.getMethodCalled(),nullValue());
}
 

Example 13

From project codjo-segmentation, under directory /codjo-segmentation-gui/src/main/java/net/codjo/segmentation/gui/exportParam/.

Source file: ExportParametersGui.java

  31 
vote

private void initListeners(){
  cancelButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent event){
      dispose();
    }
  }
);
  directoryPathField.getDirectoryNameField().getDocument().addDocumentListener(new ValidDirectoryListener());
}
 

Example 14

From project codjo-standalone-common, under directory /src/main/java/net/codjo/gui/broadcast/.

Source file: BroadcastColumnsDetailWindow.java

  31 
vote

private void initTableNameListener(){
  tableNameListener=new ActionListener(){
    public void actionPerformed(    ActionEvent evt){
      dbTableNameActionPerformed();
    }
  }
;
}
 

Example 15

From project collaborative-editor, under directory /mpedit/gui/.

Source file: CMenu.java

  31 
vote

/** 
 * initialises the connListener
 * @return connListener Returns the ready-to-use connListener
 */
private ActionListener initConnListener(){
  ActionListener connListener=new ActionListener(){
    public void actionPerformed(    ActionEvent event){
      String clicked=event.getActionCommand();
      if (clicked.equalsIgnoreCase("Connect to...")) {
        m_mainframe.onClient();
      }
 else       if (clicked.equalsIgnoreCase("Server...")) {
        m_mainframe.onServer();
      }
 else       if (clicked.equalsIgnoreCase("Sync")) {
        m_mainframe.getM_manager().syncData();
      }
 else       if (clicked.equalsIgnoreCase("Disconnect")) {
        m_mainframe.killConnManager();
      }
    }
  }
;
  return connListener;
}
 

Example 16

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

Source file: PushDialog.java

  31 
vote

/** 
 * Setup drop down with remotes
 */
private void setupRemotes(){
  final ActionListener actionListener=new ActionListener(){
    public void actionPerformed(    final ActionEvent e){
      updateRemotes();
      myMirrorChecks.clear();
      myBranchNames.clear();
      myTagNames.clear();
      try {
        Branch.listAsStrings(myProject,getGitRoot(),false,true,myBranchNames,null);
        Tag.listAsStrings(myProject,getGitRoot(),myTagNames,null);
      }
 catch (      VcsException ex) {
        LOG.warn("Exception in branch list: \n" + StringUtil.getThrowableText(ex));
      }
    }
  }
;
  myGitRootComboBox.addActionListener(actionListener);
  actionListener.actionPerformed(null);
}
 

Example 17

From project 3Dto2DApplet, under directory /src/java/nl/dannyarends/generator/model/.

Source file: Value.java

  30 
vote

Value(){
  setLayout(new FlowLayout());
  for (  Type t : Type.values()) {
    typeIn.addItem(t.internalname);
  }
  typeIn.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      System.out.println(((JComboBox)e.getSource()).getSelectedItem());
    }
  }
);
  UpdateBtn.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      type=Type.getType((String)typeIn.getSelectedItem());
      val=valueIn.getText();
    }
  }
);
  add(typelbl);
  add(typeIn);
  add(valuelbl);
  add(valueIn);
  add(UpdateBtn);
}
 

Example 18

From project beam-third-party, under directory /beam-meris-veg/src/main/java/org/esa/beam/processor/baer/ui/.

Source file: BaerUi.java

  30 
vote

/** 
 * Creates all user interface components and sets them to their appropriate default values
 */
private void createUI(){
  int line=0;
  JPanel ioParamPanel=GridBagUtils.createDefaultEmptyBorderPanel();
  GridBagConstraints gbc=GridBagUtils.createConstraints(null);
  addParameterToPanel(ioParamPanel,DefaultRequestElementFactory.INPUT_PRODUCT_PARAM_NAME,line,12,gbc);
  line+=2;
  addParameterToPanel(ioParamPanel,DefaultRequestElementFactory.OUTPUT_PRODUCT_PARAM_NAME,line,12,gbc);
  line+=10;
  final JLabel outFormatLabel=new JLabel(OUT_FORMAT_LABEL);
  _fileFormatCombo=new JComboBox(_fileFormatNames);
  _fileFormatCombo.addActionListener(new ActionListener(){
    public void actionPerformed(    final ActionEvent e){
      updateOutFileType();
    }
  }
);
  GridBagUtils.setAttributes(gbc,"anchor=SOUTHWEST, fill=NONE, insets.top=12, weightx = 0, weighty=0.5, gridy=" + String.valueOf(line++));
  GridBagUtils.addToPanel(ioParamPanel,outFormatLabel,gbc);
  GridBagUtils.setAttributes(gbc,"anchor=NORTHWEST, weighty=0.5, insets.top=0 ,gridy=" + String.valueOf(line++));
  GridBagUtils.addToPanel(ioParamPanel,_fileFormatCombo,gbc);
  JPanel procParamPanel=GridBagUtils.createDefaultEmptyBorderPanel();
  gbc=GridBagUtils.createConstraints(null);
  addParameterToPanel2(procParamPanel,BaerConstants.USE_CLOUD_PARAM_NAME,line++,12,false,gbc);
  addParameterToPanel2(procParamPanel,BaerConstants.USE_BAER_PARAM_NAME,line++,2,false,gbc);
  addParameterToPanel2(procParamPanel,BaerConstants.USE_ATM_COR_PARAM_NAME,line++,2,false,gbc);
  addParameterToPanel2(procParamPanel,BaerConstants.SMAC_PARAM_NAME,line++,12,true,gbc);
  addParameterToPanel2(procParamPanel,BaerConstants.AER_PHASE_PARAM_NAME,line++,2,true,gbc);
  addParameterToPanel2(procParamPanel,BaerConstants.BITMASK_PARAM_NAME,line++,12,false,gbc);
  getParameter(BaerConstants.USE_CLOUD_PARAM_NAME).getEditor().setEnabled(false);
  final JTabbedPane tabbedPane=new JTabbedPane();
  tabbedPane.addTab("I/O Parameters",ioParamPanel);
  tabbedPane.addTab("Processing Parameters",procParamPanel);
  _uiComponent=tabbedPane;
}
 

Example 19

From project BioMAV, under directory /Behavior/src/nl/ru/ai/projects/parrot/biomav/editor/.

Source file: BehaviorEditor.java

  30 
vote

private void setNewSelectedParameterControlInterface(ParameterControlInterface pcInterface){
  pcInterfacePanelContents.removeAll();
  selectedPCInterface=null;
  if (pcInterface != null) {
    selectedPCInterface=pcInterface;
    final ParameterControlInterface fpcInterface=pcInterface;
    String[] parameterNames=pcInterface.getParameterNames();
    ParameterControlInterface.ParameterTypes[] parameterTypes=pcInterface.getParameterTypes();
    for (int i=0; i < parameterTypes.length; i++) {
      JLabel label=new JLabel(parameterNames[i]);
      pcInterfacePanelContents.add(label);
      final int index=i;
switch (parameterTypes[i]) {
case OPTIONS:
        final JComboBox optionComboBox=new JComboBox(pcInterface.getParameterOptions(i));
      optionComboBox.setEditable(false);
    optionComboBox.setSelectedItem(pcInterface.getParameterValue(i));
  optionComboBox.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      fpcInterface.setParameterValue(index,optionComboBox.getSelectedItem());
      repaint();
    }
  }
);
pcInterfacePanelContents.add(optionComboBox);
break;
}
}
}
pcInterfacePanel.validate();
}
 

Example 20

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

Source file: IntroNoMVC.java

  30 
vote

private void wireUi(){
  sendButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      String content="[to=" + toField.getText() + ", subject="+ subjectField.getText()+ ", body="+ bodyArea.getText()+ "]";
      System.out.println("Send " + content);
    }
  }
);
  yellButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      bodyArea.setText(bodyArea.getText().toUpperCase());
    }
  }
);
  DocumentListener enableTracker=new DocumentListener(){
    public void changedUpdate(    DocumentEvent e){
      onUpdate();
    }
    public void insertUpdate(    DocumentEvent e){
      onUpdate();
    }
    public void removeUpdate(    DocumentEvent e){
      onUpdate();
    }
  }
;
  toField.getDocument().addDocumentListener(enableTracker);
  subjectField.getDocument().addDocumentListener(enableTracker);
  bodyArea.getDocument().addDocumentListener(enableTracker);
}
 

Example 21

From project CircDesigNA, under directory /src/circdesigna/.

Source file: CircDesigNA.java

  30 
vote

public void runIteration(){
  final boolean[] return_shared=new boolean[]{false};
  r.runOnIteration=new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      pause();
      return_shared[0]=true;
    }
  }
;
  resume();
  while (!return_shared[0]) {
    if (isFinished()) {
      break;
    }
    try {
      Thread.sleep(1);
    }
 catch (    InterruptedException e1) {
      e1.printStackTrace();
    }
  }
  r.runOnIteration=null;
}
 

Example 22

From project codjo-control, under directory /codjo-control-gui/src/main/java/net/codjo/control/gui/plugin/.

Source file: DefaultQuarantineDetailWindow.java

  30 
vote

private void addForceButton(){
  forceButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent event){
      isFormClean=!buttonPanelLogic.getGui().getOkButton().isEnabled();
      int errorType=Integer.parseInt(dataSource.getFieldValue(ERROR_TYPE));
      dataSource.setFieldValue(ERROR_TYPE,Integer.toString(-errorType));
      try {
        dataSource.save();
        dispose();
      }
 catch (      RequestException ex) {
        ErrorDialog.show(null,ex.getLocalizedMessage(),ex);
      }
    }
  }
);
  int errorType=Integer.parseInt(dataSource.getFieldValue(ERROR_TYPE));
  if (errorType >= QuarantineUtil.FIRST_OVERRIDABLE_CONTROL) {
    forceButton.setEnabled(true);
  }
 else {
    forceButton.setEnabled(false);
  }
  buttonPanelLogic.getGui().add(forceButton,2);
}
 

Example 23

From project css-x-fire, under directory /src/com/github/cssxfire/.

Source file: ProjectSettingsConfigurable.java

  30 
vote

public JComponent createComponent(){
  routesTable=new FileTreeTable();
  routesTable.getColumnModel().getColumn(0).setPreferredWidth(260);
  routesTable.getColumnModel().getColumn(1).setPreferredWidth(240);
  routesScrollPane.setViewportView(routesTable);
  routesTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
    public void valueChanged(    ListSelectionEvent e){
      updateWebRootButton();
    }
  }
);
  buttonSetRoot.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      updateWebRoot();
    }
  }
);
  reset();
  updateWebRootButton();
  return myPanel;
}
 

Example 24

From project cytoscape-plugins, under directory /org.openbel.cytoscape.navigator/src/org/openbel/cytoscape/navigator/dialog/.

Source file: SearchKamListDialog.java

  30 
vote

private void initUI(){
  initComponents();
  setLocationRelativeTo(null);
  setResizable(false);
  searchButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      searchButtonActionPerformed(e);
    }
  }
);
  addButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      addButtonActionPerformed(e);
    }
  }
);
  List<KamOption> kamOptions=buildKamOptions();
  kamComboBox.setModel(new DefaultComboBoxModel(kamOptions.toArray(new KamOption[kamOptions.size()])));
  namespaceComboBox.setModel(new DefaultComboBoxModel(new Vector<NamespaceOption>(getNamespaceOptions())));
  fileTextField.setText("");
  fileTextField.setEditable(false);
  ResultsTableModel model=new ResultsTableModel();
  resultsTable.setModel(model);
  resultsTable.setRowSorter(new TableRowSorter<ResultsTableModel>(model));
  resultsTable.setCellSelectionEnabled(false);
  edgeComboBox.setModel(new DefaultComboBoxModel(EdgeOption.values()));
  edgeComboBox.getModel().setSelectedItem(EdgeOption.INTERCONNECT);
  FunctionType[] functions=Utility.getFunctions();
  String[] funcStrings=new String[functions.length + 1];
  funcStrings[0]=ALL_SELECTION;
  for (int i=0; i < functions.length; i++) {
    funcStrings[i + 1]=functions[i].name();
  }
  functionComboBox.setModel(new DefaultComboBoxModel(funcStrings));
  functionComboBox.getModel().setSelectedItem(ALL_SELECTION);
  browseResultsLabel.setText("No file loaded");
  resultsFoundLabel.setText("No search performed");
  searchButton.setEnabled(false);
  addButton.setEnabled(false);
}
 

Example 25

From project dawn-isencia, under directory /com.isencia.passerelle.commons/src/main/java/com/isencia/util/swing/components/.

Source file: FinderAccessory.java

  30 
vote

/** 
 * @param parent JFileChooser containing this accessory
 */
public FinderAccessory(JFileChooser parent){
  setBorder(new TitledBorder(ACCESSORY_NAME));
  setLayout(new BorderLayout());
  Box formBox=Box.createVerticalBox();
  valueField=new FormField();
  valueField.setEditable(true);
  JLabel extLbl=new JLabel("Selected extensions");
  extLbl.setToolTipText("Enter one or more file extensions, separated by spaces. E.g. [txt xml java]");
  formBox.add(new FormEntry(extLbl,valueField));
  add(formBox,BorderLayout.NORTH);
  valueField.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      pushExtensions();
    }
  }
);
  chooser=parent;
}
 

Example 26

From project Agot-Java, under directory /src/main/java/got/test/.

Source file: TestMainUI.java

  29 
vote

public MainPanel(TestMainUI fram){
  this.screen=Utility.createImage(width,height,true);
  this.setPreferredSize(new Dimension(width,height));
  this.graphics=(Graphics2D)screen.getGraphics();
  graphics.drawImage(backgroundImage,0,0,null);
  this.fram=fram;
  this.repaint();
  this.addMouseListener(new MouseListener(){
    @Override public void mouseClicked(    MouseEvent e){
      Timer timer=new Timer(3000,new ActionListener(){
        @Override public void actionPerformed(        ActionEvent e){
          Random random=new Random(System.nanoTime());
          if (MainPanel.this.fram.state == 0) {
            new InfoStatusDialog(TestMainUI.this,String.valueOf(random.nextLong()));
          }
        }
      }
);
      timer.start();
      timer.setRepeats(true);
    }
    @Override public void mouseEntered(    MouseEvent e){
    }
    @Override public void mouseExited(    MouseEvent e){
    }
    @Override public void mousePressed(    MouseEvent e){
    }
    @Override public void mouseReleased(    MouseEvent e){
    }
  }
);
}
 

Example 27

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

Source file: GridPanel.java

  29 
vote

/** 
 * Show a tool tip.
 * @param tipText the tool tip text
 * @param pt the pixel position over which to show the tip
 */
public void showTip(String tipText,Point pt){
  if (getRootPane() == null)   return;
  if (glassPane == null) {
    getRootPane().setGlassPane(glassPane=new JPanel());
    glassPane.setOpaque(false);
    glassPane.setLayout(null);
    glassPane.add(tip=new JToolTip());
    tipTimer=new Timer(TIP_DELAY,new ActionListener(){
      public void actionPerformed(      ActionEvent evt){
        glassPane.setVisible(false);
      }
    }
);
    tipTimer.setRepeats(false);
  }
  if (tipText == null)   return;
  tip.setTipText(tipText);
  tip.setLocation(SwingUtilities.convertPoint(this,pt,glassPane));
  tip.setSize(tip.getPreferredSize());
  glassPane.setVisible(true);
  glassPane.repaint();
  tipTimer.restart();
}
 

Example 28

From project contribution_eevolution_smart_browser, under directory /client/src/org/compiere/apps/.

Source file: APanel.java

  29 
vote

/** 
 * Constructor.
 * @param name
 * @param accelerator
 * @param al
 */
SwitchAction(String name,KeyStroke accelerator,ActionListener al){
  super(name);
  putValue(Action.NAME,name);
  putValue(Action.SHORT_DESCRIPTION,name);
  putValue(Action.ACCELERATOR_KEY,accelerator);
  putValue(Action.ACTION_COMMAND_KEY,name);
  this.al=al;
  this.name=name;
}