Java Code Examples for javax.swing.JFileChooser.setPreferredSize()

The following are Jave code examples for showing how to use setPreferredSize() of the javax.swing.JFileChooser class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Dahlem_SER316   File: AddResourceDialog.java   Source Code and License Vote up 5 votes
/**
 * setup the JFileChooser so the user can select the resource file
 */

void browseB_actionPerformed(ActionEvent e) {
	// Fix until Sun's JVM supports more locales...
	UIManager.put("FileChooser.lookInLabelText", Local.getString("Look in:"));
	UIManager.put("FileChooser.upFolderToolTipText", Local.getString("Up One Level"));
	UIManager.put("FileChooser.newFolderToolTipText", Local.getString("Create New Folder"));
	UIManager.put("FileChooser.listViewButtonToolTipText", Local.getString("List"));
	UIManager.put("FileChooser.detailsViewButtonToolTipText", Local.getString("Details"));
	UIManager.put("FileChooser.fileNameLabelText", Local.getString("File Name:"));
	UIManager.put("FileChooser.filesOfTypeLabelText", Local.getString("Files of Type:"));
	UIManager.put("FileChooser.openButtonText", Local.getString("Open"));
	UIManager.put("FileChooser.openButtonToolTipText", Local.getString("Open selected file"));
	UIManager.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
	UIManager.put("FileChooser.cancelButtonToolTipText", Local.getString("Cancel"));

	JFileChooser chooser = new JFileChooser();
	chooser.setFileHidingEnabled(false);
	chooser.setDialogTitle(Local.getString("Add resource"));
	chooser.setAcceptAllFileFilterUsed(true);
	chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
	chooser.setPreferredSize(new Dimension(550, 375));
	/*
	 * java.io.File lastSel = (java.io.File)
	 * Context.get("LAST_SELECTED_RESOURCE_FILE"); if (lastSel != null)
	 * chooser.setCurrentDirectory(lastSel);
	 */
	if (chooser.showOpenDialog(this) != JFileChooser.APPROVE_OPTION)
		return;
	/*
	 * try { Context.put("LAST_SELECTED_RESOURCE_FILE",
	 * chooser.getSelectedFile()); } catch (Exception ex) {}
	 */
	pathField.setText(chooser.getSelectedFile().getPath());
	checkOkEnabled();
}
 
Example 2
Project: Wilmersdorf_SER316   File: SetApplicationPanel.java   Source Code and License Vote up 5 votes
void selectAppBrowseB_actionPerformed(ActionEvent e) {
// Fix until Sun's JVM supports more locales...
UIManager.put("FileChooser.lookInLabelText", Local.getString("Look in:"));
UIManager.put("FileChooser.upFolderToolTipText", Local.getString("Up One Level"));
UIManager.put("FileChooser.newFolderToolTipText", Local.getString("Create New Folder"));
UIManager.put("FileChooser.listViewButtonToolTipText", Local.getString("List"));
UIManager.put("FileChooser.detailsViewButtonToolTipText", Local.getString("Details"));
UIManager.put("FileChooser.fileNameLabelText", Local.getString("File Name:"));
UIManager.put("FileChooser.filesOfTypeLabelText", Local.getString("Files of Type:"));
UIManager.put("FileChooser.openButtonText", Local.getString("Open"));
UIManager.put("FileChooser.openButtonToolTipText", Local.getString("Open selected file"));
UIManager.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
UIManager.put("FileChooser.cancelButtonToolTipText", Local.getString("Cancel"));
UIManager.put("FileChooser.acceptAllFileFilterText", Local.getString("All Files") + " (*.*)");

JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle(Local.getString("Path to executable"));
chooser.setFileHidingEnabled(false);
chooser.setAcceptAllFileFilterUsed(true);
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
if (System.getProperty("os.name").startsWith("Win")) {
    chooser.setFileFilter(new AllFilesFilter(AllFilesFilter.EXE));
    chooser.setCurrentDirectory(new File("C:\\Program Files"));
}
chooser.setPreferredSize(new Dimension(550, 375));
/*
    java.io.File lastSel = (java.io.File) Context.get("LAST_SELECTED_IMPORT_FILE");
    if (lastSel != null)
        chooser.setCurrentDirectory(lastSel);
*/
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
    applicationField.setText(chooser.getSelectedFile().getPath());
}
 
Example 3
Project: SER316-Dresden   File: SetApplicationPanel.java   Source Code and License Vote up 5 votes
void selectAppBrowseB_actionPerformed(ActionEvent e) {
// Fix until Sun's JVM supports more locales...
UIManager.put("FileChooser.lookInLabelText", Local.getString("Look in:"));
UIManager.put("FileChooser.upFolderToolTipText", Local.getString("Up One Level"));
UIManager.put("FileChooser.newFolderToolTipText", Local.getString("Create New Folder"));
UIManager.put("FileChooser.listViewButtonToolTipText", Local.getString("List"));
UIManager.put("FileChooser.detailsViewButtonToolTipText", Local.getString("Details"));
UIManager.put("FileChooser.fileNameLabelText", Local.getString("File Name:"));
UIManager.put("FileChooser.filesOfTypeLabelText", Local.getString("Files of Type:"));
UIManager.put("FileChooser.openButtonText", Local.getString("Open"));
UIManager.put("FileChooser.openButtonToolTipText", Local.getString("Open selected file"));
UIManager.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
UIManager.put("FileChooser.cancelButtonToolTipText", Local.getString("Cancel"));
UIManager.put("FileChooser.acceptAllFileFilterText", Local.getString("All Files") + " (*.*)");

JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle(Local.getString("Path to executable"));
chooser.setFileHidingEnabled(false);
chooser.setAcceptAllFileFilterUsed(true);
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
if (System.getProperty("os.name").startsWith("Win")) {
    chooser.setFileFilter(new AllFilesFilter(AllFilesFilter.EXE));
    chooser.setCurrentDirectory(new File("C:\\Program Files"));
}
chooser.setPreferredSize(new Dimension(550, 375));
/*
    java.io.File lastSel = (java.io.File) Context.get("LAST_SELECTED_IMPORT_FILE");
    if (lastSel != null)
        chooser.setCurrentDirectory(lastSel);
*/
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
    applicationField.setText(chooser.getSelectedFile().getPath());
}
 
