Java Code Examples for javax.swing.JButton

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/.

Source file: AddisWindow.java

  32 
vote

private JButton createToolbarButton(final CategoryKnowledge knowledge){
  String title="New " + knowledge.getSingularCapitalized();
  JButton topAddStudyButton=new JButton(title,Main.IMAGELOADER.getIcon(knowledge.getNewIconName()));
  topAddStudyButton.setToolTipText(title);
  topAddStudyButton.addActionListener(new AbstractAction(){
    public void actionPerformed(    final ActionEvent e){
      showAddDialog(knowledge,null);
    }
  }
);
  return topAddStudyButton;
}
 

Example 2

From project autopsy, under directory /Core/src/org/sleuthkit/autopsy/casemodule/.

Source file: AddImageAction.java

  32 
vote

/** 
 * Set the focus to the button of the given name on this wizard dialog. Note: the name of the buttons that available are "Next >", "< Back", "Cancel", and "Finish". If you change the name of any of those buttons, use the latest name instead.
 * @param buttonText  the text of the button
 */
public void requestFocusButton(String buttonText){
  Object[] wizardButtons=wizardDescriptor.getOptions();
  for (int i=0; i < wizardButtons.length; i++) {
    JButton tempButton=(JButton)wizardButtons[i];
    if (tempButton.getText().equals(buttonText)) {
      tempButton.setDefaultCapable(true);
      tempButton.requestFocus();
    }
  }
}
 

Example 3

From project Bit4Tat, under directory /Bit4Tat/src/com/Bit4Tat/.

Source file: Bit4Tat.java

  32 
vote

public void actionPerformed(ActionEvent event){
  currentButton.setContentAreaFilled(false);
  JButton clickedButton=(JButton)event.getSource();
  clickedButton.setBackground(Color.LIGHT_GRAY);
  clickedButton.setContentAreaFilled(true);
  currentButton=clickedButton;
  contentPane=getContentPane();
  contentPane.remove(currentPanel);
  currentPanel=panelList.get(event.getActionCommand());
  contentPane.add(currentPanel);
  contentPane.validate();
  repaint();
}
 

Example 4

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

Source file: JDayChooser.java

  32 
vote

/** 
 * Initializes the locale specific names for the days of the week.
 */
protected void init(){
  JButton testButton=new JButton();
  oldDayBackgroundColor=testButton.getBackground();
  selectedColor=new Color(160,160,160);
  Date date=calendar.getTime();
  calendar=Calendar.getInstance(locale);
  calendar.setTime(date);
  drawDayNames();
  drawDays();
}
 

Example 5

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

Source file: EditorMainPanelLogic.java

  32 
vote

private void initialiseUndoRedoButtons(){
  JButton undoButton=editorMainPanelGui.getUndoButton();
  JButton redoButton=editorMainPanelGui.getRedoButton();
  undoButton.setAction(undoAction);
  redoButton.setAction(redoAction);
}
 

Example 6

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

Source file: CDialogTemplate.java

  32 
vote

public JPanel drawButtonPanel(){
  JPanel panel_buttons=new JPanel();
  JButton ok=new JButton("OK");
  JButton cancel=new JButton("Cancel");
  panel_buttons.add(ok);
  panel_buttons.add(cancel);
  ok.addActionListener(this);
  cancel.addActionListener(this);
  return panel_buttons;
}
 

Example 7

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

Source file: JDayChooser.java

  32 
vote

/** 
 * JDayChooser is the ActionListener for all day buttons.
 */
public void actionPerformed(ActionEvent e){
  try {
    JButton button=(JButton)e.getSource();
    int day=(new Integer(button.getText())).intValue();
    setDay(day);
  }
 catch (  Exception ex) {
  }
}
 

Example 8

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

Source file: SolverAndPersistenceFrame.java

  32 
vote

private JPanel createScorePanel(){
  JPanel panel=new JPanel(new BorderLayout());
  progressBar=new JProgressBar(0,100);
  panel.add(progressBar,BorderLayout.WEST);
  resultLabel=new JLabel("No solution loaded yet");
  resultLabel.setBorder(BorderFactory.createLoweredBevelBorder());
  panel.add(resultLabel,BorderLayout.CENTER);
  showConstraintScoreMapDialogAction=new ShowConstraintScoreMapDialogAction();
  JButton constraintScoreMapButton=new JButton(showConstraintScoreMapDialogAction);
  panel.add(constraintScoreMapButton,BorderLayout.EAST);
  return panel;
}
 

