// called when the load script button is pressed. private void scriptPressed() { int returnVal = fileChooser.showDialog(this, "Load Script"); if (returnVal == JFileChooser.APPROVE_OPTION) { notifyControllerListeners( ControllerEvent.SCRIPT_CHANGE, fileChooser.getSelectedFile().getAbsoluteFile()); scriptComponent.setContents(fileChooser.getSelectedFile().getAbsolutePath()); } }
@Override public void actionPerformed(ActionEvent e) { Frame frame = getFrame(); JFileChooser chooser = new JFileChooser(); int ret = chooser.showOpenDialog(frame); if (ret != JFileChooser.APPROVE_OPTION) { return; } File f = chooser.getSelectedFile(); if (f.isFile() && f.canRead()) { Document oldDoc = getEditor().getDocument(); if (oldDoc != null) { oldDoc.removeUndoableEditListener(undoHandler); } if (elementTreePanel != null) { elementTreePanel.setEditor(null); } getEditor().setDocument(new PlainDocument()); frame.setTitle(f.getName()); Thread loader = new FileLoader(f, editor.getDocument()); loader.start(); } else { JOptionPane.showMessageDialog( getFrame(), "Could not open file: " + f, "Error opening file", JOptionPane.ERROR_MESSAGE); } }
private boolean checkForSave() { // build warning message String message; if (file == null) { message = "File has been modified. Save changes?"; } else { message = "File \"" + file.getName() + "\" has been modified. Save changes?"; } // show confirm dialog int r = JOptionPane.showConfirmDialog( this, new JLabel(message), "Warning!", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); if (r == JOptionPane.YES_OPTION) { // Save File if (fileChooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) { // write the file physWriteTextFile(fileChooser.getSelectedFile(), textView.getText()); } else { // user cancelled save after all return false; } } return r != JOptionPane.CANCEL_OPTION; }
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); } } } }
public Path dateiAuswählen(Path neuesLaufwerk) { JFileChooser fc1 = new JFileChooser(); fc1.setDialogTitle("SyncOrdner auswählen"); fc1.setCurrentDirectory(neuesLaufwerk.toFile()); fc1.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); if (fc1.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) return fc1.getSelectedFile().toPath(); else return null; }
public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle("Load"); int choice = 0; do { int result = chooser.showOpenDialog(null); if (result == JFileChooser.APPROVE_OPTION) { file = chooser.getSelectedFile(); try { if (file != null) { fileName = file.getCanonicalPath(); reader = new BufferedReader(new FileReader(fileName)); String line; while ((line = reader.readLine()) != null) { myPatternList.add(line); } // for(int i=0;i<myPatternList.size();i++) { // responseArea.append(myPatternList.get(i)+"\n"); // } } choice = 2; reader.close(); } catch (IOException c) { c.printStackTrace(); Object[] options = new String[] {"Load New File", "Exit"}; choice = JOptionPane.showOptionDialog( null, "Invalid FileChoosen." + "Would you like to load a new file " + "or exit?", "Options", JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, options, options[0]); if (choice == 1) System.exit(0); } } else if (result == JFileChooser.CANCEL_OPTION) { Object[] options = new String[] {"Load Different File", "Exit"}; choice = JOptionPane.showOptionDialog( null, "Would you like to load a new file " + " or exit?", "Options", JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, options, options[0]); if (choice == 1) System.exit(0); } } while (choice == 0); }
public void actionPerformed(ActionEvent e) { Frame frame = getFrame(); JFileChooser chooser = new JFileChooser(); int ret = chooser.showSaveDialog(frame); if (ret != JFileChooser.APPROVE_OPTION) { return; } File f = chooser.getSelectedFile(); frame.setTitle(f.getName()); Thread saver = new FileSaver(f, editor.getDocument()); saver.start(); }
public void actionPerformed(ActionEvent e) { if (e.getSource() == save) { JFileChooser c = new JFileChooser(ResourceFactory.getRootDir()); c.setDialogTitle("Save result"); if (c.showSaveDialog(resultFrame) == JFileChooser.APPROVE_OPTION) { File output = c.getSelectedFile(); if (output.exists()) { String[] options = {"Overwrite", "Cancel"}; if (JOptionPane.showOptionDialog( resultFrame, output + "exists. Overwrite?", "Save result", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]) == 1) return; } try { PrintWriter w = new PrintWriter(new BufferedWriter(new FileWriter(output))); w.println("Searched for unused strings"); w.println("Number of hits: " + table.getRowCount()); w.println(""); for (int i = 0; i < table.getRowCount(); i++) { w.println( "StringRef: " + table.getTableItemAt(i).getObjectAt(1) + " /* " + table .getTableItemAt(i) .toString() .replaceAll("\r\n", System.getProperty("line.separator")) + " */"); } w.close(); JOptionPane.showMessageDialog( resultFrame, "Result saved to " + output, "Save complete", JOptionPane.INFORMATION_MESSAGE); } catch (IOException ex) { JOptionPane.showMessageDialog( resultFrame, "Error while saving " + output, "Error", JOptionPane.ERROR_MESSAGE); ex.printStackTrace(); } } } }
public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle("SaveAs"); int choice = 0; do { int result = chooser.showOpenDialog(null); if (result == JFileChooser.APPROVE_OPTION) { file = chooser.getSelectedFile(); try { if (file != null) { fileName = file.getCanonicalPath(); printWriter = new PrintWriter(new FileOutputStream(fileName), true); } printWriter.append(responseArea.getText()); choice = 2; } catch (IOException c) { c.printStackTrace(); Object[] options = new String[] {"Choose New File", "Exit"}; choice = JOptionPane.showOptionDialog( null, "Invalid FileChoosen." + "Would you like to choose a new file " + "or exit?", "Options", JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, options, options[0]); if (choice == 1) System.exit(0); } } else if (result == JFileChooser.CANCEL_OPTION) { Object[] options = new String[] {"Choose Different File", "Exit"}; choice = JOptionPane.showOptionDialog( null, "Would you like to choose a new file " + " or exit?", "Options", JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, options, options[0]); if (choice == 1) System.exit(0); } } while (choice == 0); printWriter.flush(); printWriter.close(); }
public void saveFileAs() { // Force user to enter new file name if (fileChooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) { file = fileChooser.getSelectedFile(); } else { // user cancelled save after all return; } // file selected, so write it. physWriteTextFile(file, textView.getText()); // update status statusView.setText(" Saved file \"" + file.getName() + "\"."); // reset dirty bit dirty = false; }
// Get the name of the file private File getFileName(int option) { JFileChooser fc = new JFileChooser(new File("..")); if (oldFile != null) fc.setSelectedFile(oldFile); int returnVal = 0; if (option == UintahGui.OPEN) { returnVal = fc.showOpenDialog(UintahGui.this); } else { returnVal = fc.showSaveDialog(UintahGui.this); } if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); oldFile = file; return file; } else return null; }
public void openFile() { if (!dirty || checkForSave()) { if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { file = fileChooser.getSelectedFile(); } else { // user cancelled open after all return; } // load file into text view textView.setText(physReadTextFile(file)); // update status statusView.setText(" Loaded file \"" + file.getName() + "\"."); // reset dirty bit dirty = false; } }
// ask user for script file and name of new profile // return false if user cancelled operation private boolean getNewWkldInput( JFileChooser chooser, Object[] optionDlgMsg, StringBuffer name, StringBuffer scriptFile) { // let user select script file with queries boolean fileOk = false; int retval; File file = null; FileReader reader = null; while (!fileOk) { if ((retval = chooser.showDialog(this, "Ok")) != 0) { return false; } file = chooser.getSelectedFile(); try { reader = new FileReader(file.getPath()); fileOk = true; scriptFile.append(file.getPath()); } catch (FileNotFoundException e) { JOptionPane.showMessageDialog( this, "Selected script file does not exist", "Error: New Profile", JOptionPane.ERROR_MESSAGE); } } // let user select filename for profile int response = JOptionPane.showOptionDialog( this, optionDlgMsg, "New Profile", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, null, null); if (response != JOptionPane.OK_OPTION) { return false; } JTextField textFld = (JTextField) optionDlgMsg[1]; name.append(file.getParent() + "/" + textFld.getText()); return true; }
/** * Show the selector for selecting the default folder. * * @return true if the user selected a default folder and false if not. */ protected boolean showDefaultFolderSelector() throws Exception { final JFileChooser selector = new JFileChooser(_activeFileChooser.getCurrentDirectory()); selector.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); final String title = (_subfolderName == null) ? "Default Folder" : "Default Parent Folder of " + _subfolderName; selector.setDialogTitle(title); final int status = selector.showDialog(_view, "Make Default"); switch (status) { case JFileChooser.APPROVE_OPTION: final File defaultFolder = selector.getSelectedFile(); if (defaultFolder != null) { _folderTracker.cacheURL(defaultFolder.toURI().toURL()); return true; } else { return false; } default: return false; } }
private ObjectOutputStream getObjectOutputStream() { File f = new File("."); String loadDirectory = f.getAbsolutePath(); JFileChooser chooser = new JFileChooser(loadDirectory); chooser.setDialogTitle("Save Generation File As..."); chooser.setMultiSelectionEnabled(false); int result = chooser.showSaveDialog(this); File selectedFile = chooser.getSelectedFile(); if (result == JFileChooser.APPROVE_OPTION) { try { FileOutputStream fileStream = new FileOutputStream(selectedFile.getPath()); ObjectOutputStream objectStream = new ObjectOutputStream(fileStream); return objectStream; } catch (IOException e) { System.err.println(e); } } return null; }
public void actionPerformed(ActionEvent event) { if (posicion == -2) posicion = indexaux; // Abrir nueva imagen if (event.getSource() == carpeta) { siguiente.setEnabled(true); atras.setEnabled(true); presentacion.setEnabled(true); grid.setEnabled(true); bcomentario.setEnabled(true); zoom.setEnabled(true); imagenesbean.clear(); if (imagenes != null) { imagenes.clear(); } returnChooser = chooser.showOpenDialog(ArcViewer.this); imagenes = lista.Miranda(chooser, returnChooser); for (int asd1 = 0; asd1 < imagenes.size(); asd1++) { imagenesbean.add(new ImagenBean(imagenes.get(asd1), 0, 0)); } String getImgSelected = chooser.getSelectedFile().getPath(); for (int index = 0; index < imagenesbean.size(); index++) { if (getImgSelected.equals(imagenesbean.get(index).getIcon())) { imagen.setIcon(new ImageIcon(imagenesbean.get(index).getIcon())); indexaux = index; } } } // Imagen siguiente if (event.getSource() == siguiente) { posicion++; if (posicion >= imagenesbean.size()) { posicion = 0; } imagen.setIcon( ajustar.ajusteImg( new ImageIcon(imagenesbean.get(posicion).getIcon()), imagenesbean.get(posicion).getAncho(), imagenesbean.get(posicion).getAlto(), areaventana.getWidth() - 50, areaventana.getHeight())); } // Imagen anterior if (event.getSource() == atras) { posicion--; if (posicion == -1) { posicion = imagenesbean.size() - 1; } imagen.setIcon( ajustar.ajusteImg( new ImageIcon(imagenesbean.get(posicion).getIcon()), imagenesbean.get(posicion).getAncho(), imagenesbean.get(posicion).getAlto(), areaventana.getWidth() - 50, areaventana.getHeight())); } // Presentacion iniciar/detener if (event.getSource() == presentacion) { if (isPresentacion == false) { grid.setVisible(false); atras.setVisible(false); siguiente.setVisible(false); carpeta.setVisible(false); bcomentario.setVisible(false); zoom.setVisible(false); ptiempo.setVisible(true); } if (isPresentacion == true) { grid.setVisible(true); atras.setVisible(true); siguiente.setVisible(true); carpeta.setVisible(true); bcomentario.setVisible(true); zoom.setVisible(true); ptiempo.setVisible(false); } if (presentacion.getIcon() == imgPausa) { slide.detener(); posicion = slide.getPosicion(); presentacion.setIcon(imgPlay); isPresentacion = false; return; } if (presentacion.getIcon() == imgPlay) { slide.setTodo(posicion, imagen, imagenesbean, areaventana, ptiempo); new Thread(slide, "prueba").start(); presentacion.setIcon(imgPausa); isPresentacion = true; return; } } // Modo rejilla if (event.getSource() == grid) { imagen.setVisible(false); siguiente.setVisible(false); atras.setVisible(false); presentacion.setVisible(false); grid.setVisible(false); bcomentario.setVisible(false); zoom.setVisible(false); carpeta.setVisible(false); ptiempo.setVisible(false); // desplazamiento.setVisible(true); if (corrobora == true) { for (int celular = 0; celular < imgButtonArray.length; celular++) { imgButtonArray[celular].setVisible(true); } } if (corrobora == false) { imgButtonArray = new JButton[imagenesbean.size()]; for (int goku = 0; goku < imagenesbean.size(); goku++) { areaventana.add(imgButtonArray[goku] = new JButton()); imgButtonArray[goku].setPreferredSize(new Dimension(200, 200)); imgButtonArray[goku].addActionListener(this); imgButtonArray[goku].setBackground(colorGris); imgButtonArray[goku].setIcon( ajustar.ajusteCuadrado(new ImageIcon(imagenesbean.get(goku).getIcon()))); corrobora = true; } } } // Comentario if (event.getSource() == bcomentario) { new Comentario(imagenesbean.get(posicion), posicion); } // Cuando se apreta un boton de la rejilla if (corrobora == true) { for (int alice = 0; alice < imgButtonArray.length; alice++) { if (event.getSource() == imgButtonArray[alice]) { for (int wonderland = 0; wonderland < imgButtonArray.length; wonderland++) { imgButtonArray[wonderland].setVisible(false); } posicion = alice; imagen.setIcon( ajustar.ajusteImg( new ImageIcon(imagenesbean.get(posicion).getIcon()), imagenesbean.get(posicion).getAncho(), imagenesbean.get(posicion).getAlto(), areaventana.getWidth() - 50, areaventana.getHeight())); imagen.setVisible(true); siguiente.setVisible(true); atras.setVisible(true); presentacion.setVisible(true); grid.setVisible(true); bcomentario.setVisible(true); zoom.setVisible(true); carpeta.setVisible(true); } } } if (event.getSource() == zoom) { System.out.println("Haciendo un ZOOOOOOOOOOOOM"); } }
/** Called for button presses and checkbox toggles. */ public void actionPerformed(ActionEvent e) { Object src = e.getSource(); // the source of the event is the add files button // so we need to let the user add some files! if (src == addFiles) { // create an appropriate file chooser JFileChooser myTempFileChooser = new JFileChooser((new File("")).getAbsolutePath()); myTempFileChooser.setMultiSelectionEnabled(true); myTempFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); myTempFileChooser.setDialogType(JFileChooser.OPEN_DIALOG); myTempFileChooser.setFileHidingEnabled(true); // open the file chooser and get the user's selctions int returnCode = myTempFileChooser.showOpenDialog(this); // use the return info to add files if the // user selected any in the file chooser if (returnCode == JFileChooser.APPROVE_OPTION) { // grab the files the user selected File[] selectedFiles = myTempFileChooser.getSelectedFiles(); // pull the files into the list changeFilesInList.importFileData(list, selectedFiles); } } // the source of the event was the process button else if (src == process) { if (((DefaultListModel) list.getModel()).size() == 0) return; setComponentsEnabled(false); final ThumbMaker tm = this; Thread t = new Thread( new Runnable() { public void run() { tm.process(); setComponentsEnabled(true); } }); t.start(); // because we can't do it on quit, we are going to save // all the preference values when the user processes a set // of images savePreferences(); } // the source of the event was the remove button else if (src == remove) { DefaultListModel model = (DefaultListModel) list.getModel(); while (true) { int ndx = list.getSelectedIndex(); if (ndx < 0) break; model.removeElementAt(ndx); } } // the source of the event was the preserve aspect check box else if (src == aspect) { boolean b = aspect.isSelected(); colorLabel.setEnabled(b); colorBox.setEnabled(b); redLabel.setEnabled(b); red.setEnabled(b); redValue.setEnabled(b); greenLabel.setEnabled(b); green.setEnabled(b); greenValue.setEnabled(b); blueLabel.setEnabled(b); blue.setEnabled(b); blueValue.setEnabled(b); } // the source of the event is the "..." button, // we need to let the user select a destination file else if (src == dotDotDot) { // create an appropriate file chooser JFileChooser myTempFileChooser = new JFileChooser(new File(output.getText()).getAbsolutePath()); myTempFileChooser.setMultiSelectionEnabled(false); myTempFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); myTempFileChooser.setDialogType(JFileChooser.OPEN_DIALOG); myTempFileChooser.setFileHidingEnabled(true); // open the file chooser and get the user's selctions int returnCode = myTempFileChooser.showOpenDialog(this); // use the return info to set the directory if the // user selected one in the file chooser if (returnCode == JFileChooser.APPROVE_OPTION) { // grab the file the user selected File selectedFile = myTempFileChooser.getSelectedFile(); // stuff the file path into the text field output.setText(selectedFile.getAbsolutePath()); } } }
public void actionPerformed(ActionEvent e) { if (e.getSource() == b) { JFrame frame2 = new JFrame(); JFileChooser chooser = new JFileChooser("."); int option = chooser.showOpenDialog( frame2); // parentComponent must a component like JFrame, JDialog... if (option == JFileChooser.APPROVE_OPTION) { File selectedFile = chooser.getSelectedFile(); path = selectedFile.getAbsolutePath(); } try { loadImage(); } catch (IOException ioe) { System.out.println(ioe.getMessage()); } } else if (e.getSource() == c) { gaussianBlur(); // filtered = grayscale.filter(filtered, null); sobel(); // thinImage(); nonMax(); float lowThreshold = 2.5f; float highThreshold = 7.5f; int low = Math.round(lowThreshold * MAGNITUDE_SCALE); int high = Math.round(highThreshold * MAGNITUDE_SCALE); performHysteresis(low, high); thresholdEdges(); writeEdges(data); Hough(); ImageIcon icon1 = new ImageIcon(res); lbl1.setIcon(icon1); ImageIcon icon2 = new ImageIcon(filtered); lbl2.setIcon(icon2); filterBtn.setSelected(true); } if (e.getSource() == findCircles) { try { accSize = Integer.parseInt(inputCircles.getText()); res = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); Graphics g = res.getGraphics(); g.drawImage(img, 0, 0, null); g.dispose(); findMaxima(); ImageIcon icon1 = new ImageIcon(res); lbl1.setIcon(icon1); } catch (Exception err) { System.out.println("Not a valid integer"); } } else if (e.getSource() == filterBtn) { ImageIcon icon2 = new ImageIcon(filtered); lbl2.setIcon(icon2); } else if (e.getSource() == sobelBtn) { ImageIcon icon2 = new ImageIcon(sobel); lbl2.setIcon(icon2); } else if (e.getSource() == nonMaxBtn) { ImageIcon icon2 = new ImageIcon(nonMax); lbl2.setIcon(icon2); } else if (e.getSource() == accumulator) { buildAccumulator(whichRadius.getValue()); } }
public void init() { areaventana = new JPanel(); areabotones = new JPanel(); imagen = new JLabel(""); presentacion = new JButton(imgPlay); siguiente = new JButton(imgSiguiente); atras = new JButton(imgAnterior); ptiempo = new JSlider(); carpeta = new JButton(imgNuevaCarpeta); grid = new JButton(imgGrid); bcomentario = new JButton(imgComentario); zoom = new JButton(imgZoom); /* Agregando los componentes */ areaventana.add(imagen); // areaventana.add(desplazamiento); areabotones.add(grid); areabotones.add(atras); areabotones.add(presentacion); areabotones.add(siguiente); areabotones.add(ptiempo); areabotones.add(carpeta); areabotones.add(bcomentario); areabotones.add(zoom); areabotones.setBackground(colorGris); areaventana.setBackground(colorGris); // desplazamiento.setVisible(false); // areaventana.add(desplazamiento); /* GUI GUI GUI GUI */ presentacion.setBackground(colorGris); atras.setBackground(colorGris); siguiente.setBackground(colorGris); carpeta.setBackground(colorGris); grid.setBackground(colorGris); ptiempo.setBackground(colorGris); bcomentario.setBackground(colorGris); zoom.setBackground(colorGris); presentacion.setPreferredSize(new Dimension(100, 80)); atras.setPreferredSize(new Dimension(100, 80)); siguiente.setPreferredSize(new Dimension(100, 80)); carpeta.setPreferredSize(new Dimension(100, 80)); grid.setPreferredSize(new Dimension(100, 80)); bcomentario.setPreferredSize(new Dimension(100, 80)); zoom.setPreferredSize(new Dimension(100, 80)); grid.setFocusPainted(false); atras.setFocusPainted(false); siguiente.setFocusPainted(false); carpeta.setFocusPainted(false); presentacion.setFocusPainted(false); bcomentario.setFocusPainted(false); zoom.setFocusPainted(false); grid.setBorder(null); atras.setBorder(null); siguiente.setBorder(null); carpeta.setBorder(null); presentacion.setBorder(null); areabotones.setBorder(null); areaventana.setBorder(null); bcomentario.setBorder(null); zoom.setBorder(null); /* GUI GUI GUI GUI */ /* Action Listeners */ siguiente.addActionListener(this); atras.addActionListener(this); presentacion.addActionListener(this); carpeta.addActionListener(this); grid.addActionListener(this); bcomentario.addActionListener(this); zoom.addActionListener(this); this.setLayout(new BorderLayout()); add(areaventana, BorderLayout.CENTER); add(areabotones, BorderLayout.SOUTH); ptiempo.setVisible(false); siguiente.setEnabled(false); atras.setEnabled(false); presentacion.setEnabled(false); grid.setEnabled(false); bcomentario.setEnabled(false); zoom.setEnabled(false); /* Abre el selector desde que inicia el programa */ chooser = new JFileChooser(); chooser.setDialogTitle("Selecciona una imagen..."); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); chooser.setAcceptAllFileFilterUsed(false); // Abrir archivo es de acá... returnChooser = chooser.showOpenDialog(ArcViewer.this); if (returnChooser == 0) { imagenes = lista.Miranda(chooser, returnChooser); siguiente.setEnabled(true); atras.setEnabled(true); presentacion.setEnabled(true); grid.setEnabled(true); bcomentario.setEnabled(true); zoom.setEnabled(true); for (int asd1 = 0; asd1 < imagenes.size(); asd1++) { imagenesbean.add(new ImagenBean(imagenes.get(asd1), 0, 0)); } String getImgSelected = chooser.getSelectedFile().getPath(); for (int index = 0; index < imagenesbean.size(); index++) { if (getImgSelected.equals(imagenesbean.get(index).getIcon())) { imagen.setIcon(new ImageIcon(imagenesbean.get(index).getIcon())); indexaux = index; } } } else { System.out.println("No Selection"); carpeta.setEnabled(true); } // for (int asd1=0; asd1 < imagenes.size(); asd1++) { // imagenesbean.add(new ImagenBean(imagenes.get(asd1),0,0)); // } // String getImgSelected = chooser.getSelectedFile().getPath(); // for (int index=0; index < imagenesbean.size(); index++) { // if (getImgSelected.equals( imagenesbean.get(index).getIcon() )) { // imagen.setIcon(new ImageIcon(imagenesbean.get(index).getIcon())); // indexaux = index; // } // } }