System File Chooser: fixes for Windows

This commit is contained in:
Karl Tauber
2025-01-04 12:33:18 +01:00
parent 641fada6c4
commit 9453d55abd
4 changed files with 171 additions and 63 deletions

View File

@@ -201,10 +201,10 @@ public class FlatNativeWindowsLibrary
* the file dialog. It is highly recommended to invoke it from a new thread * the file dialog. It is highly recommended to invoke it from a new thread
* to avoid blocking the AWT event dispatching thread. * to avoid blocking the AWT event dispatching thread.
* *
* @param owner the owner of the file dialog * @param owner the owner of the file dialog; or {@code null}
* @param open if {@code true}, shows the open dialog; if {@code false}, shows the save dialog * @param open if {@code true}, shows the open dialog; if {@code false}, shows the save dialog
* @param title text displayed in dialog title; or {@code null} * @param title text displayed in dialog title; or {@code null}
* @param okButtonLabel text displayed in default button; or {@code null} * @param okButtonLabel text displayed in default button; or {@code null}. Use '&' for mnemonics (e.g. "&Choose")
* @param fileNameLabel text displayed in front of the filename text field; or {@code null} * @param fileNameLabel text displayed in front of the filename text field; or {@code null}
* @param fileName user-editable filename currently shown in the filename field; or {@code null} * @param fileName user-editable filename currently shown in the filename field; or {@code null}
* @param folder current directory shown in the dialog; or {@code null} * @param folder current directory shown in the dialog; or {@code null}
@@ -219,7 +219,7 @@ public class FlatNativeWindowsLibrary
* @param optionsClear options to clear; see {@code FOS_*} constants * @param optionsClear options to clear; see {@code FOS_*} constants
* @param fileTypeIndex the file type that appears as selected (zero-based) * @param fileTypeIndex the file type that appears as selected (zero-based)
* @param fileTypes file types that the dialog can open or save. * @param fileTypes file types that the dialog can open or save.
* Pairs of strings are required. * Pairs of strings are required for each filter.
* First string is the display name of the filter shown in the combobox (e.g. "Text Files"). * First string is the display name of the filter shown in the combobox (e.g. "Text Files").
* Second string is the filter pattern (e.g. "*.txt", "*.exe;*.dll" or "*.*"). * Second string is the filter pattern (e.g. "*.txt", "*.exe;*.dll" or "*.*").
* @return file path(s) that the user selected; an empty array if canceled; * @return file path(s) that the user selected; an empty array if canceled;

View File