Example 9

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

Source file: OkCancelDialog.java

  32 
vote

private JButton createCancelButton(){
  JButton cancelButton=new JButton("Cancel");
  cancelButton.addActionListener(new AbstractAction(){
    public void actionPerformed(    ActionEvent arg0){
      cancel();
    }
  }
);
  return cancelButton;
}
 

Example 10

From project e4-rendering, under directory /com.toedter.e4.ui.workbench.renderers.swing/src/com/toedter/e4/ui/workbench/renderers/swing/.

Source file: ToolItemRenderer.java

  32 
vote

@Override public void hookControllerLogic(MUIElement me){
  if (me instanceof MDirectToolItem) {
    final MDirectToolItem item=(MDirectToolItem)me;
    item.setObject(contributionFactory.create(item.getContributionURI(),getContext(item)));
    JButton button=(JButton)item.getWidget();
    button.addActionListener(createEventHandler(item));
  }
 else   if (me instanceof MHandledToolItem) {
    final MHandledItem item=(MHandledToolItem)me;
    JButton button=(JButton)item.getWidget();
    button.addActionListener(createParametrizedCommandEventHandler(item));
  }
}
 

Example 11

From project Enterprise-Application-Samples, under directory /CCA/PushApp/src/eclserver/.

Source file: Cal.java

  32 
vote

/** 
 * Unset any previously highlighted day 
 */
private void clearDayActive(){
  JButton b;
  if (activeDay > 0) {
    b=labs[(leadGap + activeDay - 1) / 7][(leadGap + activeDay - 1) % 7];
    b.setBackground(b0.getBackground());
    b.repaint();
    activeDay=-1;
  }
}
 

Example 12

From project flyingsaucer, under directory /flying-saucer-core/src/main/java/org/xhtmlrenderer/simple/extend/form/.

Source file: ButtonField.java

  32 
vote

public JComponent create(){
  JButton button=new JButton();
  String value=getAttribute("value");
  if (value == null || value.length() == 0)   value=" ";
  applyComponentStyle(button);
  button.setText(value);
  button.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      JOptionPane.showMessageDialog(null,"<input type=\"button\" .../> doesn't make much " + "sense without <script>! (Volunteers wanted)","We need <script> support!",JOptionPane.INFORMATION_MESSAGE);
    }
  }
);
  return button;
}
 

Example 13

From project freemind, under directory /freemind/accessories/plugins/time/.

Source file: JDayChooser.java

  32 
vote

/** 
 * Initilizes the locale specific names for the days of the week.
 */
protected void init(){
  JButton testButton=new JButton();
  oldDayBackgroundColor=testButton.getBackground();
  selectedColor=new Color(160,160,160);
  Date date=calendar.getTime();
  calendar=Calendar.getInstance(locale);
  calendar.setTime(date);
  drawDayNames();
  drawDays();
}
 

Example 14

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

Source file: JudgeDialog.java

  31 
vote

public void createComponent(){
  this.setLayout(new GridLayout(1,9));
  families=node.getGameInfo().orderByCompetePower();
  FamilyInfo last=null;
  int i=1;
  for (  final FamilyInfo fi : families) {
    if (last != null && last.getCompetePower() == fi.getCompetePower()) {
      JudgeButton judgeButton=new JudgeButton(last.getName(),fi.getName(),i - 1,i);
      btns.add(judgeButton);
      this.add(judgeButton);
    }
    JButton familyBtn=new JButton();
    Image image=Utility.loadImage("got/resource/house/" + fi.getName() + ".png");
    ImageIcon icon=new ImageIcon(image);
    familyBtn.setIcon(icon);
    familyBtns.add(familyBtn);
    this.add(familyBtn);
    last=fi;
    i++;
  }
  yesBtn=new JButton();
  this.add(yesBtn);
}
 

Example 15

From project alg-vis, under directory /src/algvis/gui/.

Source file: Buttons.java

  31 
vote

private JButton createButton(String alt,String path){
  java.net.URL imgURL=getClass().getResource(path);
  if (imgURL != null) {
    return new JButton(new ImageIcon(imgURL));
  }
 else {
    System.err.println("Couldn't find file: " + path);
    return new JButton(alt);
  }
}
 

Example 16

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