Example 4
Project: SER316-Aachen   File: SetApplicationPanel.java   Source Code and License Vote up 5 votes
void selectAppBrowseB_actionPerformed(ActionEvent e) {
// Fix until Sun's JVM supports more locales...
UIManager.put("FileChooser.lookInLabelText", Local.getString("Look in:"));
UIManager.put("FileChooser.upFolderToolTipText", Local.getString("Up One Level"));
UIManager.put("FileChooser.newFolderToolTipText", Local.getString("Create New Folder"));
UIManager.put("FileChooser.listViewButtonToolTipText", Local.getString("List"));
UIManager.put("FileChooser.detailsViewButtonToolTipText", Local.getString("Details"));
UIManager.put("FileChooser.fileNameLabelText", Local.getString("File Name:"));
UIManager.put("FileChooser.filesOfTypeLabelText", Local.getString("Files of Type:"));
UIManager.put("FileChooser.openButtonText", Local.getString("Open"));
UIManager.put("FileChooser.openButtonToolTipText", Local.getString("Open selected file"));
UIManager.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
UIManager.put("FileChooser.cancelButtonToolTipText", Local.getString("Cancel"));
UIManager.put("FileChooser.acceptAllFileFilterText", Local.getString("All Files") + " (*.*)");

JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle(Local.getString("Path to executable"));
chooser.setFileHidingEnabled(false);
chooser.setAcceptAllFileFilterUsed(true);
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
if (System.getProperty("os.name").startsWith("Win")) {
    chooser.setFileFilter(new AllFilesFilter(AllFilesFilter.EXE));
    chooser.setCurrentDirectory(new File("C:\\Program Files"));
}
chooser.setPreferredSize(new Dimension(550, 375));
/*
    java.io.File lastSel = (java.io.File) Context.get("LAST_SELECTED_IMPORT_FILE");
    if (lastSel != null)
        chooser.setCurrentDirectory(lastSel);
*/
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
    applicationField.setText(chooser.getSelectedFile().getPath());
}
 
Example 5
Project: Dahlem_SER316   File: SetApplicationPanel.java   Source Code and License Vote up 5 votes
void selectAppBrowseB_actionPerformed(ActionEvent e) {
// Fix until Sun's JVM supports more locales...
UIManager.put("FileChooser.lookInLabelText", Local.getString("Look in:"));
UIManager.put("FileChooser.upFolderToolTipText", Local.getString("Up One Level"));
UIManager.put("FileChooser.newFolderToolTipText", Local.getString("Create New Folder"));
UIManager.put("FileChooser.listViewButtonToolTipText", Local.getString("List"));
UIManager.put("FileChooser.detailsViewButtonToolTipText", Local.getString("Details"));
UIManager.put("FileChooser.fileNameLabelText", Local.getString("File Name:"));
UIManager.put("FileChooser.filesOfTypeLabelText", Local.getString("Files of Type:"));
UIManager.put("FileChooser.openButtonText", Local.getString("Open"));
UIManager.put("FileChooser.openButtonToolTipText", Local.getString("Open selected file"));
UIManager.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
UIManager.put("FileChooser.cancelButtonToolTipText", Local.getString("Cancel"));
UIManager.put("FileChooser.acceptAllFileFilterText", Local.getString("All Files") + " (*.*)");

JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle(Local.getString("Path to executable"));
chooser.setFileHidingEnabled(false);
chooser.setAcceptAllFileFilterUsed(true);
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
if (System.getProperty("os.name").startsWith("Win")) {
    chooser.setFileFilter(new AllFilesFilter(AllFilesFilter.EXE));
    chooser.setCurrentDirectory(new File("C:\\Program Files"));
}
chooser.setPreferredSize(new Dimension(550, 375));
/*
    java.io.File lastSel = (java.io.File) Context.get("LAST_SELECTED_IMPORT_FILE");
    if (lastSel != null)
        chooser.setCurrentDirectory(lastSel);
*/
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
    applicationField.setText(chooser.getSelectedFile().getPath());
}
 