@@ -23,6 +23,7 @@
/** /**
* @author Karl Tauber * @author Karl Tauber
* @since 3.6
*/ */
// see FlatWndProc.cpp // see FlatWndProc.cpp
@@ -79,7 +80,7 @@ public:
//---- class FilterSpec ------------------------------------------------------- //---- class FilterSpec -------------------------------------------------------
class FilterSpec { class FilterSpec {
JNIEnv* env; JNIEnv* env = NULL;
jstring* jnames = NULL; jstring* jnames = NULL;
jstring* jspecs = NULL; jstring* jspecs = NULL;
@@ -89,6 +90,9 @@ public:
public: public:
FilterSpec( JNIEnv* _env, jobjectArray fileTypes ) { FilterSpec( JNIEnv* _env, jobjectArray fileTypes ) {
if( fileTypes == NULL )
return;
env = _env; env = _env;
count = env->GetArrayLength( fileTypes ) / 2; count = env->GetArrayLength( fileTypes ) / 2;
if( count <= 0 ) if( count <= 0 )
@@ -165,7 +169,13 @@ JNIEXPORT jobjectArray JNICALL Java_com_formdev_flatlaf_ui_FlatNativeWindowsLibr
if( !coInitializer.initialized ) if( !coInitializer.initialized )
return NULL; return NULL;
HWND hwndOwner = getWindowHandle( env, owner ); // handle limitations (without this, some Win32 method fails and this method returns NULL)
if( (optionsSet & FOS_PICKFOLDERS) != 0 ) {
if( open )
fileTypes = NULL; // no filter allowed for picking folders
else
optionsSet &= ~FOS_PICKFOLDERS; // not allowed for save dialog
}
// convert Java strings to C strings // convert Java strings to C strings
AutoReleaseString ctitle( env, title ); AutoReleaseString ctitle( env, title );
@@ -185,6 +195,7 @@ JNIEXPORT jobjectArray JNICALL Java_com_formdev_flatlaf_ui_FlatNativeWindowsLibr
NULL, CLSCTX_INPROC_SERVER, open ? IID_IFileOpenDialog : IID_IFileSaveDialog, NULL, CLSCTX_INPROC_SERVER, open ? IID_IFileOpenDialog : IID_IFileSaveDialog,
reinterpret_cast<LPVOID*>( &dialog ) ) ); reinterpret_cast<LPVOID*>( &dialog ) ) );
// set title, etc.
if( ctitle != NULL ) if( ctitle != NULL )
CHECK_HRESULT( dialog->SetTitle( ctitle ) ); CHECK_HRESULT( dialog->SetTitle( ctitle ) );
if( cokButtonLabel != NULL ) if( cokButtonLabel != NULL )
@@ -202,23 +213,26 @@ JNIEXPORT jobjectArray JNICALL Java_com_formdev_flatlaf_ui_FlatNativeWindowsLibr
if( cdefaultExtension != NULL ) if( cdefaultExtension != NULL )
CHECK_HRESULT( dialog->SetDefaultExtension( cdefaultExtension ) ); CHECK_HRESULT( dialog->SetDefaultExtension( cdefaultExtension ) );
// set options
FILEOPENDIALOGOPTIONS existingOptions; FILEOPENDIALOGOPTIONS existingOptions;
CHECK_HRESULT( dialog->GetOptions( &existingOptions ) ); CHECK_HRESULT( dialog->GetOptions( &existingOptions ) );
CHECK_HRESULT( dialog->SetOptions ( (existingOptions & ~optionsClear) | optionsSet ) ); CHECK_HRESULT( dialog->SetOptions ( (existingOptions & ~optionsClear) | optionsSet ) );
if( specs.count > 0 ) { // initialize filter
if( specs.count > 0 && (optionsSet & FOS_PICKFOLDERS) == 0 ) {
CHECK_HRESULT( dialog->SetFileTypes( specs.count, specs.specs ) ); CHECK_HRESULT( dialog->SetFileTypes( specs.count, specs.specs ) );
if( fileTypeIndex > 0 ) if( fileTypeIndex > 0 )
CHECK_HRESULT( dialog->SetFileTypeIndex( min( fileTypeIndex + 1, specs.count ) ) ); CHECK_HRESULT( dialog->SetFileTypeIndex( min( fileTypeIndex + 1, specs.count ) ) );
} }
// show dialog // show dialog
HWND hwndOwner = (owner != NULL) ? getWindowHandle( env, owner ) : NULL;
HRESULT hr = dialog->Show( hwndOwner ); HRESULT hr = dialog->Show( hwndOwner );
if( hr == HRESULT_FROM_WIN32(ERROR_CANCELLED) ) if( hr == HRESULT_FROM_WIN32(ERROR_CANCELLED) )
return newJavaStringArray( env, 0 ); return newJavaStringArray( env, 0 );
CHECK_HRESULT( hr ); CHECK_HRESULT( hr );
// convert URLs to Java string array // convert shell items to Java string array
if( open ) { if( open ) {
AutoReleasePtr<IShellItemArray> shellItems; AutoReleasePtr<IShellItemArray> shellItems;
DWORD count; DWORD count;
@@ -235,7 +249,7 @@ JNIEXPORT jobjectArray JNICALL Java_com_formdev_flatlaf_ui_FlatNativeWindowsLibr
jstring jpath = newJavaString( env, path ); jstring jpath = newJavaString( env, path );
CoTaskMemFree( path ); CoTaskMemFree( path );
env->SetObjectArrayElement( array, 0, jpath ); env->SetObjectArrayElement( array, i, jpath );
env->DeleteLocalRef( jpath ); env->DeleteLocalRef( jpath );
} }
return array; return array;