Source file: IcolForm.java

  31 
vote

private JPanel createMerisCloudPanel(){
  JPanel panel=cloudProductSelector.createDefaultPanel();
  panel.setBorder(BorderFactory.createTitledBorder("Cloud Mask"));
  final JTextField textField=new JTextField(30);
  final Binding binding=bc.bind("cloudMaskExpression",textField);
  final JPanel subPanel=new JPanel(new BorderLayout(2,2));
  subPanel.add(new JLabel("Mask expression:"),BorderLayout.NORTH);
  subPanel.add(textField,BorderLayout.CENTER);
  final JButton etcButton=new JButton("...");
  etcButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      ProductExpressionPane expressionPane;
      Product currentProduct=cloudProductSelector.getSelectedProduct();
      expressionPane=ProductExpressionPane.createBooleanExpressionPane(new Product[]{currentProduct},currentProduct,appContext.getPreferences());
      expressionPane.setCode((String)binding.getPropertyValue());
      if (expressionPane.showModalDialog(null,"Expression Editor") == ModalDialog.ID_OK) {
        binding.setPropertyValue(expressionPane.getCode());
      }
    }
  }
);
  cloudProductSelector.addSelectionChangeListener(new AbstractSelectionChangeListener(){
    @Override public void selectionChanged(    SelectionChangeEvent event){
      updateMerisCloudMaskExpressionEditor(textField,etcButton);
    }
  }
);
  updateMerisCloudMaskExpressionEditor(textField,etcButton);
  subPanel.add(etcButton,BorderLayout.EAST);
  panel.add(subPanel);
  return panel;
}
 

Example 17

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

Source file: DefaultSyntaxKit.java

  31 
vote

public void addToolBarActions(JEditorPane editorPane,JToolBar toolbar,int index){
  String[] toolBarItems=getConfig().getPropertyList(CONFIG_TOOLBAR);
  if (toolBarItems == null || toolBarItems.length == 0) {
    toolBarItems=getConfig().getPropertyList(CONFIG_MENU);
    if (toolBarItems == null || toolBarItems.length == 0) {
      return;
    }
  }
  int i=index;
  for (  String menuString : toolBarItems) {
    if (menuString.equals("-") || menuString.startsWith("<") || menuString.startsWith(">")) {
      if (index == -1) {
        toolbar.addSeparator();
      }
 else {
        toolbar.add(new JToolBar.Separator(),i);
      }
    }
 else {
      Action action=editorPane.getActionMap().get(menuString);
      if (action != null && action.getValue(Action.SMALL_ICON) != null) {
        JButton b=new JButton(action);
        b.setFocusable(false);
        b.setText("");
        if (index == -1) {
          toolbar.add(b);
        }
 else {
          toolbar.add(b,i);
        }
      }
    }
    i++;
  }
}
 

Example 18

From project ceres, under directory /ceres-ui/src/main/java/com/bc/ceres/swing/binding/internal/.

Source file: FileEditor.java

  31 
vote

@Override public JComponent createEditorComponent(PropertyDescriptor propertyDescriptor,BindingContext bindingContext){
  final JTextField textField=new JTextField();
  final ComponentAdapter adapter=new TextComponentAdapter(textField);
  final Binding binding=bindingContext.bind(propertyDescriptor.getName(),adapter);
  final JPanel editorPanel=new JPanel(new BorderLayout(2,2));
  editorPanel.add(textField,BorderLayout.CENTER);
  final JButton etcButton=new JButton("...");
  final Dimension size=new Dimension(26,16);
  etcButton.setPreferredSize(size);
  etcButton.setMinimumSize(size);
  etcButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      final JFileChooser fileChooser=new JFileChooser();
      int i=fileChooser.showDialog(editorPanel,"Select");
      if (i == JFileChooser.APPROVE_OPTION && fileChooser.getSelectedFile() != null) {
        binding.setPropertyValue(fileChooser.getSelectedFile());
      }
    }
  }
);
  editorPanel.add(etcButton,BorderLayout.EAST);
  return editorPanel;
}
 

Example 19

From project Clotho-Core, under directory /ClothoApps/PluginManager/src/org/clothocore/tool/pluginmanager/gui/.

Source file: ChooseDefaultConnection.java

  31 
vote