Example 6
Project: SER316-Munich   File: SetApplicationPanel.java   Source Code and License Vote up 5 votes
void selectAppBrowseB_actionPerformed(ActionEvent e) {
// Fix until Sun's JVM supports more locales...
UIManager.put("FileChooser.lookInLabelText", Local.getString("Look in:"));
UIManager.put("FileChooser.upFolderToolTipText", Local.getString("Up One Level"));
UIManager.put("FileChooser.newFolderToolTipText", Local.getString("Create New Folder"));
UIManager.put("FileChooser.listViewButtonToolTipText", Local.getString("List"));
UIManager.put("FileChooser.detailsViewButtonToolTipText", Local.getString("Details"));
UIManager.put("FileChooser.fileNameLabelText", Local.getString("File Name:"));
UIManager.put("FileChooser.filesOfTypeLabelText", Local.getString("Files of Type:"));
UIManager.put("FileChooser.openButtonText", Local.getString("Open"));
UIManager.put("FileChooser.openButtonToolTipText", Local.getString("Open selected file"));
UIManager.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
UIManager.put("FileChooser.cancelButtonToolTipText", Local.getString("Cancel"));
UIManager.put("FileChooser.acceptAllFileFilterText", Local.getString("All Files") + " (*.*)");

JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle(Local.getString("Path to executable"));
chooser.setFileHidingEnabled(false);
chooser.setAcceptAllFileFilterUsed(true);
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
if (System.getProperty("os.name").startsWith("Win")) {
    chooser.setFileFilter(new AllFilesFilter(AllFilesFilter.EXE));
    chooser.setCurrentDirectory(new File("C:\\Program Files"));
}
chooser.setPreferredSize(new Dimension(550, 375));
/*
    java.io.File lastSel = (java.io.File) Context.get("LAST_SELECTED_IMPORT_FILE");
    if (lastSel != null)
        chooser.setCurrentDirectory(lastSel);
*/
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
    applicationField.setText(chooser.getSelectedFile().getPath());
}
 
Example 7
Project: Neukoelln_SER316   File: AddResourceDialog.java   Source Code and License Vote up 4 votes
/**
* setup the JFileChooser so the user can select the resource file
*/

  void browseB_actionPerformed(ActionEvent e) {
      // Fix until Sun's JVM supports more locales...
      UIManager.put("FileChooser.lookInLabelText", 
          Local.getString("Look in:"));
      UIManager.put("FileChooser.upFolderToolTipText", 
          Local.getString("Up One Level"));
      UIManager.put("FileChooser.newFolderToolTipText", 
          Local.getString("Create New Folder"));
      UIManager.put("FileChooser.listViewButtonToolTipText", 
          Local.getString("List"));
      UIManager.put("FileChooser.detailsViewButtonToolTipText", 
          Local.getString("Details"));
      UIManager.put("FileChooser.fileNameLabelText", 
          Local.getString("File Name:"));
      UIManager.put("FileChooser.filesOfTypeLabelText", 
          Local.getString("Files of Type:"));
      UIManager.put("FileChooser.openButtonText", 
          Local.getString("Open"));
      UIManager.put("FileChooser.openButtonToolTipText", 
          Local.getString("Open selected file"));
      UIManager.put("FileChooser.cancelButtonText", 
          Local.getString("Cancel"));
      UIManager.put("FileChooser.cancelButtonToolTipText", 
          Local.getString("Cancel"));
      
      JFileChooser chooser = new JFileChooser();
      chooser.setFileHidingEnabled(false);
      chooser.setDialogTitle(Local.getString("Add resource"));
      chooser.setAcceptAllFileFilterUsed(true);
      chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);        
      chooser.setPreferredSize(new Dimension(550, 375));
      /*java.io.File lastSel = (java.io.File) Context.get("LAST_SELECTED_RESOURCE_FILE");
      if (lastSel != null)
          chooser.setCurrentDirectory(lastSel);*/
      if (chooser.showOpenDialog(this) != JFileChooser.APPROVE_OPTION)
          return;
      /*try {
          Context.put("LAST_SELECTED_RESOURCE_FILE", chooser.getSelectedFile());
      }
      catch (Exception ex) {}*/
      pathField.setText(chooser.getSelectedFile().getPath());
      checkOkEnabled();
  }
 
Example 8
Project: Neukoelln_SER316   File: EditorPanel.java   Source Code and License Vote up 4 votes
void importB_actionPerformed(ActionEvent e) {
	// Fix until Sun's JVM supports more locales...
	UIManager.put("FileChooser.lookInLabelText", Local
			.getString("Look in:"));
	UIManager.put("FileChooser.upFolderToolTipText", Local
			.getString("Up One Level"));
	UIManager.put("FileChooser.newFolderToolTipText", Local
			.getString("Create New Folder"));
	UIManager.put("FileChooser.listViewButtonToolTipText", Local
			.getString("List"));
	UIManager.put("FileChooser.detailsViewButtonToolTipText", Local
			.getString("Details"));
	UIManager.put("FileChooser.fileNameLabelText", Local
			.getString("File Name:"));
	UIManager.put("FileChooser.filesOfTypeLabelText", Local
			.getString("Files of Type:"));
	UIManager.put("FileChooser.openButtonText", Local.getString("Open"));
	UIManager.put("FileChooser.openButtonToolTipText", Local
			.getString("Open selected file"));
	UIManager
			.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
	UIManager.put("FileChooser.cancelButtonToolTipText", Local
			.getString("Cancel"));

	JFileChooser chooser = new JFileChooser();
	chooser.setFileHidingEnabled(false);
	chooser.setDialogTitle(Local.getString("Insert file"));
	chooser.setAcceptAllFileFilterUsed(false);
	chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
	chooser.addChoosableFileFilter(new AllFilesFilter(AllFilesFilter.HTML));
	chooser.setPreferredSize(new Dimension(550, 375));
	String lastSel = (String) Context.get("LAST_SELECTED_IMPORT_FILE");
	if (lastSel != null)
		chooser.setCurrentDirectory(new java.io.File(lastSel));
	if (chooser.showOpenDialog(this) != JFileChooser.APPROVE_OPTION)
		return;

	Context.put("LAST_SELECTED_IMPORT_FILE", chooser.getSelectedFile()
			.getPath());

	File f = chooser.getSelectedFile();
	new HTMLFileImport(f, editor);
}
 