View File

@@ -17,10 +17,12 @@
package com.formdev.flatlaf.testing; package com.formdev.flatlaf.testing;
import static com.formdev.flatlaf.ui.FlatNativeWindowsLibrary.*; import static com.formdev.flatlaf.ui.FlatNativeWindowsLibrary.*;
import java.awt.Dialog;
import java.awt.EventQueue; import java.awt.EventQueue;
import java.awt.SecondaryLoop; import java.awt.SecondaryLoop;
import java.awt.Toolkit; import java.awt.Toolkit;
import java.awt.Window; import java.awt.Window;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.awt.event.WindowFocusListener; import java.awt.event.WindowFocusListener;
import java.awt.event.WindowListener; import java.awt.event.WindowListener;
@@ -75,7 +77,26 @@ public class FlatSystemFileChooserWindowsTest
} }
private void openOrSave( boolean open, boolean direct ) { private void openOrSave( boolean open, boolean direct ) {
Window owner = SwingUtilities.windowForComponent( this ); Window frame = SwingUtilities.windowForComponent( this );
if( ownerFrameRadioButton.isSelected() )
openOrSave( open, direct, frame );
else if( ownerDialogRadioButton.isSelected() ) {
JDialog dialog = new JDialog( frame, "Dummy Modal Dialog", Dialog.DEFAULT_MODALITY_TYPE );
dialog.setDefaultCloseOperation( JDialog.DISPOSE_ON_CLOSE );
dialog.addWindowListener( new WindowAdapter() {
@Override
public void windowOpened( WindowEvent e ) {
openOrSave( open, direct, dialog );
}
} );
dialog.setSize( 1200, 1000 );
dialog.setLocationRelativeTo( this );
dialog.setVisible( true );
} else
openOrSave( open, direct, null );
}
private void openOrSave( boolean open, boolean direct, Window owner ) {
String title = n( titleField.getText() ); String title = n( titleField.getText() );
String okButtonLabel = n( okButtonLabelField.getText() ); String okButtonLabel = n( okButtonLabelField.getText() );
String fileNameLabel = n( fileNameLabelField.getText() ); String fileNameLabel = n( fileNameLabelField.getText() );
@@ -215,6 +236,11 @@ public class FlatSystemFileChooserWindowsTest
private void initComponents() { private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
ownerLabel = new JLabel();
ownerFrameRadioButton = new JRadioButton();
ownerDialogRadioButton = new JRadioButton();
ownerNullRadioButton = new JRadioButton();
ownerSpacer = new JPanel(null);
titleLabel = new JLabel(); titleLabel = new JLabel();
titleField = new JTextField(); titleField = new JTextField();
panel1 = new JPanel(); panel1 = new JPanel();
@@ -285,12 +311,31 @@ public class FlatSystemFileChooserWindowsTest
"[]" + "[]" +
"[]" + "[]" +
"[]" + "[]" +
"[]" +
"[grow,fill]")); "[grow,fill]"));
//---- ownerLabel ----
ownerLabel.setText("owner");
add(ownerLabel, "cell 0 0");
//---- ownerFrameRadioButton ----
ownerFrameRadioButton.setText("JFrame");
ownerFrameRadioButton.setSelected(true);
add(ownerFrameRadioButton, "cell 1 0");
//---- ownerDialogRadioButton ----
ownerDialogRadioButton.setText("JDialog");
add(ownerDialogRadioButton, "cell 1 0");
//---- ownerNullRadioButton ----
ownerNullRadioButton.setText("null");
add(ownerNullRadioButton, "cell 1 0");
add(ownerSpacer, "cell 1 0,growx");
//---- titleLabel ---- //---- titleLabel ----
titleLabel.setText("title"); titleLabel.setText("title");
add(titleLabel, "cell 0 0"); add(titleLabel, "cell 0 1");
add(titleField, "cell 1 0"); add(titleField, "cell 1 1");
//======== panel1 ======== //======== panel1 ========
{ {
@@ -402,46 +447,46 @@ public class FlatSystemFileChooserWindowsTest
hidePinnedPlacesCheckBox.setText("hidePinnedPlaces"); hidePinnedPlacesCheckBox.setText("hidePinnedPlaces");
panel1.add(hidePinnedPlacesCheckBox, "cell 1 7"); panel1.add(hidePinnedPlacesCheckBox, "cell 1 7");
} }
add(panel1, "cell 2 0 1 10,aligny top,growy 0"); add(panel1, "cell 2 1 1 10,aligny top,growy 0");
//---- okButtonLabelLabel ---- //---- okButtonLabelLabel ----
okButtonLabelLabel.setText("okButtonLabel"); okButtonLabelLabel.setText("okButtonLabel");
add(okButtonLabelLabel, "cell 0 1"); add(okButtonLabelLabel, "cell 0 2");
add(okButtonLabelField, "cell 1 1"); add(okButtonLabelField, "cell 1 2");
//---- fileNameLabelLabel ---- //---- fileNameLabelLabel ----
fileNameLabelLabel.setText("fileNameLabel"); fileNameLabelLabel.setText("fileNameLabel");
add(fileNameLabelLabel, "cell 0 2"); add(fileNameLabelLabel, "cell 0 3");
add(fileNameLabelField, "cell 1 2"); add(fileNameLabelField, "cell 1 3");
//---- fileNameLabel ---- //---- fileNameLabel ----
fileNameLabel.setText("fileName"); fileNameLabel.setText("fileName");
add(fileNameLabel, "cell 0 3"); add(fileNameLabel, "cell 0 4");
add(fileNameField, "cell 1 3"); add(fileNameField, "cell 1 4");
//---- folderLabel ---- //---- folderLabel ----
folderLabel.setText("folder"); folderLabel.setText("folder");
add(folderLabel, "cell 0 4"); add(folderLabel, "cell 0 5");
add(folderField, "cell 1 4"); add(folderField, "cell 1 5");
//---- saveAsItemLabel ---- //---- saveAsItemLabel ----
saveAsItemLabel.setText("saveAsItem"); saveAsItemLabel.setText("saveAsItem");
add(saveAsItemLabel, "cell 0 5"); add(saveAsItemLabel, "cell 0 6");
add(saveAsItemField, "cell 1 5"); add(saveAsItemField, "cell 1 6");
//---- defaultFolderLabel ---- //---- defaultFolderLabel ----
defaultFolderLabel.setText("defaultFolder"); defaultFolderLabel.setText("defaultFolder");
add(defaultFolderLabel, "cell 0 6"); add(defaultFolderLabel, "cell 0 7");
add(defaultFolderField, "cell 1 6"); add(defaultFolderField, "cell 1 7");
//---- defaultExtensionLabel ---- //---- defaultExtensionLabel ----
defaultExtensionLabel.setText("defaultExtension"); defaultExtensionLabel.setText("defaultExtension");
add(defaultExtensionLabel, "cell 0 7"); add(defaultExtensionLabel, "cell 0 8");
add(defaultExtensionField, "cell 1 7"); add(defaultExtensionField, "cell 1 8");
//---- fileTypesLabel ---- //---- fileTypesLabel ----
fileTypesLabel.setText("fileTypes"); fileTypesLabel.setText("fileTypes");
add(fileTypesLabel, "cell 0 8"); add(fileTypesLabel, "cell 0 9");
//---- fileTypesField ---- //---- fileTypesField ----
fileTypesField.setEditable(true); fileTypesField.setEditable(true);
@@ -451,11 +496,11 @@ public class FlatSystemFileChooserWindowsTest
"Text Files,*.txt,PDF Files,*.pdf,All Files,*.*", "Text Files,*.txt,PDF Files,*.pdf,All Files,*.*",
"Text and PDF Files,*.txt;*.pdf" "Text and PDF Files,*.txt;*.pdf"
})); }));
add(fileTypesField, "cell 1 8"); add(fileTypesField, "cell 1 9");
//---- fileTypeIndexLabel ---- //---- fileTypeIndexLabel ----
fileTypeIndexLabel.setText("fileTypeIndex"); fileTypeIndexLabel.setText("fileTypeIndex");
add(fileTypeIndexLabel, "cell 0 9"); add(fileTypeIndexLabel, "cell 0 10");
//---- fileTypeIndexSlider ---- //---- fileTypeIndexSlider ----
fileTypeIndexSlider.setMaximum(10); fileTypeIndexSlider.setMaximum(10);
@@ -463,27 +508,27 @@ public class FlatSystemFileChooserWindowsTest
fileTypeIndexSlider.setValue(0); fileTypeIndexSlider.setValue(0);
fileTypeIndexSlider.setPaintLabels(true); fileTypeIndexSlider.setPaintLabels(true);
fileTypeIndexSlider.setSnapToTicks(true); fileTypeIndexSlider.setSnapToTicks(true);
add(fileTypeIndexSlider, "cell 1 9"); add(fileTypeIndexSlider, "cell 1 10");
//---- openButton ---- //---- openButton ----
openButton.setText("Open..."); openButton.setText("Open...");
openButton.addActionListener(e -> open()); openButton.addActionListener(e -> open());
add(openButton, "cell 0 10 3 1"); add(openButton, "cell 0 11 3 1");
//---- saveButton ---- //---- saveButton ----
saveButton.setText("Save..."); saveButton.setText("Save...");
saveButton.addActionListener(e -> save()); saveButton.addActionListener(e -> save());
add(saveButton, "cell 0 10 3 1"); add(saveButton, "cell 0 11 3 1");
//---- openDirectButton ---- //---- openDirectButton ----
openDirectButton.setText("Open (no-thread)..."); openDirectButton.setText("Open (no-thread)...");
openDirectButton.addActionListener(e -> openDirect()); openDirectButton.addActionListener(e -> openDirect());
add(openDirectButton, "cell 0 10 3 1"); add(openDirectButton, "cell 0 11 3 1");
//---- saveDirectButton ---- //---- saveDirectButton ----
saveDirectButton.setText("Save (no-thread)..."); saveDirectButton.setText("Save (no-thread)...");
saveDirectButton.addActionListener(e -> saveDirect()); saveDirectButton.addActionListener(e -> saveDirect());
add(saveDirectButton, "cell 0 10 3 1"); add(saveDirectButton, "cell 0 11 3 1");
//======== filesScrollPane ======== //======== filesScrollPane ========
{ {
@@ -492,11 +537,22 @@ public class FlatSystemFileChooserWindowsTest
filesField.setRows(8); filesField.setRows(8);
filesScrollPane.setViewportView(filesField); filesScrollPane.setViewportView(filesField);
} }
add(filesScrollPane, "cell 0 11 3 1,growx"); add(filesScrollPane, "cell 0 12 3 1,growx");
//---- ownerButtonGroup ----
ButtonGroup ownerButtonGroup = new ButtonGroup();
ownerButtonGroup.add(ownerFrameRadioButton);
ownerButtonGroup.add(ownerDialogRadioButton);
ownerButtonGroup.add(ownerNullRadioButton);
// JFormDesigner - End of component initialization //GEN-END:initComponents // JFormDesigner - End of component initialization //GEN-END:initComponents
} }
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
private JLabel ownerLabel;
private JRadioButton ownerFrameRadioButton;
private JRadioButton ownerDialogRadioButton;
private JRadioButton ownerNullRadioButton;
private JPanel ownerSpacer;
private JLabel titleLabel; private JLabel titleLabel;
private JTextField titleField; private JTextField titleField;
private JPanel panel1; private JPanel panel1;