private void initComponents(){
  setLayout(null);
  this.addMouseListener(new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent e){
      if (e.getY() < 50) {
        _app.close();
        return;
      }
      return;
    }
  }
);
  ArrayList<ConnectionWrapper> allcon=Collator.getAllConnections();
  String[] data=new String[allcon.size()];
  for (int i=0; i < allcon.size(); i++) {
    data[i]=allcon.get(i).getDisplayName();
    _connections.put(data[i],allcon.get(i));
  }
  dataList=new JList(data);
  JScrollPane scrollPane=new JScrollPane(dataList);
  scrollPane.setBounds(30,30,200,200);
  add(scrollPane);
  JButton selectButton=new JButton();
  selectButton.setText("Set as default");
  selectButton.setBounds(250,50,100,27);
  selectButton.addActionListener(new java.awt.event.ActionListener(){
    @Override public void actionPerformed(    java.awt.event.ActionEvent evt){
      defaultSelected();
    }
  }
);
  add(selectButton);
}
 

Example 20

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

Source file: DbToolBar.java

  31 
vote

/** 
 * Constructor for designer.
 */
public DbToolBar(){
  add(new JButton(new ImageIcon("../images/Previous.gif")));
  add(new JButton(new ImageIcon("../images/Next.gif")));
  addSeparator();
  add(new JButton(new ImageIcon("../images/Add.gif")));
  add(new JButton(new ImageIcon("../images/Edit.gif")));
  add(new JButton(new ImageIcon("../images/Delete.gif")));
  add(new JButton(new ImageIcon("../images/force.gif")));
  addSeparator();
  add(new JButton(new ImageIcon("../images/Find.gif")));
  add(new JButton(new ImageIcon("../images/ShowAll.gif")));
  addSeparator();
  add(new JButton(new ImageIcon("../images/Close.gif")));
}
 

Example 21

From project dawn-common, under directory /org.dawb.hdf5/src/ncsa/hdf/view/.

Source file: Chart.java

  31 
vote

/** 
 * Creates and layouts GUI components.
 */
protected void createUI(){
  Window owner=getOwner();
  JPanel contentPane=(JPanel)getContentPane();
  contentPane.setLayout(new BorderLayout(5,5));
  contentPane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  int w=640 + (ViewProperties.getFontSize() - 12) * 15;
  int h=400 + (ViewProperties.getFontSize() - 12) * 10;
  contentPane.setPreferredSize(new Dimension(w,h));
  contentPane.add(chartP,BorderLayout.CENTER);
  JButton button=new JButton("Close");
  button.addActionListener(this);
  button.setActionCommand("Close");
  JPanel tmp=new JPanel();
  tmp.add(button);
  contentPane.add(tmp,BorderLayout.SOUTH);
  Point l=owner.getLocation();
  l.x+=220;
  l.y+=100;
  setLocation(l);
  pack();
}
 

Example 22

From project des, under directory /daemon/lib/apache-log4j-1.2.16/contribs/CekiGulcu/.

Source file: AppenderTable.java

  31 
vote

static public void main(String[] args){
  if (args.length != 2) {
    System.err.println("Usage: java AppenderTable bufferSize runLength\n" + "  where bufferSize is the size of the cyclic buffer in the TableModel\n" + "  and runLength is the total number of elements to add to the table in\n"+ "  this test run.");
    return;
  }
  JFrame frame=new JFrame("JTableAppennder test");
  Container container=frame.getContentPane();
  AppenderTable tableAppender=new AppenderTable();
  int bufferSize=Integer.parseInt(args[0]);
  AppenderTableModel model=new AppenderTableModel(bufferSize);
  tableAppender.setModel(model);
  int runLength=Integer.parseInt(args[1]);
  JScrollPane sp=new JScrollPane(tableAppender);
  sp.setPreferredSize(new Dimension(250,80));
  container.setLayout(new BoxLayout(container,BoxLayout.X_AXIS));
  container.add(sp);
  JButton button=new JButton("ADD");
  container.add(button);
  button.addActionListener(new JTableAddAction(tableAppender));
  frame.setSize(new Dimension(500,300));
  frame.setVisible(true);
  long before=System.currentTimeMillis();
  int i=0;
  while (i++ < runLength) {
    LoggingEvent event=new LoggingEvent("x",logger,Level.ERROR,"Message " + i,null);
    tableAppender.doAppend(event);
  }
  long after=System.currentTimeMillis();
  long totalTime=(after - before);
  System.out.println("Total time :" + totalTime + " milliseconds for "+ "runLength insertions.");
  System.out.println("Average time per insertion :" + (totalTime * 1000 / runLength) + " micro-seconds.");
}
 

