List of usage examples for javax.swing JFileChooser JFileChooser
public JFileChooser(FileSystemView fsv)
JFileChooser
using the given FileSystemView
. From source file:IHM.FenetreAjoutAffiche.java
private void btnAfficheActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAfficheActionPerformed JFileChooser chooser = new JFileChooser(new File(".")); chooser.setDialogTitle("ouvrir une image"); int reponse = chooser.showOpenDialog(this); boolean etat; if (reponse == JFileChooser.APPROVE_OPTION) { InputStream input = null; f = chooser.getSelectedFile();//w w w . java 2 s .com nomAffiche = f.getName(); nomF = f.getAbsolutePath(); txtNomPhoto.setText(nomAffiche); } }
From source file:com.att.aro.ui.model.diagnostic.GraphPanelHelper.java
public void SaveImageAs(JViewport pane, String graphPanelSaveDirectory) { JFileChooser fc = new JFileChooser(graphPanelSaveDirectory); // Set up file types String[] fileTypesJPG = new String[2]; String fileDisplayTypeJPG = ResourceBundleHelper.getMessageString("fileChooser.contentDisplayType.jpeg"); fileTypesJPG[0] = ResourceBundleHelper.getMessageString("fileChooser.contentType.jpeg"); fileTypesJPG[1] = ResourceBundleHelper.getMessageString("fileChooser.contentType.jpg"); FileFilter filterJPG = new ExtensionFileFilter(fileDisplayTypeJPG, fileTypesJPG); fc.addChoosableFileFilter(fc.getAcceptAllFileFilter()); String[] fileTypesPng = new String[1]; String fileDisplayTypePng = ResourceBundleHelper.getMessageString("fileChooser.contentDisplayType.png"); fileTypesPng[0] = ResourceBundleHelper.getMessageString("fileChooser.contentType.png"); FileFilter filterPng = new ExtensionFileFilter(fileDisplayTypePng, fileTypesPng); fc.addChoosableFileFilter(filterPng); fc.setFileFilter(filterJPG);/*from w w w . j a va2s. com*/ File plotImageFile = null; boolean bSavedOrCancelled = false; while (!bSavedOrCancelled) { if (fc.showSaveDialog(pane) == JFileChooser.APPROVE_OPTION) { String strFile = fc.getSelectedFile().toString(); String strFileLowerCase = strFile.toLowerCase(); String fileDesc = fc.getFileFilter().getDescription(); String fileType = ResourceBundleHelper.getMessageString("fileChooser.contentType.jpg"); if ((fileDesc.equalsIgnoreCase( ResourceBundleHelper.getMessageString("fileChooser.contentDisplayType.png")) || strFileLowerCase.endsWith(ResourceBundleHelper.getMessageString("fileType.filters.dot") + fileTypesPng[0].toLowerCase()))) { fileType = fileTypesPng[0]; } if (strFile.length() > 0) { // Save current directory graphPanelSaveDirectory = fc.getCurrentDirectory().getPath(); if ((fileType != null) && (fileType.length() > 0)) { String fileTypeLowerCaseWithDot = ResourceBundleHelper .getMessageString("fileType.filters.dot") + fileType.toLowerCase(); if (!strFileLowerCase.endsWith(fileTypeLowerCaseWithDot)) { strFile += ResourceBundleHelper.getMessageString("fileType.filters.dot") + fileType; } } plotImageFile = new File(strFile); boolean bAttemptToWriteToFile = true; if (plotImageFile.exists()) { if (MessageDialogFactory.showConfirmDialog(pane, MessageFormat.format( ResourceBundleHelper.getMessageString("fileChooser.fileExists"), plotImageFile.getAbsolutePath()), ResourceBundleHelper.getMessageString("fileChooser.confirm"), JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) { bAttemptToWriteToFile = false; } } if (bAttemptToWriteToFile) { try { if (fileType != null && fileType.equalsIgnoreCase(fileTypesPng[0])) { BufferedImage bufImage = ImageHelper.createImage(pane.getBounds().width, pane.getBounds().height); Graphics2D g = bufImage.createGraphics(); pane.paint(g); ImageIO.write(bufImage, "png", plotImageFile); } else { BufferedImage bufImage = ImageHelper.createImage(pane.getBounds().width, pane.getBounds().height); Graphics2D g = bufImage.createGraphics(); pane.paint(g); ImageIO.write(bufImage, "jpg", plotImageFile); } bSavedOrCancelled = true; } catch (IOException e) { MessageDialogFactory.showMessageDialog(pane, ResourceBundleHelper .getMessageString("fileChooser.errorWritingToFile" + plotImageFile.toString())); } } } } else { bSavedOrCancelled = true; } } }
From source file:com.sshtools.common.ui.SshToolsApplicationClientPanel.java
/** * *///from w ww.j ava2s . co m public void editConnection() { // Create a file chooser with the current directory set to the // application home JFileChooser fileDialog = new JFileChooser(PreferencesStore.get(PREF_CONNECTION_FILE_DIRECTORY, System.getProperty("sshtools.home", System.getProperty("user.home")))); fileDialog.setFileFilter(connectionFileFilter); // Show it int ret = fileDialog.showOpenDialog(this); // If we've approved the selection then process if (ret == fileDialog.APPROVE_OPTION) { PreferencesStore.put(PREF_CONNECTION_FILE_DIRECTORY, fileDialog.getCurrentDirectory().getAbsolutePath()); // Get the file File f = fileDialog.getSelectedFile(); // Load the profile SshToolsConnectionProfile p = new SshToolsConnectionProfile(); try { p.open(f); if (editConnection(p)) { saveConnection(false, f, p); } } catch (IOException ioe) { showErrorMessage(this, "Failed to load connection profile.", "Error", ioe); } } }
From source file:io.github.jeremgamer.editor.panels.IconFrame.java
public IconFrame(JFrame parent) { this.setModal(true); this.setResizable(false); ArrayList<BufferedImage> icons = new ArrayList<BufferedImage>(); try {//from w w w. j a v a 2 s . c om icons.add(ImageIO.read(ImageGetter.class.getResource("icon16.png"))); icons.add(ImageIO.read(ImageGetter.class.getResource("icon32.png"))); icons.add(ImageIO.read(ImageGetter.class.getResource("icon64.png"))); icons.add(ImageIO.read(ImageGetter.class.getResource("icon128.png"))); } catch (IOException e1) { e1.printStackTrace(); } this.setIconImages((List<? extends Image>) icons); this.setTitle("Icnes"); this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); JPanel content = new JPanel(); content.setLayout(new BoxLayout(content, BoxLayout.LINE_AXIS)); content.setBorder(BorderFactory.createTitledBorder("")); try { remove128.setIcon(new ImageIcon(ImageIO.read(ImageGetter.class.getResource("remove.png")))); remove64.setIcon(new ImageIcon(ImageIO.read(ImageGetter.class.getResource("remove.png")))); remove32.setIcon(new ImageIcon(ImageIO.read(ImageGetter.class.getResource("remove.png")))); remove16.setIcon(new ImageIcon(ImageIO.read(ImageGetter.class.getResource("remove.png")))); } catch (IOException e) { e.printStackTrace(); } browse128.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { String path = null; JFileChooser chooser = new JFileChooser(Editor.lastPath); FileNameExtensionFilter filter = new FileNameExtensionFilter("Images", "jpg", "png", "gif", "jpeg", "bmp"); chooser.setFileFilter(filter); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); int option = chooser.showOpenDialog(null); if (option == JFileChooser.APPROVE_OPTION) { path = chooser.getSelectedFile().getAbsolutePath(); Editor.lastPath = chooser.getSelectedFile().getParent(); copyImage(new File(path), "128.png"); try { x128.repaint(); x128.getGraphics().drawImage(ImageIO.read(new File(path)), 0 + 10, 0 + 20, 128, 128, null); } catch (IOException e) { e.printStackTrace(); } } } }); remove128.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { File file = new File("projects/" + Editor.getProjectName() + "/128.png"); file.delete(); x128.repaint(); } }); browse64.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { String path = null; JFileChooser chooser = new JFileChooser(Editor.lastPath); FileNameExtensionFilter filter = new FileNameExtensionFilter("Images", "jpg", "png", "gif", "jpeg", "bmp"); chooser.setFileFilter(filter); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); int option = chooser.showOpenDialog(null); if (option == JFileChooser.APPROVE_OPTION) { path = chooser.getSelectedFile().getAbsolutePath(); Editor.lastPath = chooser.getSelectedFile().getParent(); copyImage(new File(path), "64.png"); try { x64.repaint(); x64.getGraphics().drawImage(ImageIO.read(new File(path)), 32 + 10, 32 + 20, 64, 64, null); } catch (IOException e) { e.printStackTrace(); } } } }); remove64.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { File file = new File("projects/" + Editor.getProjectName() + "/64.png"); file.delete(); x64.repaint(); } }); browse32.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { String path = null; JFileChooser chooser = new JFileChooser(Editor.lastPath); FileNameExtensionFilter filter = new FileNameExtensionFilter("Images", "jpg", "png", "gif", "jpeg", "bmp"); chooser.setFileFilter(filter); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); int option = chooser.showOpenDialog(null); if (option == JFileChooser.APPROVE_OPTION) { path = chooser.getSelectedFile().getAbsolutePath(); Editor.lastPath = chooser.getSelectedFile().getParent(); copyImage(new File(path), "32.png"); try { x32.repaint(); x32.getGraphics().drawImage(ImageIO.read(new File(path)), 48 + 10, 48 + 20, 32, 32, null); } catch (IOException e) { e.printStackTrace(); } } } }); remove32.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { File file = new File("projects/" + Editor.getProjectName() + "/32.png"); file.delete(); x32.repaint(); } }); browse16.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { String path = null; JFileChooser chooser = new JFileChooser(Editor.lastPath); FileNameExtensionFilter filter = new FileNameExtensionFilter("Images", "jpg", "png", "gif", "jpeg", "bmp"); chooser.setFileFilter(filter); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); int option = chooser.showOpenDialog(null); if (option == JFileChooser.APPROVE_OPTION) { path = chooser.getSelectedFile().getAbsolutePath(); Editor.lastPath = chooser.getSelectedFile().getParent(); copyImage(new File(path), "16.png"); try { x16.repaint(); x16.getGraphics().drawImage(ImageIO.read(new File(path)), 56 + 10, 56 + 20, 16, 16, null); } catch (IOException e) { e.printStackTrace(); } } } }); remove16.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { File file = new File("projects/" + Editor.getProjectName() + "/16.png"); file.delete(); x16.repaint(); } }); content.add(x128); content.add(x64); content.add(x32); content.add(x16); this.setContentPane(content); this.pack(); this.setLocationRelativeTo(parent); this.setVisible(true); }
From source file:de.evaluationtool.gui.EvaluationFrameActionListener.java
private void saveXML() { JFileChooser chooser = new JFileChooser("Save evaluation result as alignment XML"); chooser.setCurrentDirectory(frame.defaultDirectory); int returnVal = chooser.showSaveDialog(frame); if (returnVal == JFileChooser.APPROVE_OPTION) { if (chooser.getSelectedFile().exists() && (JOptionPane.showConfirmDialog(frame, "File already exists. Overwrite?") != JOptionPane.YES_OPTION)) { return; }/*ww w .jav a 2s. c om*/ try { frame.saveXML(chooser.getSelectedFile(), SaveXMLMode.SAVE_EVERYTHING); } catch (JDOMException | IOException e) { JOptionPane.showConfirmDialog(frame, e, "Error saving XML", JOptionPane.ERROR_MESSAGE); } } }
From source file:com.mgmtp.jfunk.core.scripting.ScriptContext.java
/** * Opens a file chooser dialog which can then be used to choose a file or directory and assign * the path of the chosen object to a variable. The name of the variable must be passed as a * parameter./*from w w w . ja va 2s . co m*/ * * @param fileKey * the key the selected file path is stored under in the configuration * @return the chosen file */ @Cmd public File chooseFile(final String fileKey) { log.debug("Opening file chooser dialog"); JFileChooser fileChooser = new JFileChooser(System.getProperty(JFunkConstants.USER_DIR)); fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); fileChooser.setPreferredSize(new Dimension(600, 326)); int fileChooserResult = fileChooser.showOpenDialog(null); if (fileChooserResult == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); String filename = file.toString(); log.info("Assigning file path '{}' to property '{}'", filename, fileKey); config.put(fileKey, filename); return file; } log.error("No file or directory was chosen, execution will abort"); throw new IllegalArgumentException("No file or directory was chosen"); }
From source file:de.pavloff.spark4knime.jsnippet.ui.JarListPanel.java
private void onJarFileAdd() { DefaultListModel<String> model = (DefaultListModel<String>) m_addJarList.getModel(); Set<String> hash = new HashSet<>(Collections.list(model.elements())); StringHistory history = StringHistory.getInstance("java_snippet_jar_dirs"); if (m_jarFileChooser == null) { File dir = null;//from w w w. ja v a 2 s. c om for (String h : history.getHistory()) { File temp = new File(h); if (temp.isDirectory()) { dir = temp; break; } } m_jarFileChooser = new JFileChooser(dir); m_jarFileChooser.setFileFilter(new SimpleFileFilter(".zip", ".jar")); m_jarFileChooser.setMultiSelectionEnabled(true); } int result = m_jarFileChooser.showDialog(m_addJarList, "Select"); if (result == JFileChooser.APPROVE_OPTION) { for (File f : m_jarFileChooser.getSelectedFiles()) { String s = f.getAbsolutePath(); if (hash.add(s)) { model.addElement(s); } } history.add(m_jarFileChooser.getCurrentDirectory().getAbsolutePath()); } }
From source file:edu.umich.robot.GuiApplication.java
/** * <p>/* w ww . j ava 2 s.c om*/ * Firing up this application requires a configuration file. If no * configuration file is presented on the command line, this is called to * prompt the user to select a configuration file. * * <p> * Future work should probably include some default instead of doing this. * * @return The selected, loaded configuration file. */ public static Config promptForConfig(Component parent) { System.out.println("CLASSPATH: " + System.getenv("CLASSPATH")); System.out.println("DYLD_LIBRARY_PATH: " + System.getenv("DYLD_LIBRARY_PATH")); System.out.println("LD_LIBRARY_PATH: " + System.getenv("LD_LIBRARY_PATH")); System.out.println("SOAR_HOME: " + System.getenv("SOAR_HOME")); System.out.println("java.library.path: " + System.getProperty("java.library.path")); JFileChooser fc = new JFileChooser(System.getProperty("user.dir")); fc.setFileSelectionMode(JFileChooser.FILES_ONLY); FileFilter filter = new FileNameExtensionFilter("Text Config File", "txt"); fc.setFileFilter(filter); fc.setMultiSelectionEnabled(false); int ret = fc.showOpenDialog(parent); if (ret == JFileChooser.APPROVE_OPTION) { try { return new ConfigFile(fc.getSelectedFile().getAbsolutePath()); } catch (IOException e) { logger.error(e.getMessage()); } } return null; }
From source file:com.willwinder.universalgcodesender.MainWindow.java
/** Creates new form MainWindow */ public MainWindow(BackendAPI backend) { this.backend = backend; this.settings = SettingsFactory.loadSettings(); try {//from ww w . j a va2 s.c om backend.applySettings(settings); } catch (Exception e) { throw new RuntimeException(e); } if (settings.isShowNightlyWarning() && MainWindow.VERSION.contains("nightly")) { java.awt.EventQueue.invokeLater(new Runnable() { @Override public void run() { String message = "This version of Universal Gcode Sender is a nightly build.\n" + "It contains all of the latest features and improvements, \n" + "but may also have bugs that still need to be fixed.\n" + "\n" + "If you encounter any problems, please report them on github."; JOptionPane.showMessageDialog(new JFrame(), message, "", JOptionPane.INFORMATION_MESSAGE); } }); } initComponents(); initProgram(); backend.addControllerListener(this); backend.addUGSEventListener(this); arrowMovementEnabled.setSelected(settings.isManualModeEnabled()); stepSizeSpinner.setValue(settings.getManualModeStepSize()); boolean unitsAreMM = settings.getDefaultUnits().equals("mm"); mmRadioButton.setSelected(unitsAreMM); inchRadioButton.setSelected(!unitsAreMM); fileChooser = new JFileChooser(settings.getLastOpenedFilename()); commPortComboBox.setSelectedItem(settings.getPort()); baudrateSelectionComboBox.setSelectedItem(settings.getPortRate()); scrollWindowCheckBox.setSelected(settings.isScrollWindowEnabled()); checkScrollWindow(); showVerboseOutputCheckBox.setSelected(settings.isVerboseOutputEnabled()); showCommandTableCheckBox.setSelected(settings.isCommandTableEnabled()); firmwareComboBox.setSelectedItem(settings.getFirmwareVersion()); // macroPanel.initMacroButtons(settings); setSize(settings.getMainWindowSettings().width, settings.getMainWindowSettings().height); setLocation(settings.getMainWindowSettings().xLocation, settings.getMainWindowSettings().yLocation); // mw.setSize(java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().width, java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().width); initFileChooser(); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { if (fileChooser.getSelectedFile() != null) { settings.setLastOpenedFilename(fileChooser.getSelectedFile().getAbsolutePath()); } settings.setDefaultUnits(inchRadioButton.isSelected() ? "inch" : "mm"); settings.setManualModeStepSize(getStepSize()); settings.setManualModeEnabled(arrowMovementEnabled.isSelected()); settings.setPort(commPortComboBox.getSelectedItem().toString()); settings.setPortRate(baudrateSelectionComboBox.getSelectedItem().toString()); settings.setScrollWindowEnabled(scrollWindowCheckBox.isSelected()); settings.setVerboseOutputEnabled(showVerboseOutputCheckBox.isSelected()); settings.setCommandTableEnabled(showCommandTableCheckBox.isSelected()); settings.setFirmwareVersion(firmwareComboBox.getSelectedItem().toString()); SettingsFactory.saveSettings(settings); if (pendantUI != null) { pendantUI.stop(); } } }); }
From source file:eu.apenet.dpt.standalone.gui.dateconversion.DateConversionRulesDialog.java
private void createDataConversionRulesList() { Vector<String> columnNames = new Vector<String>(); columnNames.add(labels.getString("dateConversion.valueRead")); columnNames.add(labels.getString("dateConversion.valueConverted")); dm = new DefaultTableModel(xmlFilehandler.loadDataFromFile(FILENAME), columnNames); dm.addRow(new Vector<String>()); dm.addTableModelListener(new TableModelListener() { public void tableChanged(TableModelEvent e) { if (ruleTable.getEditingRow() != ruleTable.getRowCount() - 1 && (StringUtils.isEmpty((String) dm.getValueAt(ruleTable.getEditingRow(), 0)) && StringUtils.isEmpty((String) dm.getValueAt(ruleTable.getEditingRow(), 1)))) { dm.removeRow(ruleTable.getEditingRow()); }//www. j av a 2 s . c o m if (ruleTable.getEditingRow() == ruleTable.getRowCount() - 1) { if (StringUtils.isNotEmpty((String) dm.getValueAt(ruleTable.getEditingRow(), 0)) && StringUtils.isNotEmpty((String) dm.getValueAt(ruleTable.getEditingRow(), 1))) { dm.addRow(new Vector<String>()); } } if (ruleTable.getEditingColumn() == 1) { if (StringUtils.isNotEmpty((String) dm.getValueAt(ruleTable.getEditingRow(), 1)) && !isCorrectDateFormat((String) dm.getValueAt(ruleTable.getEditingRow(), 1))) { createOptionPaneForIsoDate(ruleTable.getEditingRow(), 1); } } } }); ruleTable = new JTable(dm); oldModel = new DefaultTableModel(xmlFilehandler.loadDataFromFile(FILENAME), columnNames); JButton saveButton = new JButton(labels.getString("saveBtn")); saveButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (ruleTable.isEditing()) { ruleTable.getCellEditor().stopCellEditing(); } Vector<Vector<String>> data = ((DefaultTableModel) ruleTable.getModel()).getDataVector(); for (int i = 0; i < data.size() - 1; i++) { Vector<String> vector = data.elementAt(i); if (vector.elementAt(1) != null && !isCorrectDateFormat((String) vector.elementAt(1))) { createOptionPaneForIsoDate(i, 1); } } xmlFilehandler.saveDataToFile(data, FILENAME); saveMessage.setText(MessageFormat.format(labels.getString("dateConversion.saveMsg"), new SimpleDateFormat("HH:mm:ss").format(Calendar.getInstance().getTime()))); } }); JButton closeButton = new JButton(labels.getString("quit")); closeButton.addActionListener(new ActionListener() { // boolean cancel = true; public void actionPerformed(ActionEvent e) { /*System.out.println(Boolean.toString(oldModel.getRowCount() == (ruleTable.getModel().getRowCount() - 1)) + "<<" + oldModel.getRowCount() + ", " + (ruleTable.getModel().getRowCount() - 1)); if (oldModel.getRowCount() != ruleTable.getModel().getRowCount() - 1) { cancel = showUnsavedChangesDialog(); } else { for (int i = 0; i < (ruleTable.getModel().getRowCount() - 1); i++) { for (int j = 0; j <= 1; j++) { System.out.println(oldModel.getValueAt(i, j) == ruleTable.getModel().getValueAt(i, j) + " >> " + oldModel.getValueAt(i, j) + ", " + ruleTable.getModel().getValueAt(i, j)); if (oldModel.getValueAt(i, j) != ruleTable.getModel().getValueAt(i, j)) { cancel = showUnsavedChangesDialog(); } } } } if (cancel) {*/ dispose(); // } } }); JButton downloadButton = new JButton(labels.getString("downloadBtn")); downloadButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (ruleTable.isEditing()) { ruleTable.getCellEditor().stopCellEditing(); } Vector<Vector<String>> data = ((DefaultTableModel) ruleTable.getModel()).getDataVector(); File currentLocation = new File(retrieveFromDb.retrieveOpenLocation()); JFileChooser fileChooser = new JFileChooser(currentLocation); fileChooser.setDialogType(JFileChooser.SAVE_DIALOG); fileChooser.setFileFilter(new FileNameExtensionFilter("XML file", "xml")); int returnedVal = fileChooser.showSaveDialog(getParent()); if (returnedVal == JFileChooser.APPROVE_OPTION) { String fileName = fileChooser.getSelectedFile().toString(); if (!fileName.endsWith(".xml")) { fileName = fileName + ".xml"; } xmlFilehandler.saveDataToFile(data, fileName); //additionally save data to standard file xmlFilehandler.saveDataToFile(data, FILENAME); saveMessage.setText(MessageFormat.format(labels.getString("dateConversion.saveMsg"), new SimpleDateFormat("HH:mm:ss").format(Calendar.getInstance().getTime()))); } } }); JPanel contentPanel = new JPanel(new BorderLayout()); contentPanel.add(new JScrollPane(ruleTable)); saveMessage = new JLabel(); contentPanel.add(saveMessage, BorderLayout.SOUTH); JPanel buttonPanel = new JPanel(new GridLayout(1, 3)); buttonPanel.add(saveButton); buttonPanel.add(closeButton); buttonPanel.add(downloadButton); JPanel pane = new JPanel(new BorderLayout()); pane.add(contentPanel, BorderLayout.PAGE_START); pane.add(buttonPanel, BorderLayout.PAGE_END); add(pane); }