Example 9
Project: Neukoelln_SER316   File: EditTypeDialog.java   Source Code and License Vote up 4 votes
void setIconB_actionPerformed(ActionEvent e) {
    // Fix until Sun's JVM supports more locales...
    UIManager.put("FileChooser.lookInLabelText", Local.getString("Look in:"));
    UIManager.put("FileChooser.upFolderToolTipText", Local.getString("Up One Level"));
    UIManager.put("FileChooser.newFolderToolTipText", Local.getString("Create New Folder"));
    UIManager.put("FileChooser.listViewButtonToolTipText", Local.getString("List"));
    UIManager.put("FileChooser.detailsViewButtonToolTipText", Local.getString("Details"));
    UIManager.put("FileChooser.fileNameLabelText", Local.getString("File Name:"));
    UIManager.put("FileChooser.filesOfTypeLabelText", Local.getString("Files of Type:"));
    UIManager.put("FileChooser.openButtonText", Local.getString("Open"));
    UIManager.put("FileChooser.openButtonToolTipText", Local.getString("Open selected file"));
    UIManager.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
    UIManager.put("FileChooser.cancelButtonToolTipText", Local.getString("Cancel"));
    UIManager.put("FileChooser.acceptAllFileFilterText", Local.getString("All Files") + " (*.*)");
    
    JFileChooser chooser = new JFileChooser();
    chooser.setPreferredSize(new Dimension(550, 375));
    chooser.setFileHidingEnabled(false);
    chooser.setDialogTitle(Local.getString("Choose icon file"));
    //chooser.setAcceptAllFileFilterUsed(true);
    chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
    chooser.setCurrentDirectory(
        new File(net.sf.memoranda.ui.AppFrame.class.getResource("resources/icons/mimetypes").getPath()));
    /*if (System.getProperty("os.name").startsWith("Win")) {
        chooser.setFileFilter(new AllFilesFilter(AllFilesFilter.ICO));
        chooser.setCurrentDirectory(new File("C:\\Program Files"));
    }
    else */
    chooser.addChoosableFileFilter(new net.sf.memoranda.ui.htmleditor.filechooser.ImageFilter());
    if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
        try {
            iconLabel.setIcon(new ImageIcon(chooser.getSelectedFile().getPath()));
       }
        catch (Exception ex) {
  //ex.printStackTrace();
 }
        finally {
            iconPath = chooser.getSelectedFile().getPath();
        }

    }
}
 
Example 10
Project: Dahlem_SER316   File: EditorPanel.java   Source Code and License Vote up 4 votes
void importB_actionPerformed(ActionEvent e) {
	// Fix until Sun's JVM supports more locales...
	UIManager.put("FileChooser.lookInLabelText", Local
			.getString("Look in:"));
	UIManager.put("FileChooser.upFolderToolTipText", Local
			.getString("Up One Level"));
	UIManager.put("FileChooser.newFolderToolTipText", Local
			.getString("Create New Folder"));
	UIManager.put("FileChooser.listViewButtonToolTipText", Local
			.getString("List"));
	UIManager.put("FileChooser.detailsViewButtonToolTipText", Local
			.getString("Details"));
	UIManager.put("FileChooser.fileNameLabelText", Local
			.getString("File Name:"));
	UIManager.put("FileChooser.filesOfTypeLabelText", Local
			.getString("Files of Type:"));
	UIManager.put("FileChooser.openButtonText", Local.getString("Open"));
	UIManager.put("FileChooser.openButtonToolTipText", Local
			.getString("Open selected file"));
	UIManager
			.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
	UIManager.put("FileChooser.cancelButtonToolTipText", Local
			.getString("Cancel"));

	JFileChooser chooser = new JFileChooser();
	chooser.setFileHidingEnabled(false);
	chooser.setDialogTitle(Local.getString("Insert file"));
	chooser.setAcceptAllFileFilterUsed(false);
	chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
	chooser.addChoosableFileFilter(new AllFilesFilter(AllFilesFilter.HTML));
	chooser.setPreferredSize(new Dimension(550, 375));
	String lastSel = (String) Context.get("LAST_SELECTED_IMPORT_FILE");
	if (lastSel != null)
		chooser.setCurrentDirectory(new java.io.File(lastSel));
	if (chooser.showOpenDialog(this) != JFileChooser.APPROVE_OPTION)
		return;

	Context.put("LAST_SELECTED_IMPORT_FILE", chooser.getSelectedFile()
			.getPath());

	File f = chooser.getSelectedFile();
	new HTMLFileImport(f, editor);
}
 
