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 AE) { if (AE.getSource() == CheckAll) { boolean Selection = CheckAll.isSelected(); if (Selection) CheckAll.setText("Uncheck all"); else CheckAll.setText("Check all"); for (int i = 0; i < NumberOfCourses; i++) My[i].CourseCheckBox.setSelected(Selection); } if (AE.getSource() == DocButton) if (TempControll.ConnectionManagerObject.createConnection()) { new File(System.getProperty("user.home") + "/TermResultCalculator/StudentDocs/").mkdirs(); if (gatherDataForDocument()) { if (TempControll.StudentPdfObject.createPDF( this.Roll, this.Session, this.Selected, this.Taken, this.Completed, this.GPA)) JOptionPane.showMessageDialog( RPS, "Report created successfully at " + System.getProperty("user.home") + "/TermResultCalculator/StudentDocs/", "Success", JOptionPane.INFORMATION_MESSAGE); else JOptionPane.showMessageDialog( RPS, "Error while creating report.", "Error", JOptionPane.ERROR_MESSAGE); } else JOptionPane.showMessageDialog( RPS, "At least one course has to be selected.", "Error : No Selection", JOptionPane.ERROR_MESSAGE); } }
/** Returns false if Exception is thrown. */ private boolean setDirectory() { String pathStr = dirTF.getText().trim(); if (pathStr.equals("")) pathStr = System.getProperty("user.dir"); try { File dirPath = new File(pathStr); if (!dirPath.isDirectory()) { if (!dirPath.exists()) { if (recursiveCheckBox.isSelected()) throw new NotDirectoryException(dirPath.getAbsolutePath()); else throw new NotFileException(dirPath.getAbsolutePath()); } else { convertSet.setFile(dirPath); convertSet.setDestinationPath(dirPath.getParentFile()); } } else { // Set the descriptors setMatchingFileNames(); FlexFilter flexFilter = new FlexFilter(); flexFilter.addDescriptors(descriptors); flexFilter.setFilesOnly(!recursiveCheckBox.isSelected()); convertSet.setSourcePath(dirPath, flexFilter); convertSet.setDestinationPath(dirPath); } } catch (NotDirectoryException e1) { final String caption = ResourceHandler.getMessage("notdirectory_dialog.caption1"); MessageFormat formatter; String info_msg; if (pathStr.equals("")) { info_msg = ResourceHandler.getMessage("notdirectory_dialog.info5"); } else { formatter = new MessageFormat(ResourceHandler.getMessage("notdirectory_dialog.info0")); info_msg = formatter.format(new Object[] {pathStr}); } final String info = info_msg; JOptionPane.showMessageDialog(this, info, caption, JOptionPane.ERROR_MESSAGE); return false; } catch (NotFileException e2) { final String caption = ResourceHandler.getMessage("notdirectory_dialog.caption0"); MessageFormat formatter = new MessageFormat(ResourceHandler.getMessage("notdirectory_dialog.info1")); final String info = formatter.format(new Object[] {pathStr}); JOptionPane.showMessageDialog(this, info, caption, JOptionPane.ERROR_MESSAGE); return false; } return true; // no exception thrown }
private void updateEditorView() { editorPane.setText(""); numParameters = 0; try { java.util.List elements = editableTemplate.getPrintfElements(); for (Iterator it = elements.iterator(); it.hasNext(); ) { PrintfUtil.PrintfElement el = (PrintfUtil.PrintfElement) it.next(); if (el.getFormat().equals(PrintfUtil.PrintfElement.FORMAT_NONE)) { appendText(el.getElement(), PLAIN_ATTR); } else { insertParameter( (ConfigParamDescr) paramKeys.get(el.getElement()), el.getFormat(), editorPane.getDocument().getLength()); } } } catch (Exception ex) { JOptionPane.showMessageDialog( this, "Invalid Format: " + ex.getMessage(), "Invalid Printf Format", JOptionPane.ERROR_MESSAGE); selectedPane = 1; printfTabPane.setSelectedIndex(selectedPane); updatePane(selectedPane); } }
public void setResponse(String res) { int msgType = JOptionPane.PLAIN_MESSAGE; if (res.startsWith("+OK")) msgType = JOptionPane.INFORMATION_MESSAGE; if (res.startsWith("-ERR")) msgType = JOptionPane.ERROR_MESSAGE; JOptionPane.showMessageDialog( QSAdminGUI.this, res.substring(res.indexOf(" ") + 1), "Response", msgType); }
private void button1_addActionPerformed(ActionEvent e) { // TODO add your code here String message = null; User user = null; try { user = new User( textField1_name.getText(), textField2_emeil.getText(), Integer.valueOf(textField3_telefon.getText())); message = "Успешно создан"; textField1_name.setText(""); textField2_emeil.setText(""); textField3_telefon.setText(""); } catch (NumberFormatException ex) { message = "Разберитесь с телефоном"; } finally { JOptionPane.showMessageDialog(this, message); } DefaultComboBoxModel<User> qwe = (DefaultComboBoxModel<User>) list1.getModel(); qwe.addElement(user); // list1.setListData(); // System.out.println(User.getSprUser()); }
public void save() { BufferedWriter sourceFile = null; try { String sourceText = sourceArea.getText(); String cleanText = cleanupSource(sourceText); if (cleanText.length() != sourceText.length()) { sourceArea.setText(cleanText); String message = String.format( "One or more invalid characters at the end of the source file have been removed."); JOptionPane.showMessageDialog(this, message, "ROPE", JOptionPane.INFORMATION_MESSAGE); } sourceFile = new BufferedWriter(new FileWriter(sourcePath, false)); sourceFile.write(cleanText); setSourceChanged(false); setupMenus(); } catch (IOException ex) { ex.printStackTrace(); } finally { if (sourceFile != null) { try { sourceFile.close(); } catch (IOException ignore) { } } } }
public void setPlatform(String platform) { final String linux_intel = "linux-intel"; final String linux_64 = "linux-x86_64"; final String solaris_sparc = "solaris-sparc"; final String solaris_64 = "solaris-amd64"; final String osx_64 = "osx-x86_64"; final String winxp_32 = "winxp-32"; if (platform.equals(linux_intel)) { linuxIntelCheckBox.setSelected(true); linuxIntelCheckBox.setText(linuxIntelCheckBox.getText() + "*"); } else if (platform.equals(linux_64)) { linux64CheckBox.setSelected(true); linux64CheckBox.setText(linux64CheckBox.getText() + "*"); } else if (platform.equals(solaris_sparc)) { solarisSparcCheckBox.setSelected(true); solarisSparcCheckBox.setText(solarisSparcCheckBox.getText() + "*"); } else if (platform.equals(solaris_64)) { solaris64CheckBox.setSelected(true); solaris64CheckBox.setText(solaris64CheckBox.getText() + "*"); } else if (platform.equals(osx_64)) { osxCheckBox.setSelected(true); osxCheckBox.setText(osxCheckBox.getText() + "*"); } else if (platform.equals(winxp_32)) { JOptionPane.showMessageDialog( null, "Platform detected as windows XP. Binaries have not yet been ported, this is an alpha version."); windows32Checkbox.setSelected(true); windows32Checkbox.setText(windows32Checkbox.getText() + "*"); StartPanelDescriptor.getInstance().setIsWindows(); } }
/** * Make the selected line of the table to the given line, if it is displayed. Otherwise a warning * message is displayed. */ private void gotoLine() { if (gotoTextField.getText().equals("")) { return; } int index = Integer.parseInt(gotoTextField.getText()); ConstantPoolTableModel model = (ConstantPoolTableModel) table.getModel(); if (model.isEmpty()) { gotoTextField.setText(""); return; } if (index < 0 || (model.getFullRowCount() - 1) < index) { JOptionPane.showMessageDialog( this, gotoTextField.getText() + " is not in the allowed range [0.." + (model.getFullRowCount() - 1) + "] !", "Warning:", JOptionPane.ERROR_MESSAGE); gotoTextField.setText(""); return; } int indexes[] = model.getIndexes(); boolean found = false; for (int i = 0; i < indexes.length; ++i) { if (found = (indexes[i] == index)) { table.changeSelection(i, 0, false, false); break; } } if (!found) { JOptionPane.showMessageDialog( this, "Index " + gotoTextField.getText() + " is not present in the filtered pool!", "Warning:", JOptionPane.ERROR_MESSAGE); gotoTextField.setText(""); return; } gotoTextField.setText(""); } // gotoLine
public void actionPerformed(ActionEvent e) { String cmd = (e.getActionCommand()); if (cmd.equals(aboutItem.getText())) JOptionPane.showMessageDialog( this, "Simple Image Program for DB2004\nversion 0.1\nThanks to BvS", "About imageLab", JOptionPane.INFORMATION_MESSAGE); else if (cmd.equals(quitItem.getText())) System.exit(0); else if (cmd.equals(openItem.getText())) { int returnVal = chooser.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { try { pic2 = new Picture(chooser.getSelectedFile().getName()); pic1 = new Picture(pic2.width(), pic2.height()); lab.setIcon(pic2.getJLabel().getIcon()); sliderPanel.setVisible(false); pack(); repaint(); } catch (Exception ex) { JOptionPane.showMessageDialog( this, "Could not open " + chooser.getSelectedFile().getName() + "\n" + ex.getMessage(), "Open Error", JOptionPane.INFORMATION_MESSAGE); } } } else if (cmd.equals(saveItem.getText())) { int returnVal = chooser.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { try { pic2.save(chooser.getSelectedFile().getName()); } catch (Exception ex) { JOptionPane.showMessageDialog( this, "Could not write " + chooser.getSelectedFile().getName() + "\n" + ex.getMessage(), "Save Error", JOptionPane.INFORMATION_MESSAGE); } } } }
/** Displayed when the template file is not found in the classpath or the working directory. */ private void showNoTemplateDialog() { final String caption = ResourceHandler.getMessage("notemplate_dialog.caption"); MessageFormat formatter = new MessageFormat(ResourceHandler.getMessage("notemplate_dialog.info")); final String info = formatter.format(new Object[] {PluginConverter.getDefaultTemplateFileName()}); JOptionPane.showMessageDialog(this, info, caption, JOptionPane.ERROR_MESSAGE); System.exit(0); }
private void showAboutDialog() { final String aboutCaption = ResourceHandler.getMessage("about_dialog.caption"); // Version string final String version = System.getProperty("java.version"); MessageFormat formatter = new MessageFormat(ResourceHandler.getMessage("about_dialog.info")); final String aboutInfo = formatter.format(new Object[] {version}); JOptionPane.showMessageDialog(this, aboutInfo, aboutCaption, JOptionPane.INFORMATION_MESSAGE); }
/** Set the template file path. */ private boolean setTemplateFile(String pathStr) { File templateFile = new File(templateCh.getSelectedPath(pathStr)); if (!templateFile.getName().toLowerCase().endsWith(".tpl")) { final String templateCaption = ResourceHandler.getMessage("nottemplatefile_dialog.caption"); MessageFormat formatter = new MessageFormat(ResourceHandler.getMessage("nottemplatefile_dialog.info0")); final String errorMessage = formatter.format(new Object[] {templateFile.getName()}); String defaultTemplateName = PluginConverter.getDefaultTemplateFileName(); JOptionPane.showMessageDialog(this, errorMessage, templateCaption, JOptionPane.ERROR_MESSAGE); templateCh.select(templateCh.getPreviousSelection()); return false; } try { converter.setTemplateFilePath(templateCh.getSelectedPath(pathStr)); } catch (FileNotFoundException e) { // TO-DO: found it, but it's not a file. // TO-DO: Throw up a Dialog -- "Not a valid file, resetting to default file" final String caption = ResourceHandler.getMessage("notdirectory_dialog.caption0"); MessageFormat formatter; String info_msg; if (pathStr.equals("")) { info_msg = ResourceHandler.getMessage("notdirectory_dialog.info5"); } else { formatter = new MessageFormat(ResourceHandler.getMessage("notdirectory_dialog.info1")); info_msg = formatter.format(new Object[] {pathStr}); } final String info = info_msg; JOptionPane.showMessageDialog(this, info, caption, JOptionPane.ERROR_MESSAGE); return false; } return true; }
private void saveDataToFile(File file) { try { PrintStream out = new PrintStream(new FileOutputStream(file)); // Print header line out.print("Time"); for (Sequence seq : seqs) { out.print("," + seq.name); } out.println(); // Print data lines if (seqs.size() > 0 && seqs.get(0).size > 0) { for (int i = 0; i < seqs.get(0).size; i++) { double excelTime = toExcelTime(times.time(i)); out.print(String.format(Locale.ENGLISH, "%.6f", excelTime)); for (Sequence seq : seqs) { out.print("," + getFormattedValue(seq.value(i), false)); } out.println(); } } out.close(); JOptionPane.showMessageDialog( this, Resources.format( Messages.FILE_CHOOSER_SAVED_FILE, file.getAbsolutePath(), file.length())); } catch (IOException ex) { String msg = ex.getLocalizedMessage(); String path = file.getAbsolutePath(); if (msg.startsWith(path)) { msg = msg.substring(path.length()).trim(); } JOptionPane.showMessageDialog( this, Resources.format(Messages.FILE_CHOOSER_SAVE_FAILED_MESSAGE, path, msg), Messages.FILE_CHOOSER_SAVE_FAILED_TITLE, JOptionPane.ERROR_MESSAGE); } }
public void actionPerformed(ActionEvent clickEvent) { RecorderDialog recorderInfo = new RecorderDialog(parent); recorderInfo.show(); JOptionPane.showMessageDialog(null, "Clock Reset\nrecordingRTP session..."); stopRTPrecording.setEnabled(true); startRTPrecording.setEnabled(false); }
public void displayPage(JEditorPane pane, String text) { try { File helpFile = new File((String) locations.get(text)); String loc = "file:" + helpFile.getAbsolutePath(); URL page = new URL(loc); pane.setPage(page); } catch (IOException ioe) { JOptionPane.showMessageDialog(null, "Help Topic Unavailable"); pane.getParent().repaint(); } }
private void submitActionPerformed(java.awt.event.ActionEvent evt) { int numIncorrect = 0; for (int i = 0; i < problemDisplays.length; i++) { boolean correct = round.getProblem(i).checkAnswer(); if (correct) { problemDisplays[i].disableAnswer(); problemDisplays[i].setBorder(null); } else { problemDisplays[i].clearAnswer(); round.getProblem(i).answer(""); problemDisplays[i].setBorder(new LineBorder(java.awt.Color.RED)); numIncorrect++; } } if (numIncorrect == 0) { JOptionPane.showMessageDialog(null, "All the answers are correct!"); round.reset(); resetProblems(); } else { JOptionPane.showMessageDialog(null, (numIncorrect + " answers were incorrect.")); } }
private void about() { JOptionPane.showMessageDialog( this, "QSAdminGUI\n\n" + "GUI Client for QSAdminServer of QuickServer.\n" + "This is compliant with QuickServer v" + QSAdminMain.VERSION_OF_SERVER + " release.\n\n" + "Copyright (C) QuickServer.org\n" + "http://www.quickserver.org", "About QSAdminGUI", JOptionPane.INFORMATION_MESSAGE, logoAbout); }
private void assembleAction() { String line; messages = new Vector(); mainFrame.resetExecWindow(); save(); assembleFailed = false; haveAssemblyErrors = false; if (Assembler.version()) { while ((line = Assembler.output()) != null) { messages.addElement(line); } Assembler.setPaths(baseName, sourcePath); if (Assembler.assemble()) { while ((line = Assembler.output()) != null) { System.out.println(line); messages.addElement(line); if (line.startsWith(" [ERROR:")) { haveAssemblyErrors = true; } } messageList.setListData(messages); messageList.ensureIndexIsVisible(0); mainFrame.showExecWindow(baseName); } else { assembleFailed = true; } } else { assembleFailed = true; } if (assembleFailed) { String message = String.format( "Autocoder failed!\nVerify the correctness of autocoder path\n%s", AssemblerOptions.assemblerPath); System.out.println(message); JOptionPane.showMessageDialog(this, message, "ROPE", JOptionPane.ERROR_MESSAGE); } }
public PrintfEditor(Frame frame, String title) { super(frame, title, false); originalTemplate = new PrintfTemplate(); editableTemplate = new PrintfTemplate(); try { jbInit(); pack(); initMatches(); } catch (Exception exc) { String logMessage = "Could not set up the printf editor"; logger.critical(logMessage, exc); JOptionPane.showMessageDialog(frame, logMessage, "Printf Editor", JOptionPane.ERROR_MESSAGE); } }
public void CheckAtTheEnd() // 当无子可落时判断胜负 { ShowChessNumber(); gameStart = false; for (int i = 0; i < 8; i++) for (int j = 0; j < 8; j++) cell[i][j].taken = true; String winner = ""; if (white > black) { controlThread = false; JOptionPane.showMessageDialog(null, "白方胜!" + white + ":" + black); winner = "白"; } else if (white < black) { controlThread = false; JOptionPane.showMessageDialog(null, "黑方胜!" + black + ":" + white); winner = "黑"; } else if (white == black) { controlThread = false; JOptionPane.showMessageDialog(null, "和局!"); winner = ""; } // JOptionPane.showMessageDialog(null, "游戏结束!用时" + time + "秒"); }
/** * Read word list from file with name WORDLISTFILENAME, and pass a Set containing those words to * the computer player to intialize its lexicon. */ private void initLexicon(InputStream stream) { ProgressMonitorInputStream pmis; ProgressMonitor progress = null; pmis = new ProgressMonitorInputStream(this, "reading words", stream); progress = pmis.getProgressMonitor(); progress.setMillisToDecideToPopup(10); Scanner s = new Scanner(pmis); myLexicon.load(s); try { pmis.close(); } catch (IOException e) { JOptionPane.showMessageDialog( null, "Error Closing Stream", "Error", JOptionPane.ERROR_MESSAGE); } }
private void button3_updateActionPerformed(ActionEvent e) { String message = null; User temp = (User) list1.getSelectedValue(); try { temp.name = textField1_name.getText(); temp.emeil = textField2_emeil.getText(); temp.telefon = Integer.valueOf(textField3_telefon.getText()); message = "Успешно преобразован"; textField1_name.setText(""); textField2_emeil.setText(""); textField3_telefon.setText(""); } catch (NumberFormatException ex) { message = "Разберитесь с телефоном"; } finally { JOptionPane.showMessageDialog(this, message); } }
public void actionPerformed(ActionEvent e) { if (listener == null) { return; } String methodName = (String) actions.get(e.getSource()); if (methodName != null) { try { Class[] params = null; Method m = listener.getClass().getMethod(methodName, params); Object[] params2 = null; m.invoke(listener, params2); } catch (NoSuchMethodException me) { JOptionPane.showMessageDialog(this, "No Action Handler for '" + methodName + "'"); } catch (Exception ex) { ex.printStackTrace(); } } }
private void browseAction() { if (selectedPath == null) { selectedPath = System.getenv("ROPE_SOURCES_DIR"); if (selectedPath != null) { File dir = new File(selectedPath); if (!dir.exists() || !dir.isDirectory()) { String message = String.format( "The sources path set in environment variable ROPE_SOURCES_DIR is not avaliable.\n%s", selectedPath); JOptionPane.showMessageDialog(null, message, "ROPE", JOptionPane.WARNING_MESSAGE); selectedPath = null; } else { System.out.println("Source folder path set from ROPE_SOURCES_DIR: " + selectedPath); } } if (selectedPath == null) { selectedPath = System.getProperty("user.dir"); System.out.println("Source folder path set to current directory: " + selectedPath); } } Vector<RopeFileFilter> filters = new Vector<RopeFileFilter>(); filters.add( new RopeFileFilter( new String[] {".a", ".asm", ".aut", ".s"}, "Assembly files (*.a *.asm *.aut *.s)")); filters.add(new RopeFileFilter(new String[] {".m", ".mac"}, "Macro files (*.m *.mac)")); filters.add(new RopeFileFilter(new String[] {".lst"}, "List files (*.lst)")); filters.add(new RopeFileFilter(new String[] {".txt"}, "Text files (*.txt)")); RopeFileChooser chooser = new RopeFileChooser(selectedPath, null, filters); chooser.setDialogTitle("Source document selection"); chooser.setFileFilter(filters.firstElement()); chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); File file = chooser.open(this, fileText); if (file != null) { if (loadSourceFile(file)) { mainFrame.showExecWindow(baseName); } } }
/** Finds the previous occurance of the given string in the 3rd column of the table. */ private void findPrev() { String infix = findTextField.getText(); if (infix.equals("")) { return; } if (!matchCase) { infix = infix.toLowerCase(); } String desc[] = ((ConstantPoolTableModel) table.getModel()).getDescriptions(); if (null == desc) { return; } if (table.getSelectedRowCount() != 0) { actIndex = table.getSelectedRow(); } int rows = ((ConstantPoolTableModel) table.getModel()).getRowCount(); boolean found = false, end = false; int start = actIndex; while (!end && !found) { if (0 < actIndex) { actIndex--; } else { actIndex = (rows - 1); } found = desc[actIndex].toLowerCase().contains(infix); end = (start == actIndex) && !found; } if (found) { table.changeSelection(actIndex, 0, false, false); } else if (end) { Toolkit.getDefaultToolkit().beep(); JOptionPane.showMessageDialog( this, "String " + infix + " was not found.", "Alert:", JOptionPane.ERROR_MESSAGE); } } // findPrev
public void mouseClicked(MouseEvent e) { /*can = false; boolean f = true; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) if (cell[i][j] == e.getSource()) { int judege = Clicked(cell[i][j]); f = false; break; } if (!f) break; }*/ boolean flage = CheckAll(); if (flage) { can = false; if (kind.equals("" + turn)) { ChessBoard cel = (ChessBoard) (e.getSource()); int judge = Clicked(cel); if (judge == 1) { try { System.out.println("发送前:" + cell[3][5].taken); out66.writeObject("落子" + turn); out66.flush(); out66.writeObject(stateList.get(stateList.size() - 1)); out66.flush(); out66.writeObject(takenList.get(takenList.size() - 1)); out66.flush(); } catch (IOException e1) { e1.printStackTrace(); } } } else { JOptionPane.showMessageDialog(null, "请确定您的身份,您此时不能落子"); } } else CheckAtTheEnd(); }
public void RegretChess() { for (int i = 0; i < 8; i++) for (int j = 0; j < 8; j++) if (cell[i][j].changed == true) { cell[i][j].ChangeBack(); } turn = TakeTurn(); try { stateList.remove(stateList.size() - 1); takenList.remove(takenList.size() - 1); char[][] states = stateList.get(stateList.size() - 1); boolean[][] takens = takenList.get(takenList.size() - 1); for (int i = 0; i < 8; i++) for (int j = 0; j < 8; j++) { cell[i][j].state = states[i][j]; cell[i][j].taken = takens[i][j]; cell[i][j].repaint(); } for (int i = 0; i < 8; i++) for (int j = 0; j < 8; j++) if (cell[i][j].taken == false) { CheckPlace(cell[i][j]); if (canPut) { cell[i][j].ChangeBackground(); canPut = false; } } } catch (ArrayIndexOutOfBoundsException e1) { JOptionPane.showMessageDialog(null, "无法悔棋"); } if (stateList.size() == 0) { RememberState(); } }
/** Load data from server and construct panel content. */ public final void reloadData(DocumentsFrame frame) { try { // remove all panel content... clearData(); frame.getGrid().getOtherGridParams().put(ApplicationConsts.PROPERTIES_FILTER, filters); // retrieve customized input controls list... GridParams gridParams = new GridParams(); DefaultMutableTreeNode node = frame.getHierarTreePanel().getSelectedNode(); if (node != null) { HierarchyLevelVO vo = (HierarchyLevelVO) node.getUserObject(); HierarchyLevelVO root = (HierarchyLevelVO) ((DefaultMutableTreeNode) node.getRoot()).getUserObject(); gridParams .getOtherGridParams() .put(ApplicationConsts.PROGRESSIVE_HIE01, vo.getProgressiveHIE01()); gridParams .getOtherGridParams() .put(ApplicationConsts.ROOT_PROGRESSIVE_HIE01, root.getProgressiveHIE01()); } else gridParams.getOtherGridParams().remove(ApplicationConsts.PROGRESSIVE_HIE01); gridParams .getOtherGridParams() .put( ApplicationConsts.PROGRESSIVE_HIE02, frame.getHierarTreePanel().getProgressiveHIE02()); gridParams.getOtherGridParams().put(ApplicationConsts.LOAD_ANCIENTS, Boolean.TRUE); Response res = ClientUtils.getData("loadLevelProperties", gridParams); if (res.isError()) { JOptionPane.showMessageDialog( ClientUtils.getParentFrame(this), ClientSettings.getInstance().getResources().getResource("Error while loading data") + ":\n" + res.getErrorMessage(), ClientSettings.getInstance().getResources().getResource("Loading Data Error"), JOptionPane.ERROR_MESSAGE); return; } ArrayList rows = ((VOListResponse) res).getRows(); if (rows.size() > 0) { // adding customized input controls... LevelPropertyVO inputControlInfo = null; int row = 0; int col = 0; LabelControl labelControl = null; TextControl textControl = null; DateControl dateControl = null; NumericControl numericControl = null; for (int i = 0; i < rows.size(); i++) { inputControlInfo = (LevelPropertyVO) rows.get(i); labelControl = new LabelControl(); labelControl.setText(inputControlInfo.getDescriptionSYS10()); innerPanel.add( labelControl, new GridBagConstraints( col++, row, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); if (inputControlInfo.getPropertyTypeDOC21().equals(ApplicationConsts.TYPE_TEXT)) { textControl = new TextControl(); textControl.setMaxCharacters(255); textControl.setLinkLabel(labelControl); innerPanel.add( textControl, new GridBagConstraints( col, row, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 15), 0, 0)); textControl.addFocusListener(new ControlFocusListener(inputControlInfo, textControl)); } else if (inputControlInfo.getPropertyTypeDOC21().equals(ApplicationConsts.TYPE_DATE)) { dateControl = new DateControl(); dateControl.setLinkLabel(labelControl); innerPanel.add( dateControl, new GridBagConstraints( col, row, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 15), 0, 0)); dateControl.addFocusListener(new ControlFocusListener(inputControlInfo, dateControl)); } else if (inputControlInfo.getPropertyTypeDOC21().equals(ApplicationConsts.TYPE_NUM)) { numericControl = new NumericControl(); numericControl.setDecimals(5); numericControl.setLinkLabel(labelControl); innerPanel.add( numericControl, new GridBagConstraints( col, row, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 15), 0, 0)); numericControl.addFocusListener( new ControlFocusListener(inputControlInfo, numericControl)); } col++; if (col >= 2) { innerPanel.add( new JPanel(), new GridBagConstraints( col, row, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); row++; col = 0; } } row++; innerPanel.add( new JPanel(), new GridBagConstraints( col, row, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); innerPanel.add( new JPanel(), new GridBagConstraints( 0, row, 1, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(5, 5, 5, 5), 0, 0)); this.revalidate(); this.repaint(); } } catch (Exception ex) { ex.printStackTrace(); } }
public void showAboutBox() { JOptionPane.showMessageDialog(this, ABOUTMSG); }