private JPanel createDynamicCenterPanel(PrimitiveForm primitiveForm, DOTProperty property) { final JTable theTable = new JTable(); PrimitiveFormPropertyPair pfpPair = new PrimitiveFormPropertyPair(primitiveForm.getName(), property); _dynamicTables.put(pfpPair, theTable); DOTPoint dotPoint = (DOTPoint) _dotDefinitionDialogFrame.getScratchDisplayObjectType(); final DynamicDOTItemManager tableModel = (DynamicDOTItemManager) dotPoint.getTableModel(primitiveForm, property); theTable.setModel(tableModel); class NumberComparator implements Comparator<Number> { public int compare(Number o1, Number o2) { final double d1 = o1.doubleValue(); final double d2 = o2.doubleValue(); if (d1 < d2) { return -1; } if (d1 == d2) { return 0; } return 1; } } TableRowSorter<DynamicDOTItemManager> tableRowSorter = new TableRowSorter<DynamicDOTItemManager>(); tableRowSorter.setModel(tableModel); tableRowSorter.setComparator(4, new NumberComparator()); tableRowSorter.setComparator(5, new NumberComparator()); theTable.setRowSorter(tableRowSorter); JButton newDOTItemButton = new JButton("Neue Zeile"); newDOTItemButton.setEnabled(_dotDefinitionDialogFrame.isEditable()); JButton deleteDOTItemButton = new JButton("Zeile löschen"); deleteDOTItemButton.setEnabled(false); JButton showConflictsButton = new JButton("Zeige Konflikte"); addButtonListeners( primitiveForm, property, newDOTItemButton, deleteDOTItemButton, showConflictsButton); addListSelectionListener(theTable, deleteDOTItemButton); JPanel dotButtonsPanel = new JPanel(); dotButtonsPanel.setLayout(new SpringLayout()); dotButtonsPanel.add(newDOTItemButton); dotButtonsPanel.add(deleteDOTItemButton); dotButtonsPanel.add(showConflictsButton); dotButtonsPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); SpringUtilities.makeCompactGrid(dotButtonsPanel, 1, 5, 20); JPanel thePanel = new JPanel(); thePanel.setLayout(new SpringLayout()); thePanel.setBorder(BorderFactory.createMatteBorder(2, 2, 2, 2, Color.BLACK)); thePanel.add(new JScrollPane(theTable)); thePanel.add(dotButtonsPanel); SpringUtilities.makeCompactGrid(thePanel, 2, 20, 5); return thePanel; }
public void greyButtons(boolean human) { turnSubmit.setEnabled(human); pass.setEnabled(human); checkWord.setEnabled(human); resetHand.setEnabled(human); hint.setEnabled(human); }
private void enableOrDesabled() { if (jTable1.getRowCount() == 0) { btnVender.setEnabled(false); } else { btnVender.setEnabled(true); } }
private void initComponents() { this.addWindowListener( new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent we) { System.exit(0); } }); java.awt.Container contentPane = this.getContentPane(); // Setup the empty module panel modulePanel.setLayout(new CardLayout()); contentPane.add(modulePanel); // Setup the button panel JPanel buttonPanel = new JPanel(); JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(this); buttonPanel.add(cancelButton); backButton.addActionListener(this); backButton.setEnabled(false); buttonPanel.add(backButton); nextButton.addActionListener(this); nextButton.setEnabled(false); buttonPanel.add(nextButton); finishButton.addActionListener(this); finishButton.setEnabled(false); buttonPanel.add(finishButton); contentPane.add(buttonPanel, "South"); }
protected void onStateChange() { switch (getState()) { case DONE: makeBusy(false); loadingPanel.setLoading(false); raView.refresh(); if (progressHandle != null) { progressHandle.finish(); } break; case PENDING: runButton.setEnabled(true); break; case STARTED: runButton.setEnabled(false); loadingPanel.setLoading(true); progressHandle = ProgressHandleFactory.createHandle( "Processing Time Series...", new Cancellable() { @Override public boolean cancel() { runButton.setEnabled(true); return worker.cancel(true); } }); progressHandle.start(); break; } }
/** * Shows given list of reading lists. * * @param lists lists. */ protected void setReadingLists(ReadingList[] lists) { tblReadingLists.setEnabled(lists != null); btnAddReadingList.setEnabled(lists != null); btnRemoveList.setEnabled(lists != null); readingListsModel.setLists(lists); }
/** Builds and lays out the UI. */ private void buildGUI() { setBackground(UIUtilities.BACKGROUND_COLOR); setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); if (selectable) add(checkbox); add(label); JToolBar bar = new JToolBar(); bar.setBackground(UIUtilities.BACKGROUND_COLOR); bar.setFloatable(false); bar.setRollover(true); bar.setBorder(null); bar.setOpaque(true); boolean b = setControlsEnabled(data != null); int count = 0; if (editButton != null) count++; if (unlinkButton != null) count++; if (downloadButton != null) count++; if (infoButton != null) count++; if (openButton != null) count++; if (count > 0 && data != null) { menuButton.setEnabled(true); if (model.isAcrossGroups()) menuButton.setEnabled(false); bar.add(menuButton); if (!b) bar.add(Box.createHorizontalStrut(8)); add(bar); } }
/** Method called by grid component each time a row is selected. */ public void setFirstRow(boolean isFirstRecord) { firstButton.setEnabled(!isFirstRecord); prevPgButton.setEnabled(!isFirstRecord); prevButton.setEnabled(!isFirstRecord); controlPageNr.setEnabled(true); // controlPageNr.setEnabled(resultSetController.getTotalResultSetLength()!=-1); }
// Check if OK should be enabled // Called on: // -- change in text field // -- change in check box selection // -- change in team combo selection // Required: // -- userName // -- at least one check box // -- password, if this is an Add, but not if Edit // Not required: TBD: ??? // -- First and Last Name // -- Team private void checkOkSetEnabled() { char[] pchars = password.getPassword(); char[] cchars = confirmPassword.getPassword(); if (!userName.getText().equals("") && (unitizeCheckBox.isSelected() || uqcCheckBox.isSelected() || codingCheckBox.isSelected() || codingqcCheckBox.isSelected() || listingCheckBox.isSelected() || tallyCheckBox.isSelected() || qaCheckBox.isSelected() || tlCheckBox.isSelected() || adminCheckBox.isSelected()) && (usersId != 0 || pchars.length != 0) && (pchars.length == 0 || cchars.length != 0)) { okButton.setEnabled(true); } else { okButton.setEnabled(false); } if (pchars.length == 0) { confirmPassword.setEditable(false); } else { confirmPassword.setEditable(true); } Arrays.fill(pchars, '#'); Arrays.fill(cchars, '#'); }
/** * This method allows the user to choose a input video file to get images from. It makes sure that * only video files are chosen and that they are valid. The user cannot get images from the video * if the file is not valid. */ private void chooseVideoPressed() { JFileChooser fileChooser = new JFileChooser(); fileChooser.setCurrentDirectory(new java.io.File(".")); fileChooser.setDialogTitle("Choose Video File"); fileChooser.addChoosableFileFilter(SwingFileFilterFactory.newVideoFileFilter()); // Allows files to be chosen only. Make sure they are video files in the extract part // fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); // put filter to ensure that only video files are chosen. fileChooser.setFileFilter(SwingFileFilterFactory.newVideoFileFilter()); fileChooser.setAcceptAllFileFilterUsed(false); int returnValue = fileChooser.showOpenDialog(Images.this); if (returnValue == JFileChooser.APPROVE_OPTION) { selectedFile = fileChooser.getSelectedFile(); showVideo.setText("Video chosen: " + selectedFile.getName()); InvalidCheck i = new InvalidCheck(); boolean isValidMedia = i.invalidCheck(fileChooser.getSelectedFile().getAbsolutePath()); // make sure that file is a valid media file. if (!isValidMedia) { JOptionPane.showMessageDialog( Images.this, "You have specified an invalid file.", "Error", JOptionPane.ERROR_MESSAGE); makeImages.setEnabled(false); return; } else { makeImages.setEnabled(true); } } }
@Override public void actionPerformed(ActionEvent event) { // todo something need to be done here... worker = new eva2.gui.SwingWorker() { @Override public Object construct() { return doWork(); } @Override public void finished() { runButton.setEnabled(true); continueButton.setEnabled(true); stopButton.setEnabled(false); backupPopulation = (Population) optimizationParameters.getOptimizer().getPopulation().clone(); continueFlag = false; } }; // also mal ganz anders ich gehe davon aus, dass der Benutzer das Ding parametrisiert hat // setze einfach die Backup population ein... continueFlag = true; multiRuns = 1; // multiruns machen bei continue einfach keinen Sinn... worker.start(); runButton.setEnabled(false); continueButton.setEnabled(false); stopButton.setEnabled(true); }
private void onLogsNewestDisplayed() throws IllegalStateException { Check.state().edt(); statusLabel.setText("The text area above contains all known logs"); appendButton.setEnabled(false); replaceButton.setEnabled(false); }
public void JudgeWhoIsWinner() // 判断胜负 { String winner = ""; if (white == 0) { JOptionPane.showMessageDialog(null, "黑方胜!" + black + ":" + white); // JOptionPane.showMessageDialog(null, "游戏结束!用时" + time + "秒"); submit.setEnabled(false); winner = "黑"; } if (black == 0) { JOptionPane.showMessageDialog(null, "白方胜!" + white + ":" + black); // JOptionPane.showMessageDialog(null, "游戏结束!用时" + time + "秒"); submit.setEnabled(false); winner = "白"; } if (black + white == 64) { if (white > black) { JOptionPane.showMessageDialog(null, "白方胜!" + white + ":" + black); // JOptionPane.showMessageDialog(null, "游戏结束!用时" + time + "秒"); submit.setEnabled(false); winner = "白"; } else if (black > white) { JOptionPane.showMessageDialog(null, "黑方胜!" + black + ":" + white); // JOptionPane.showMessageDialog(null, "游戏结束!用时" + time + "秒"); submit.setEnabled(false); winner = "白"; } else if (black == white) { JOptionPane.showMessageDialog(null, "和局!"); // JOptionPane.showMessageDialog(null, "游戏结束!用时" + time + "秒"); winner = ""; } } }
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == m_bGameStart) { isGameStart = true; isGameHalt = false; isGameOver = false; m_bGameStart.setEnabled(false); m_bGameHalt.setEnabled(true); setNextReady(true); } else if (e.getSource() == m_bGameHalt) { m_bGameHalt.setEnabled(false); m_bGameStart.setEnabled(true); isGameHalt = true; m_bGameStart.setText("continue"); } else if (e.getSource() == m_bGameOver) { isGameStart = false; isGameOver = true; //// System.out.println("ok \n"); System.exit(0); } // if is voice control else if (e.getSource() == m_bVoiceControl) { if (m_bVoiceControl.getText().equalsIgnoreCase("Voice control")) { m_bVoiceControl.setText("Cancel VC"); // start voice control TetrisControl tc = new TetrisControl(this); tc.start(); } else { m_bVoiceControl.setText("Voice control"); } } }
private void selFolder() { // selects a single folder, then makes table uneditable other than launch, sel res folder and // cancel, gui table different, just shows folder final JFileChooser fc = new JFileChooser(currentPath); fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int result = fc.showOpenDialog(FrontEnd.this); dir = fc.getSelectedFile(); switch (result) { case JFileChooser.APPROVE_OPTION: dirImp = dir.toString(); dtm.getDataVector().removeAllElements(); dtm.fireTableDataChanged(); curRow = 0; addRow(); dtm.setValueAt( "You have chosen the folder '" + dirImp.substring(67) + "' and all of its subfolders.", 0, 0); dtm.setValueAt(dirImp.substring(67), 0, 1); if (table.getRowCount() > 0) { openF.setEnabled(false); openFo.setEnabled(false); selFo.setEnabled(false); canF.setEnabled(true); } selFoFl = 1; case JFileChooser.CANCEL_OPTION: break; } }
@Override public void selectedProfileHighlightAdded(final String highlight) { okButton.setEnabled(model.isSaveAllowed()); highlightsModel.add(highlight); deleteHighlight.setEnabled(model.isSelectedProfileHighlightsValid()); editHighlight.setEnabled(model.isSelectedProfileHighlightsValid()); }
public void updateDataProperty(DataPropertyTreeNode node) { dataPropertyNameLabel.setText(node.getName()); ConvertorType type = new ConvertorType(node.getRanges()); rangeLabel.setText(type.toString()); DataPropertyType dataPropertyType = node.getDataPropertyType(); switch (dataPropertyType) { case LEAF: apply.setText(APPLY_LEAF); apply.setEnabled(columnSelected); apply.setActionCommand(APPLY_LEAF); dataPropertySelected = true; break; case LOW_DETAIL: apply.setText(APPLY_LOW_DETAIL); apply.setEnabled(columnSelected); apply.setActionCommand(APPLY_LOW_DETAIL); dataPropertySelected = true; break; case PROPERTIES: apply.setText(PICK_DATA); apply.setEnabled(columnSelected); dataPropertySelected = false; break; default: System.err.println("Unexpected enum in updateDataProperty"); } }
/** Displays the character window */ public void characterWindow() { if (characterWindow != null) { characterWindow.dispose(); } characterWindow = new JFrame("Character"); characterWindow.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); JTextField health = new JTextField(player.health()); health.setEditable(false); JButton weapon = new JButton(player.weapon().split(" ")[1]); if (player.weapon().split(" ")[1].equals("none")) { weapon.setEnabled(false); } weapon.addActionListener(this); JButton armor = new JButton(player.armor().split(" ")[1]); if (player.armor().split(" ")[1].equals("none")) { armor.setEnabled(false); } armor.addActionListener(this); characterWindow.setBounds( mainWindow.getX() + mainWindow.getWidth(), mainWindow.getY(), 200, 150); characterWindow.setResizable(false); characterWindow.setLayout(new GridLayout(3, 1)); characterWindow.add(health); characterWindow.add(weapon); characterWindow.add(armor); characterWindow.setVisible(true); }
/** Method called by grid component each time a row is selected. */ public void setLastRow(boolean isLastRecord) { lastButton.setEnabled(!isLastRecord); nextButton.setEnabled(!isLastRecord); nextPgButton.setEnabled(!isLastRecord); controlPageNr.setEnabled(true); // controlPageNr.setEnabled(resultSetController.getTotalResultSetLength()!=-1); }
// FUNCTION TO GENERATE A STRING OF 10 ADDRESS REFERENCES public void autoGenerateString() { int random; for (int i = 0; i < 10; i++) { // RANDOMLY SELECT AN INDEX BETWEEN 0 AND 255 random = (int) (Math.random() * 256); // ADD THE ADDRESS AT THIS INDEX IN ARRAY addresses TO THE LIST OF ADDRESS REFERENCE STRINGS // listData[i] = addresses[random]; listData.add(addresses[random]); } // ADD THIS LIST TO THE LISTBOX addRefStrList.setListData(listData); // ENABLE THE Next BUTTON AND DISABLE Back BUTTON // moveStatus = 0; next.setEnabled(true); back.setEnabled(false); // UPDATE THE PROGRESS FIELD tProgress.setText( "We have automatically generated an address string of 10 addresses for you to work with." + "\nClick on \"Next\" to continue."); } // END FUNCTION autoGenerateString
@Override public void actionPerformed(ActionEvent e) { if (window.getObjectsName()[10][window.getSelectedLenguage()] == e.getActionCommand()) { /* ACCEPTED */ System.out.println("accepted"); if (buzon == null) return; acceptButton.setEnabled(false); denyButton.setEnabled(false); inputLabel.setText(defaultMessage); buzon.send("ACCEPTED"); buzon = null; } if (window.getObjectsName()[11][window.getSelectedLenguage()] == e.getActionCommand()) { /* DENIED */ System.out.println("denied"); if (buzon == null) return; buzon.send("DENIED"); acceptButton.setEnabled(false); denyButton.setEnabled(false); inputLabel.setText(defaultMessage); buzon = null; } }
private void resetData() { txtCountryName.setText(""); btnCreate.setEnabled(true); btnDelete.setEnabled(false); btnEdit.setEnabled(false); foreignLanguage = null; }
/** Acción realizada al pulsar el botón "Editar Estilo" */ private void jbEditStyleActionPerformed(ActionEvent evt) { jbEditStyle.setEnabled(false); jlStyle.setEnabled(true); jcbStyle.setEnabled(true); jbSaveStyle.setEnabled(true); updatejcbStyles(); } // fin del método
private void setOkButtonEnabled(DefaultListModel<String> right) { if (!right.isEmpty()) { okButton.setEnabled(true); } else { okButton.setEnabled(false); } }
@Override public void profileRemoved(final MutableProfile profile) { addNickname.setEnabled(model.isProfileListValid()); addHighlight.setEnabled(model.isProfileListValid()); okButton.setEnabled(model.isSaveAllowed()); profilesModel.remove(profile); }
@Override public void selectedProfileNicknameEdited(final String oldNickname, final String newNickname) { okButton.setEnabled(model.isSaveAllowed()); nicknamesModel.set(nicknamesModel.indexOf(oldNickname), newNickname); addNickname.setEnabled(model.isSelectedProfileNicknamesValid()); editNickname.setEnabled(model.isSelectedProfileNicknamesValid()); }
/** {@inheritDoc} */ public void setEnabled(boolean b) { if (b != isEnabled()) { super.setEnabled(b); if ((selectedComponents & DISPLAY_DATE) > 0) { yearDecrButton.setEnabled(b); monthDecrButton.setEnabled(b); monthYearLabel.setEnabled(b); monthIncrButton.setEnabled(b); yearIncrButton.setEnabled(b); for (int day = 0; day < 7; day++) { dayOfWeekLabels[day].setEnabled(b); } for (int row = 0; row < 6; row++) { for (int day = 0; day < 7; day++) { if (dayButtons[row][day].getText().length() > 0) { dayButtons[row][day].setEnabled(b); } } } } if ((selectedComponents & DISPLAY_TIME) > 0) { spinner.setEnabled(b); } } }
@Override public void selectedProfileHighlightEdited(final String oldHighlight, final String newHighlight) { okButton.setEnabled(model.isSaveAllowed()); highlightsModel.set(highlightsModel.indexOf(oldHighlight), newHighlight); deleteHighlight.setEnabled(model.isSelectedProfileHighlightsValid()); editHighlight.setEnabled(model.isSelectedProfileHighlightsValid()); }
private void enableButtonOnSelection(JList list, JButton target) { if (list.isSelectionEmpty()) { target.setEnabled(false); } else { target.setEnabled(true); } }
/** algorithm performed */ public void algorithmPerformed(AlgorithmBase algorithm) { if (alg.isCompleted()) { alg = null; // if OKButton is not null, then the rest are not null // we don't want to do these if this algoritm was done via a script if (OKButton != null) { OKButton.setEnabled(true); dwiPathBrowseButton.setEnabled(true); gradFileRadio.setEnabled(true); bmtxtFileRadio.setEnabled(true); performRegistrationCheckbox.setEnabled(true); registrationSettingsButton.setEnabled(true); dwiLabel.setEnabled(true); dicomB0VolumeLabel.setEnabled(true); // interleavedCheckbox.setEnabled(true); if (gradFileRadio.isSelected()) { gradientFileBrowseButton.setEnabled(true); } else { bmtxtFileBrowseButton.setEnabled(true); } setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); outputTextArea.append("*** End DTI Sorting Process *** \n"); } // insertScriptLine(); Preferences.debug("*** End DTI Sorting Process *** \n", Preferences.DEBUG_ALGORITHM); // System.out.println("*** End DTI Sorting Process *** \n"); } }