Example 11
Project: SER316-Dresden   File: EditorPanel.java   Source Code and License Vote up 4 votes
void importB_actionPerformed(ActionEvent e) {
	// Fix until Sun's JVM supports more locales...
	UIManager.put("FileChooser.lookInLabelText", Local
			.getString("Look in:"));
	UIManager.put("FileChooser.upFolderToolTipText", Local
			.getString("Up One Level"));
	UIManager.put("FileChooser.newFolderToolTipText", Local
			.getString("Create New Folder"));
	UIManager.put("FileChooser.listViewButtonToolTipText", Local
			.getString("List"));
	UIManager.put("FileChooser.detailsViewButtonToolTipText", Local
			.getString("Details"));
	UIManager.put("FileChooser.fileNameLabelText", Local
			.getString("File Name:"));
	UIManager.put("FileChooser.filesOfTypeLabelText", Local
			.getString("Files of Type:"));
	UIManager.put("FileChooser.openButtonText", Local.getString("Open"));
	UIManager.put("FileChooser.openButtonToolTipText", Local
			.getString("Open selected file"));
	UIManager
			.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
	UIManager.put("FileChooser.cancelButtonToolTipText", Local
			.getString("Cancel"));

	JFileChooser chooser = new JFileChooser();
	chooser.setFileHidingEnabled(false);
	chooser.setDialogTitle(Local.getString("Insert file"));
	chooser.setAcceptAllFileFilterUsed(false);
	chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
	chooser.addChoosableFileFilter(new AllFilesFilter(AllFilesFilter.HTML));
	chooser.setPreferredSize(new Dimension(550, 375));
	String lastSel = (String) Context.get("LAST_SELECTED_IMPORT_FILE");
	if (lastSel != null)
		chooser.setCurrentDirectory(new java.io.File(lastSel));
	if (chooser.showOpenDialog(this) != JFileChooser.APPROVE_OPTION)
		return;

	Context.put("LAST_SELECTED_IMPORT_FILE", chooser.getSelectedFile()
			.getPath());

	File f = chooser.getSelectedFile();
	new HTMLFileImport(f, editor);
}
 
Example 12
Project: SER316-Dresden   File: EditTypeDialog.java   Source Code and License Vote up 4 votes
void setIconB_actionPerformed(ActionEvent e) {
    // Fix until Sun's JVM supports more locales...
    UIManager.put("FileChooser.lookInLabelText", Local.getString("Look in:"));
    UIManager.put("FileChooser.upFolderToolTipText", Local.getString("Up One Level"));
    UIManager.put("FileChooser.newFolderToolTipText", Local.getString("Create New Folder"));
    UIManager.put("FileChooser.listViewButtonToolTipText", Local.getString("List"));
    UIManager.put("FileChooser.detailsViewButtonToolTipText", Local.getString("Details"));
    UIManager.put("FileChooser.fileNameLabelText", Local.getString("File Name:"));
    UIManager.put("FileChooser.filesOfTypeLabelText", Local.getString("Files of Type:"));
    UIManager.put("FileChooser.openButtonText", Local.getString("Open"));
    UIManager.put("FileChooser.openButtonToolTipText", Local.getString("Open selected file"));
    UIManager.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
    UIManager.put("FileChooser.cancelButtonToolTipText", Local.getString("Cancel"));
    UIManager.put("FileChooser.acceptAllFileFilterText", Local.getString("All Files") + " (*.*)");
    
    JFileChooser chooser = new JFileChooser();
    chooser.setPreferredSize(new Dimension(550, 375));
    chooser.setFileHidingEnabled(false);
    chooser.setDialogTitle(Local.getString("Choose icon file"));
    //chooser.setAcceptAllFileFilterUsed(true);
    chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
    chooser.setCurrentDirectory(
        new File(net.sf.memoranda.ui.AppFrame.class.getResource("/ui/icons/mimetypes").getPath()));
    /*if (System.getProperty("os.name").startsWith("Win")) {
        chooser.setFileFilter(new AllFilesFilter(AllFilesFilter.ICO));
        chooser.setCurrentDirectory(new File("C:\\Program Files"));
    }
    else */
    chooser.addChoosableFileFilter(new net.sf.memoranda.ui.htmleditor.filechooser.ImageFilter());
    if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
        try {
            iconLabel.setIcon(new ImageIcon(chooser.getSelectedFile().getPath()));
       }
        catch (Exception ex) {
  //ex.printStackTrace();
 }
        finally {
            iconPath = chooser.getSelectedFile().getPath();
        }

    }
}
 
Example 13
Project: SER316-Munich   File: EditTypeDialog.java   Source Code and License Vote up 4 votes
void setIconB_actionPerformed(ActionEvent e) {
    // Fix until Sun's JVM supports more locales...
    UIManager.put("FileChooser.lookInLabelText", Local.getString("Look in:"));
    UIManager.put("FileChooser.upFolderToolTipText", Local.getString("Up One Level"));
    UIManager.put("FileChooser.newFolderToolTipText", Local.getString("Create New Folder"));
    UIManager.put("FileChooser.listViewButtonToolTipText", Local.getString("List"));
    UIManager.put("FileChooser.detailsViewButtonToolTipText", Local.getString("Details"));
    UIManager.put("FileChooser.fileNameLabelText", Local.getString("File Name:"));
    UIManager.put("FileChooser.filesOfTypeLabelText", Local.getString("Files of Type:"));
    UIManager.put("FileChooser.openButtonText", Local.getString("Open"));
    UIManager.put("FileChooser.openButtonToolTipText", Local.getString("Open selected file"));
    UIManager.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
    UIManager.put("FileChooser.cancelButtonToolTipText", Local.getString("Cancel"));
    UIManager.put("FileChooser.acceptAllFileFilterText", Local.getString("All Files") + " (*.*)");
    
    JFileChooser chooser = new JFileChooser();
    chooser.setPreferredSize(new Dimension(550, 375));
    chooser.setFileHidingEnabled(false);
    chooser.setDialogTitle(Local.getString("Choose icon file"));
    //chooser.setAcceptAllFileFilterUsed(true);
    chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
    chooser.setCurrentDirectory(
        new File(net.sf.memoranda.ui.AppFrame.class.getResource("resources/icons/mimetypes").getPath()));
    /*if (System.getProperty("os.name").startsWith("Win")) {
        chooser.setFileFilter(new AllFilesFilter(AllFilesFilter.ICO));
        chooser.setCurrentDirectory(new File("C:\\Program Files"));
    }
    else */
    chooser.addChoosableFileFilter(new net.sf.memoranda.ui.htmleditor.filechooser.ImageFilter());
    if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
        try {
            iconLabel.setIcon(new ImageIcon(chooser.getSelectedFile().getPath()));
       }
        catch (Exception ex) {
  //ex.printStackTrace();
 }
        finally {
            iconPath = chooser.getSelectedFile().getPath();
        }

    }
}
 