Example 23

From project empire-db, under directory /empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/.

Source file: ClientGUI.java

  31 
vote

/** 
 * This method initializes _btnSearch
 * @return javax.swing.JButton
 */
private JButton get_btnSearch(){
  if (_btnSearch == null) {
    _btnSearch=new JButton();
    _btnSearch.setText("search");
    _btnSearch.setPreferredSize(new Dimension(80,20));
    _btnSearch.addActionListener(new java.awt.event.ActionListener(){
      public void actionPerformed(      java.awt.event.ActionEvent e){
        search();
      }
    }
);
  }
  return _btnSearch;
}
 

Example 24

From project enclojure, under directory /netbeans/plugins/org-enclojure-plugin/src/main/java/org/enclojure/ide/debugger/breakpoints/.

Source file: ClojureBreakpointActionsProvider.java

  31 
vote

private static void customize(Breakpoint b){
  JComponent c=null;
  if (b instanceof ClojureLineBreakpoint) {
    c=new ClojureBreakpointPanel((ClojureLineBreakpoint)b);
  }
  DialogDescriptor descriptor=new DialogDescriptor(c,NbBundle.getMessage(ClojureBreakpointActionsProvider.class,"CTL_Breakpoint_Customizer_Title"));
  JButton bOk=null;
  JButton bClose=null;
  descriptor.setOptions(new JButton[]{bOk=new JButton(NbBundle.getMessage(ClojureBreakpointActionsProvider.class,"CTL_Ok")),bClose=new JButton(NbBundle.getMessage(ClojureBreakpointActionsProvider.class,"CTL_Close"))});
  HelpCtx helpCtx=HelpCtx.findHelp(c);
  if (helpCtx == null)   helpCtx=new HelpCtx("debug.add.breakpoint");
  ;
  descriptor.setHelpCtx(helpCtx);
  bOk.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ClojureBreakpointActionsProvider.class,"ACSD_CTL_Ok"));
  bOk.setMnemonic(NbBundle.getMessage(ClojureBreakpointActionsProvider.class,"CTL_Ok_MNEM").charAt(0));
  bClose.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ClojureBreakpointActionsProvider.class,"ACSD_CTL_Close"));
  bClose.setMnemonic(NbBundle.getMessage(ClojureBreakpointActionsProvider.class,"CTL_Close_MNEM").charAt(0));
  descriptor.setClosingOptions(null);
  Dialog d=DialogDisplayer.getDefault().createDialog(descriptor);
  d.pack();
  d.setVisible(true);
  if (descriptor.getValue() == bOk) {
    ((Controller)c).ok();
  }
}
 

Example 25

From project encog-java-workbench, under directory /src/main/java/org/encog/workbench/dialogs/common/.

Source file: EncogCommonDialog.java

  31 
vote

private void init(){
  final Container content=getContentPane();
  content.setLayout(new BorderLayout());
  this.buttonPanel.add(this.ctrlOK=new JButton("OK"));
  this.buttonPanel.add(this.ctrlCancel=new JButton("Cancel"));
  this.ctrlCancel.addActionListener(this);
  this.ctrlOK.addActionListener(this);
  content.add(this.bodyPanel,BorderLayout.CENTER);
  content.add(this.buttonPanel,BorderLayout.SOUTH);
}
 

Example 26

From project extension_libero_manufacturing, under directory /extension/eevolution/libero/src/main/java/org/eevolution/form/.

Source file: VMRPDetailed.java

  31 
vote

/** 
 * Static Init
 * @throws Exception
 */