View File

@@ -6,19 +6,52 @@ new FormModel {
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "ltr,insets dialog,hidemode 3" "$layoutConstraints": "ltr,insets dialog,hidemode 3"
"$columnConstraints": "[left][grow,fill][fill]" "$columnConstraints": "[left][grow,fill][fill]"
"$rowConstraints": "[][][][][][][][][][][][grow,fill]" "$rowConstraints": "[][][][][][][][][][][][][grow,fill]"
} ) { } ) {
name: "this" name: "this"
add( new FormComponent( "javax.swing.JLabel" ) {
name: "ownerLabel"
"text": "owner"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0"
} )
add( new FormComponent( "javax.swing.JRadioButton" ) {
name: "ownerFrameRadioButton"
"text": "JFrame"
"selected": true
"$buttonGroup": new FormReference( "ownerButtonGroup" )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 0"
} )
add( new FormComponent( "javax.swing.JRadioButton" ) {
name: "ownerDialogRadioButton"
"text": "JDialog"
"$buttonGroup": new FormReference( "ownerButtonGroup" )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 0"
} )
add( new FormComponent( "javax.swing.JRadioButton" ) {
name: "ownerNullRadioButton"
"text": "null"
"$buttonGroup": new FormReference( "ownerButtonGroup" )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 0"
} )
add( new FormComponent( "com.jformdesigner.designer.wrapper.HSpacer" ) {
name: "ownerSpacer"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 0,growx"
} )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "titleLabel" name: "titleLabel"
"text": "title" "text": "title"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0" "value": "cell 0 1"
} ) } )
add( new FormComponent( "javax.swing.JTextField" ) { add( new FormComponent( "javax.swing.JTextField" ) {
name: "titleField" name: "titleField"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 0" "value": "cell 1 1"
} ) } )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets 2,hidemode 3" "$layoutConstraints": "insets 2,hidemode 3"
@@ -165,90 +198,90 @@ new FormModel {
"value": "cell 1 7" "value": "cell 1 7"
} ) } )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 0 1 10,aligny top,growy 0" "value": "cell 2 1 1 10,aligny top,growy 0"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "okButtonLabelLabel" name: "okButtonLabelLabel"
"text": "okButtonLabel" "text": "okButtonLabel"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 1" "value": "cell 0 2"
} ) } )
add( new FormComponent( "javax.swing.JTextField" ) { add( new FormComponent( "javax.swing.JTextField" ) {
name: "okButtonLabelField" name: "okButtonLabelField"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 1" "value": "cell 1 2"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "fileNameLabelLabel" name: "fileNameLabelLabel"
"text": "fileNameLabel" "text": "fileNameLabel"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 2" "value": "cell 0 3"
} ) } )
add( new FormComponent( "javax.swing.JTextField" ) { add( new FormComponent( "javax.swing.JTextField" ) {
name: "fileNameLabelField" name: "fileNameLabelField"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 2" "value": "cell 1 3"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "fileNameLabel" name: "fileNameLabel"
"text": "fileName" "text": "fileName"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 3" "value": "cell 0 4"
} ) } )
add( new FormComponent( "javax.swing.JTextField" ) { add( new FormComponent( "javax.swing.JTextField" ) {
name: "fileNameField" name: "fileNameField"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 3" "value": "cell 1 4"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "folderLabel" name: "folderLabel"
"text": "folder" "text": "folder"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 4" "value": "cell 0 5"
} ) } )
add( new FormComponent( "javax.swing.JTextField" ) { add( new FormComponent( "javax.swing.JTextField" ) {
name: "folderField" name: "folderField"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 4" "value": "cell 1 5"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "saveAsItemLabel" name: "saveAsItemLabel"
"text": "saveAsItem" "text": "saveAsItem"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 5" "value": "cell 0 6"
} ) } )
add( new FormComponent( "javax.swing.JTextField" ) { add( new FormComponent( "javax.swing.JTextField" ) {
name: "saveAsItemField" name: "saveAsItemField"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 5" "value": "cell 1 6"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "defaultFolderLabel" name: "defaultFolderLabel"
"text": "defaultFolder" "text": "defaultFolder"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 6" "value": "cell 0 7"
} ) } )
add( new FormComponent( "javax.swing.JTextField" ) { add( new FormComponent( "javax.swing.JTextField" ) {
name: "defaultFolderField" name: "defaultFolderField"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 6" "value": "cell 1 7"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "defaultExtensionLabel" name: "defaultExtensionLabel"
"text": "defaultExtension" "text": "defaultExtension"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 7" "value": "cell 0 8"
} ) } )
add( new FormComponent( "javax.swing.JTextField" ) { add( new FormComponent( "javax.swing.JTextField" ) {
name: "defaultExtensionField" name: "defaultExtensionField"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 7" "value": "cell 1 8"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "fileTypesLabel" name: "fileTypesLabel"
"text": "fileTypes" "text": "fileTypes"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 8" "value": "cell 0 9"
} ) } )
add( new FormComponent( "javax.swing.JComboBox" ) { add( new FormComponent( "javax.swing.JComboBox" ) {
name: "fileTypesField" name: "fileTypesField"
@@ -261,13 +294,13 @@ new FormModel {
addElement( "Text and PDF Files,*.txt;*.pdf" ) addElement( "Text and PDF Files,*.txt;*.pdf" )
} }
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 8" "value": "cell 1 9"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "fileTypeIndexLabel" name: "fileTypeIndexLabel"
"text": "fileTypeIndex" "text": "fileTypeIndex"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 9" "value": "cell 0 10"
} ) } )
add( new FormComponent( "javax.swing.JSlider" ) { add( new FormComponent( "javax.swing.JSlider" ) {
name: "fileTypeIndexSlider" name: "fileTypeIndexSlider"
@@ -277,35 +310,35 @@ new FormModel {
"paintLabels": true "paintLabels": true
"snapToTicks": true "snapToTicks": true
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 9" "value": "cell 1 10"
} ) } )
add( new FormComponent( "javax.swing.JButton" ) { add( new FormComponent( "javax.swing.JButton" ) {
name: "openButton" name: "openButton"
"text": "Open..." "text": "Open..."
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "open", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "open", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 10 3 1" "value": "cell 0 11 3 1"
} ) } )
add( new FormComponent( "javax.swing.JButton" ) { add( new FormComponent( "javax.swing.JButton" ) {
name: "saveButton" name: "saveButton"
"text": "Save..." "text": "Save..."
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "save", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "save", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 10 3 1" "value": "cell 0 11 3 1"
} ) } )
add( new FormComponent( "javax.swing.JButton" ) { add( new FormComponent( "javax.swing.JButton" ) {
name: "openDirectButton" name: "openDirectButton"
"text": "Open (no-thread)..." "text": "Open (no-thread)..."
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "openDirect", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "openDirect", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 10 3 1" "value": "cell 0 11 3 1"
} ) } )
add( new FormComponent( "javax.swing.JButton" ) { add( new FormComponent( "javax.swing.JButton" ) {
name: "saveDirectButton" name: "saveDirectButton"
"text": "Save (no-thread)..." "text": "Save (no-thread)..."
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "saveDirect", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "saveDirect", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 10 3 1" "value": "cell 0 11 3 1"
} ) } )
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
name: "filesScrollPane" name: "filesScrollPane"
@@ -314,11 +347,16 @@ new FormModel {
"rows": 8 "rows": 8
} ) } )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 11 3 1,growx" "value": "cell 0 12 3 1,growx"
} ) } )
}, new FormLayoutConstraints( null ) { }, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 ) "location": new java.awt.Point( 0, 0 )
"size": new java.awt.Dimension( 690, 630 ) "size": new java.awt.Dimension( 845, 630 )
} )
add( new FormNonVisual( "javax.swing.ButtonGroup" ) {
name: "ownerButtonGroup"
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 640 )
} ) } )
} }
} }