Example 14
Project: SER316-Aachen   File: AddResourceDialog.java   Source Code and License Vote up 4 votes
/**
* setup the JFileChooser so the user can select the resource file
*/

  void browseB_actionPerformed(ActionEvent e) {
      // Fix until Sun's JVM supports more locales...
      UIManager.put("FileChooser.lookInLabelText", 
          Local.getString("Look in:"));
      UIManager.put("FileChooser.upFolderToolTipText", 
          Local.getString("Up One Level"));
      UIManager.put("FileChooser.newFolderToolTipText", 
          Local.getString("Create New Folder"));
      UIManager.put("FileChooser.listViewButtonToolTipText", 
          Local.getString("List"));
      UIManager.put("FileChooser.detailsViewButtonToolTipText", 
          Local.getString("Details"));
      UIManager.put("FileChooser.fileNameLabelText", 
          Local.getString("File Name:"));
      UIManager.put("FileChooser.filesOfTypeLabelText", 
          Local.getString("Files of Type:"));
      UIManager.put("FileChooser.openButtonText", 
          Local.getString("Open"));
      UIManager.put("FileChooser.openButtonToolTipText", 
          Local.getString("Open selected file"));
      UIManager.put("FileChooser.cancelButtonText", 
          Local.getString("Cancel"));
      UIManager.put("FileChooser.cancelButtonToolTipText", 
          Local.getString("Cancel"));
      
      JFileChooser chooser = new JFileChooser();
      chooser.setFileHidingEnabled(false);
      chooser.setDialogTitle(Local.getString("Add resource"));
      chooser.setAcceptAllFileFilterUsed(true);
      chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);        
      chooser.setPreferredSize(new Dimension(550, 375));
      /*java.io.File lastSel = (java.io.File) Context.get("LAST_SELECTED_RESOURCE_FILE");
      if (lastSel != null)
          chooser.setCurrentDirectory(lastSel);*/
      if (chooser.showOpenDialog(this) != JFileChooser.APPROVE_OPTION)
          return;
      /*try {
          Context.put("LAST_SELECTED_RESOURCE_FILE", chooser.getSelectedFile());
      }
      catch (Exception ex) {}*/
      pathField.setText(chooser.getSelectedFile().getPath());
      checkOkEnabled();
  }
 
Example 15
Project: SER316-Aachen   File: EditorPanel.java   Source Code and License Vote up 4 votes
void importB_actionPerformed(ActionEvent e) {
	// Fix until Sun's JVM supports more locales...
	UIManager.put("FileChooser.lookInLabelText", Local
			.getString("Look in:"));
	UIManager.put("FileChooser.upFolderToolTipText", Local
			.getString("Up One Level"));
	UIManager.put("FileChooser.newFolderToolTipText", Local
			.getString("Create New Folder"));
	UIManager.put("FileChooser.listViewButtonToolTipText", Local
			.getString("List"));
	UIManager.put("FileChooser.detailsViewButtonToolTipText", Local
			.getString("Details"));
	UIManager.put("FileChooser.fileNameLabelText", Local
			.getString("File Name:"));
	UIManager.put("FileChooser.filesOfTypeLabelText", Local
			.getString("Files of Type:"));
	UIManager.put("FileChooser.openButtonText", Local.getString("Open"));
	UIManager.put("FileChooser.openButtonToolTipText", Local
			.getString("Open selected file"));
	UIManager
			.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
	UIManager.put("FileChooser.cancelButtonToolTipText", Local
			.getString("Cancel"));

	JFileChooser chooser = new JFileChooser();
	chooser.setFileHidingEnabled(false);
	chooser.setDialogTitle(Local.getString("Insert file"));
	chooser.setAcceptAllFileFilterUsed(false);
	chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
	chooser.addChoosableFileFilter(new AllFilesFilter(AllFilesFilter.TXT));
	chooser.addChoosableFileFilter(new AllFilesFilter(AllFilesFilter.HTML));
	chooser.setPreferredSize(new Dimension(550, 375));
	String lastSel = (String) Context.get("LAST_SELECTED_IMPORT_FILE");
	if (lastSel != null)
		chooser.setCurrentDirectory(new java.io.File(lastSel));
	if (chooser.showOpenDialog(this) != JFileChooser.APPROVE_OPTION)
		return;

	Context.put("LAST_SELECTED_IMPORT_FILE", chooser.getSelectedFile()
			.getPath());

	File f = chooser.getSelectedFile();
	new HTMLFileImport(f, editor);
}
 