protected void jbInit() throws Exception {
  mainPanel.setLayout(new java.awt.BorderLayout());
  panel.setLayout(new java.awt.BorderLayout());
  southPanel.setLayout(southLayout);
  southPanel.add(confirmPanel,BorderLayout.CENTER);
  southPanel.add(statusBar,BorderLayout.SOUTH);
  mainPanel.add(southPanel,BorderLayout.SOUTH);
  mainPanel.add(parameterPanel,BorderLayout.NORTH);
  mainPanel.add(scrollPane,BorderLayout.CENTER);
  scrollPane.getViewport().add(p_table,null);
  confirmPanel.addActionListener(this);
  confirmPanel.getResetButton().setVisible(hasReset());
  confirmPanel.getCustomizeButton().setVisible(hasCustomize());
  confirmPanel.getHistoryButton().setVisible(hasHistory());
  confirmPanel.getZoomButton().setVisible(hasZoom());
  JButton print=ConfirmPanel.createPrintButton(true);
  print.addActionListener(this);
  confirmPanel.addButton(print);
  popup.add(calcMenu);
  calcMenu.setText(Msg.getMsg(getCtx(),"Calculator"));
  calcMenu.setIcon(new ImageIcon(org.compiere.Adempiere.class.getResource("images/Calculator16.gif")));
  calcMenu.addActionListener(this);
  p_table.getSelectionModel().addListSelectionListener(this);
  enableButtons();
}
 

Example 27

From project ChkBugReport, under directory /src/com/sonyericsson/chkbugreport/.

Source file: Gui.java

  30 
vote

public Gui(Main main){
  super("ChkBugReport - (C) 2012 Sony-Ericsson");
  mMain=main;
  JTabbedPane tabs=new JTabbedPane();
  setContentPane(tabs);
  JPanel runPanel=new JPanel(new BorderLayout());
  tabs.addTab("Run",runPanel);
  JPanel runTB=new JPanel();
  runPanel.add(runTB,BorderLayout.NORTH);
  mBtnAdb=new JButton("Fetch from device");
  mBtnAdb.setEnabled(false);
  runTB.add(mBtnAdb);
  mDropArea=new JLabel("Drop a bugreport file here!",JLabel.CENTER);
  runPanel.add(mDropArea,BorderLayout.CENTER);
  mDropArea.setBorder(BorderFactory.createLoweredBevelBorder());
  mDropArea.setTransferHandler(new MyTransferHandler());
  mStatus=new JLabel("Ready.");
  runPanel.add(mStatus,BorderLayout.SOUTH);
  mAdbExt=mMain.findExtension("AdbExtension");
  if (mAdbExt != null) {
    mBtnAdb.setEnabled(true);
    mBtnAdb.addActionListener(this);
  }
  JPanel settingsPanel=new JPanel();
  settingsPanel.setLayout(new BoxLayout(settingsPanel,BoxLayout.Y_AXIS));
  tabs.addTab("Settings",settingsPanel);
  buildSettings(settingsPanel);
  setSize(640,480);
  setDefaultCloseOperation(EXIT_ON_CLOSE);
  setLocationRelativeTo(null);
}
 

Example 28

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

Source file: ExecutionListParamWindow.java

  30 
vote

private void buildImportExportPanel(){
  JPanel importExportPanel=new JPanel();
  exportParamButton=new JButton();
  GuiUtils.setMaxSize(exportParamButton,25,25);
  exportParamButton.setIcon(GuiUtils.loadIcon(getClass(),"/images/export.png"));
  exportParamButton.setToolTipText("Exporter le param?rage des listes de traitements");
  importParamButton=new JButton();
  GuiUtils.setMaxSize(importParamButton,25,25);
  importParamButton.setIcon(GuiUtils.loadIcon(getClass(),"/images/open.png"));
  importParamButton.setToolTipText("Importer le param?rage des listes de traitements");
  importExportPanel.add(exportParamButton);
  importExportPanel.add(importParamButton);
  topPanel.setLayout(new BorderLayout());
  topPanel.add(repositoryFamilyPanel,BorderLayout.WEST);
  topPanel.add(importExportPanel,BorderLayout.EAST);
}
 

Example 29

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

Source file: SearchKamDialog.java

  30 
vote

private JPanel createButtonPanel(){
  JPanel bp=new JPanel();
  bp.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));
  cancelBtn=new JButton();
  cancelBtn.addActionListener(this);
  cancelBtn.setText("Cancel");
  cancelBtn.setPreferredSize(new java.awt.Dimension(85,25));
  bp.add(cancelBtn);
  searchBtn=new JButton();
  searchBtn.addActionListener(this);
  searchBtn.setText("Search");
  searchBtn.setPreferredSize(new java.awt.Dimension(85,25));
  bp.add(searchBtn);
  addBtn=new JButton();
  addBtn.addActionListener(this);
  addBtn.setText("Add");
  addBtn.setPreferredSize(new java.awt.Dimension(85,25));
  bp.add(addBtn);
  return bp;
}
 

Example 30