Example 16
Project: SER316-Ingolstadt   File: EditorPanel.java   Source Code and License Vote up 4 votes
void importB_actionPerformed(ActionEvent e) {
	// Fix until Sun's JVM supports more locales...
	UIManager.put("FileChooser.lookInLabelText", Local
			.getString("Look in:"));
	UIManager.put("FileChooser.upFolderToolTipText", Local
			.getString("Up One Level"));
	UIManager.put("FileChooser.newFolderToolTipText", Local
			.getString("Create New Folder"));
	UIManager.put("FileChooser.listViewButtonToolTipText", Local
			.getString("List"));
	UIManager.put("FileChooser.detailsViewButtonToolTipText", Local
			.getString("Details"));
	UIManager.put("FileChooser.fileNameLabelText", Local
			.getString("File Name:"));
	UIManager.put("FileChooser.filesOfTypeLabelText", Local
			.getString("Files of Type:"));
	UIManager.put("FileChooser.openButtonText", Local.getString("Open"));
	UIManager.put("FileChooser.openButtonToolTipText", Local
			.getString("Open selected file"));
	UIManager
			.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
	UIManager.put("FileChooser.cancelButtonToolTipText", Local
			.getString("Cancel"));

	JFileChooser chooser = new JFileChooser();
	chooser.setFileHidingEnabled(false);
	chooser.setDialogTitle(Local.getString("Insert file"));
	chooser.setAcceptAllFileFilterUsed(false);
	chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
	chooser.addChoosableFileFilter(new AllFilesFilter(AllFilesFilter.HTML));
	chooser.setPreferredSize(new Dimension(550, 375));
	String lastSel = (String) Context.get("LAST_SELECTED_IMPORT_FILE");
	if (lastSel != null)
		chooser.setCurrentDirectory(new java.io.File(lastSel));
	if (chooser.showOpenDialog(this) != JFileChooser.APPROVE_OPTION)
		return;

	Context.put("LAST_SELECTED_IMPORT_FILE", chooser.getSelectedFile()
			.getPath());

	File f = chooser.getSelectedFile();
	new HTMLFileImport(f, editor);
}
 
Example 17
Project: Reinickendorf_SER316   File: EditTypeDialog.java   Source Code and License Vote up 4 votes
void setIconB_actionPerformed(ActionEvent e) {
    // Fix until Sun's JVM supports more locales...
    UIManager.put("FileChooser.lookInLabelText", Local.getString("Look in:"));
    UIManager.put("FileChooser.upFolderToolTipText", Local.getString("Up One Level"));
    UIManager.put("FileChooser.newFolderToolTipText", Local.getString("Create New Folder"));
    UIManager.put("FileChooser.listViewButtonToolTipText", Local.getString("List"));
    UIManager.put("FileChooser.detailsViewButtonToolTipText", Local.getString("Details"));
    UIManager.put("FileChooser.fileNameLabelText", Local.getString("File Name:"));
    UIManager.put("FileChooser.filesOfTypeLabelText", Local.getString("Files of Type:"));
    UIManager.put("FileChooser.openButtonText", Local.getString("Open"));
    UIManager.put("FileChooser.openButtonToolTipText", Local.getString("Open selected file"));
    UIManager.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
    UIManager.put("FileChooser.cancelButtonToolTipText", Local.getString("Cancel"));
    UIManager.put("FileChooser.acceptAllFileFilterText", Local.getString("All Files") + " (*.*)");
    
    JFileChooser chooser = new JFileChooser();
    chooser.setPreferredSize(new Dimension(550, 375));
    chooser.setFileHidingEnabled(false);
    chooser.setDialogTitle(Local.getString("Choose icon file"));
    //chooser.setAcceptAllFileFilterUsed(true);
    chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
    chooser.setCurrentDirectory(
        new File(net.sf.memoranda.ui.AppFrame.class.getResource("resources/icons/mimetypes").getPath()));
    /*if (System.getProperty("os.name").startsWith("Win")) {
        chooser.setFileFilter(new AllFilesFilter(AllFilesFilter.ICO));
        chooser.setCurrentDirectory(new File("C:\\Program Files"));
    }
    else */
    chooser.addChoosableFileFilter(new net.sf.memoranda.ui.htmleditor.filechooser.ImageFilter());
    if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
        try {
            iconLabel.setIcon(new ImageIcon(chooser.getSelectedFile().getPath()));
       }
        catch (Exception ex) {
  //ex.printStackTrace();
 }
        finally {
            iconPath = chooser.getSelectedFile().getPath();
        }

    }
}
 
Example 18
Project: Reinickendorf_SER316   File: AddResourceDialog.java   Source Code and License Vote up 4 votes
/**
* setup the JFileChooser so the user can select the resource file
*/

  void browseB_actionPerformed(ActionEvent e) {
      // Fix until Sun's JVM supports more locales...
      UIManager.put("FileChooser.lookInLabelText", 
          Local.getString("Look in:"));
      UIManager.put("FileChooser.upFolderToolTipText", 
          Local.getString("Up One Level"));
      UIManager.put("FileChooser.newFolderToolTipText", 
          Local.getString("Create New Folder"));
      UIManager.put("FileChooser.listViewButtonToolTipText", 
          Local.getString("List"));
      UIManager.put("FileChooser.detailsViewButtonToolTipText", 
          Local.getString("Details"));
      UIManager.put("FileChooser.fileNameLabelText", 
          Local.getString("File Name:"));
      UIManager.put("FileChooser.filesOfTypeLabelText", 
          Local.getString("Files of Type:"));
      UIManager.put("FileChooser.openButtonText", 
          Local.getString("Open"));
      UIManager.put("FileChooser.openButtonToolTipText", 
          Local.getString("Open selected file"));
      UIManager.put("FileChooser.cancelButtonText", 
          Local.getString("Cancel"));
      UIManager.put("FileChooser.cancelButtonToolTipText", 
          Local.getString("Cancel"));
      
      JFileChooser chooser = new JFileChooser();
      chooser.setFileHidingEnabled(false);
      chooser.setDialogTitle(Local.getString("Add resource"));
      chooser.setAcceptAllFileFilterUsed(true);
      chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);        
      chooser.setPreferredSize(new Dimension(550, 375));
      /*java.io.File lastSel = (java.io.File) Context.get("LAST_SELECTED_RESOURCE_FILE");
      if (lastSel != null)
          chooser.setCurrentDirectory(lastSel);*/
      if (chooser.showOpenDialog(this) != JFileChooser.APPROVE_OPTION)
          return;
      /*try {
          Context.put("LAST_SELECTED_RESOURCE_FILE", chooser.getSelectedFile());
      }
      catch (Exception ex) {}*/
      pathField.setText(chooser.getSelectedFile().getPath());
      checkOkEnabled();
  }
 
Example 19
Project: SER316-Aachen   File: EditTypeDialog.java   Source Code and License Vote up 4 votes
void setIconB_actionPerformed(ActionEvent e) {
    // Fix until Sun's JVM supports more locales...
    UIManager.put("FileChooser.lookInLabelText", Local.getString("Look in:"));
    UIManager.put("FileChooser.upFolderToolTipText", Local.getString("Up One Level"));
    UIManager.put("FileChooser.newFolderToolTipText", Local.getString("Create New Folder"));
    UIManager.put("FileChooser.listViewButtonToolTipText", Local.getString("List"));
    UIManager.put("FileChooser.detailsViewButtonToolTipText", Local.getString("Details"));
    UIManager.put("FileChooser.fileNameLabelText", Local.getString("File Name:"));
    UIManager.put("FileChooser.filesOfTypeLabelText", Local.getString("Files of Type:"));
    UIManager.put("FileChooser.openButtonText", Local.getString("Open"));
    UIManager.put("FileChooser.openButtonToolTipText", Local.getString("Open selected file"));
    UIManager.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
    UIManager.put("FileChooser.cancelButtonToolTipText", Local.getString("Cancel"));
    UIManager.put("FileChooser.acceptAllFileFilterText", Local.getString("All Files") + " (*.*)");
    
    JFileChooser chooser = new JFileChooser();
    chooser.setPreferredSize(new Dimension(550, 375));
    chooser.setFileHidingEnabled(false);
    chooser.setDialogTitle(Local.getString("Choose icon file"));
    //chooser.setAcceptAllFileFilterUsed(true);
    chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
    chooser.setCurrentDirectory(
        new File(net.sf.memoranda.ui.AppFrame.class.getResource("resources/icons/mimetypes").getPath()));
    /*if (System.getProperty("os.name").startsWith("Win")) {
        chooser.setFileFilter(new AllFilesFilter(AllFilesFilter.ICO));
        chooser.setCurrentDirectory(new File("C:\\Program Files"));
    }
    else */
    chooser.addChoosableFileFilter(new net.sf.memoranda.ui.htmleditor.filechooser.ImageFilter());
    if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
        try {
            iconLabel.setIcon(new ImageIcon(chooser.getSelectedFile().getPath()));
       }
        catch (Exception ex) {
  //ex.printStackTrace();
 }
        finally {
            iconPath = chooser.getSelectedFile().getPath();
        }

    }
}
 
Example 20
Project: Wilmersdorf_SER316   File: EditorPanel.java   Source Code and License Vote up 4 votes
void importB_actionPerformed(ActionEvent e) {
	// Fix until Sun's JVM supports more locales...
	UIManager.put("FileChooser.lookInLabelText", Local
			.getString("Look in:"));
	UIManager.put("FileChooser.upFolderToolTipText", Local
			.getString("Up One Level"));
	UIManager.put("FileChooser.newFolderToolTipText", Local
			.getString("Create New Folder"));
	UIManager.put("FileChooser.listViewButtonToolTipText", Local
			.getString("List"));
	UIManager.put("FileChooser.detailsViewButtonToolTipText", Local
			.getString("Details"));
	UIManager.put("FileChooser.fileNameLabelText", Local
			.getString("File Name:"));
	UIManager.put("FileChooser.filesOfTypeLabelText", Local
			.getString("Files of Type:"));
	UIManager.put("FileChooser.openButtonText", Local.getString("Open"));
	UIManager.put("FileChooser.openButtonToolTipText", Local
			.getString("Open selected file"));
	UIManager
			.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
	UIManager.put("FileChooser.cancelButtonToolTipText", Local
			.getString("Cancel"));

	JFileChooser chooser = new JFileChooser();
	chooser.setFileHidingEnabled(false);
	chooser.setDialogTitle(Local.getString("Insert file"));
	chooser.setAcceptAllFileFilterUsed(false);
	chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
	chooser.addChoosableFileFilter(new AllFilesFilter(AllFilesFilter.HTML));
	chooser.setPreferredSize(new Dimension(550, 375));
	String lastSel = (String) Context.get("LAST_SELECTED_IMPORT_FILE");
	if (lastSel != null)
		chooser.setCurrentDirectory(new java.io.File(lastSel));
	if (chooser.showOpenDialog(this) != JFileChooser.APPROVE_OPTION)
		return;

	Context.put("LAST_SELECTED_IMPORT_FILE", chooser.getSelectedFile()
			.getPath());

	File f = chooser.getSelectedFile();
	new HTMLFileImport(f, editor);
}