From project dolphin, under directory /org.adarsh.jutils/src/.

Source file: Main.java

  30 
vote

private void initComponent(){
  b1=new JButton("go");
  this.setBounds(300,400,200,100);
  b1.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      final String cp=System.getProperty("java.class.path").toLowerCase();
      if (cp.indexOf("jutils") >= 0 && cp.endsWith(".jar")) {
        final File file=new File(linksDir,"mypllugins.txt");
        if (!file.exists() && file.length() <= 0) {
          if (linksDir.exists() || linksDir.mkdirs()) {
            write(content,file);
          }
        }
        if (pluginDir.exists() || pluginDir.mkdirs()) {
          final String command="CMD /c COPY /Y \"" + new File(cp).getAbsolutePath() + "\" \""+ path+ "\\jutils.jar\"";
          final File destFile=new File(path,"jutils.jar");
          if (destFile.exists() && destFile.delete()) {
            exec(command);
            log(command);
          }
          if (destFile.exists()) {
            exec("explorer /select, \"" + destFile + "\"");
            log("explorer /select, \"" + destFile + "\"");
          }
        }
      }
    }
  }
);
  this.add(b1);
  this.setVisible(true);
  this.setTitle("Jutils create by tyj");
  this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
 

Example 31

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

Source file: DroolsJbpmIntegrationExamplesApp.java

  30 
vote

private Container createContentPane(){
  JPanel contentPane=new JPanel(new GridLayout(0,1));
  contentPane.add(new JLabel("Which GUI example do you want to see?"));
  contentPane.add(new JButton(new AbstractAction("ConwayGUI"){
    public void actionPerformed(    ActionEvent e){
      new ConwayRuleFlowGroupRun().init(false);
    }
  }
));
  contentPane.add(new JButton(new AbstractAction("BrokerExample (Fusion CEP)"){
    public void actionPerformed(    ActionEvent e){
      new BrokerExample().init(false);
    }
  }
));
  contentPane.add(new JLabel("Which output example do you want to see?"));
  contentPane.add(new JButton(new AbstractAction("NumberGuessExample"){
    public void actionPerformed(    ActionEvent e){
      NumberGuessExample.main(new String[0]);
    }
  }
));
  return contentPane;
}
 

Example 32

From project encog-java-core, under directory /src/main/java/org/encog/platformspecific/j2se/.

Source file: TrainingDialog.java

  30 
vote

/** 
 * Construct the training dialog.
 */
public TrainingDialog(){
  this.setSize(320,100);
  setTitle("Training");
  final Container content=getContentPane();
  content.setLayout(new BorderLayout());
  final JPanel statsPanel=new JPanel();
  statsPanel.setLayout(new GridLayout(3,2));
  statsPanel.add(new JLabel("Current Error:"));
  statsPanel.add(this.labelError=new JLabel("Starting..."));
  statsPanel.add(new JLabel("Iterations:"));
  statsPanel.add(this.labelIterations=new JLabel(""));
  statsPanel.add(new JLabel("Training Time:"));
  statsPanel.add(this.labelTime=new JLabel(""));
  content.add(this.buttonStop=new JButton("Stop"),BorderLayout.SOUTH);
  content.add(statsPanel,BorderLayout.CENTER);
  this.buttonStop.addActionListener(this);
}
 

Example 33

From project encog-java-examples, under directory /src/main/java/org/encog/examples/gui/elementary/.

Source file: ElementaryExample.java

  30 
vote

public ElementaryExample(){
  setSize(500,500);
  setTitle("Elementary CA");
  Container c=getContentPane();
  c.setLayout(new BorderLayout());
  JPanel buttonPanel=new JPanel();
  buttonPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
  c.add(buttonPanel,BorderLayout.NORTH);
  c.add(this.status=new JLabel(),BorderLayout.SOUTH);
  buttonPanel.add(new JLabel("Rule:"));
  buttonPanel.add(this.ruleText=new JTextField("110"));
  buttonPanel.add(new JLabel("Size:"));
  buttonPanel.add(this.sizeText=new JTextField("500"));
  buttonPanel.add(generateButton=new JButton("Generate"));
  this.worldArea=new DisplayPanel();
  this.scroll=new JScrollPane(this.worldArea);
  c.add(this.scroll,BorderLayout.CENTER);
  generateButton.addActionListener(this);
  String[] test={"1x","2x","3x","5x","10x"};
  this.zoomCombo=new JComboBox(test);
  buttonPanel.add(new JLabel("Zoom:"));
  buttonPanel.add(zoomCombo);
  zoomCombo.addItemListener(this);
  this.addWindowListener(this);
}
 

Example 34

From project formic, under directory /src/java/org/formic/wizard/form/gui/component/.

Source file: FileChooser.java

  30 
vote

/** 
 * Creates a new instance.
 */
public FileChooser(int selectionMode,String choosable){
  super(new BorderLayout());
  chooser=new JFileChooser(){
    private static final long serialVersionUID=1L;
    protected boolean processKeyBinding(    KeyStroke key,    KeyEvent event,    int condition,    boolean pressed){
      if (event.getKeyCode() == KeyEvent.VK_ENTER) {
        Component focusOwner=KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
        if (focusOwner instanceof JButton) {
          ((JButton)focusOwner).doClick();
          return true;
        }
      }
      return super.processKeyBinding(key,event,condition,pressed);
    }
  }
;
  chooser.setFileSelectionMode(selectionMode);
  addChoosableFileFilters(choosable);
  textField=new JTextField();
  button=new JButton(Installer.getString("browse.text"));
  button.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent event){
      int result=chooser.showOpenDialog(getParent());
      if (result == JFileChooser.APPROVE_OPTION) {
        textField.setText(chooser.getSelectedFile().getPath());
        textField.requestFocus();
      }
    }
  }
);
  add(textField,BorderLayout.CENTER);
  add(button,BorderLayout.EAST);
}
 

Example 35

From project contribution_eevolution_smart_browser, under directory /base/src/org/eevolution/form/.

Source file: VBrowser.java

  29 
vote

private void setupToolBar(){
  AppsAction a=new AppsAction(ConfirmPanel.A_OK,null,ConfirmPanel.A_OK);
  bOk=new javax.swing.JButton(a);
  a=new AppsAction(ConfirmPanel.A_CANCEL,null,ConfirmPanel.A_CANCEL);
  bCancel=new javax.swing.JButton(a);
  toolsBar=new javax.swing.JToolBar();
  a=new AppsAction(ConfirmPanel.A_PRINT,null,ConfirmPanel.A_PRINT);
  bPrint=new javax.swing.JButton(a);
  a=new AppsAction(ConfirmPanel.A_ZOOM,null,ConfirmPanel.A_ZOOM);
  bZoom=new javax.swing.JToggleButton(a);
  a=new AppsAction(ConfirmPanel.A_EXPORT,null,ConfirmPanel.A_EXPORT);
  bExport=new javax.swing.JButton(a);
  a=new AppsAction(ConfirmPanel.A_DELETE,null,ConfirmPanel.A_DELETE);
  bDelete=new javax.swing.JButton(a);
  a=new AppsAction("Find",null,"Find");
  bFind=new javax.swing.JButton(a);
}
 

Example 36

From project Euclidean-Pattern-Generator, under directory /src/com/hisschemoller/sequencer/view/components/.

Source file: Controls.java

  29 
vote

public Controls(EPGSwingEngine swingEngine){
  _playButton=(JToggleButton)swingEngine.find("PLAY_BUTTON");
  _playButton.addActionListener(this);
  _allNotesOffButton=(JButton)swingEngine.find("ALL_NOTES_OFF_BUTTON");
  _allNotesOffButton.addActionListener(this);
  _tempoSlider=(JSlider)swingEngine.find("TEMPO_SLIDER");
  _tempoSlider.addChangeListener(this);
  _tempoInput=(JFormattedTextField)swingEngine.find("TEMPO_INPUT");
  _tempoInput.setPreferredSize(new Dimension(60,_tempoInput.getPreferredSize().height));
  _tempoInput.addActionListener(this);
  _midiOutBox=(JComboBox)swingEngine.find("MIDI_OUT_BOX");
  _midiOutBox.addActionListener(this);
  _midiCheckBox=(JCheckBox)swingEngine.find("MIDI_CHECKBOX");
  _midiCheckBox.addActionListener(this);
  _oscTextField=(JTextField)swingEngine.find("OSC_TEXTFIELD");
  _oscTextField.addActionListener(this);
  _oscCheckBox=(JCheckBox)swingEngine.find("OSC_CHECKBOX");
  _oscCheckBox.addActionListener(this);
}