-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
205 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="gui.PreferencesDialog"> | ||
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> | ||
<margin top="10" left="10" bottom="10" right="10"/> | ||
<constraints> | ||
<xy x="48" y="54" width="436" height="297"/> | ||
</constraints> | ||
<properties/> | ||
<border type="none"/> | ||
<children> | ||
<grid id="94766" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> | ||
<margin top="0" left="0" bottom="0" right="0"/> | ||
<constraints> | ||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
<properties/> | ||
<border type="none"/> | ||
<children> | ||
<hspacer id="98af6"> | ||
<constraints> | ||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
</hspacer> | ||
<grid id="9538f" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="true" same-size-vertically="false" hgap="-1" vgap="-1"> | ||
<margin top="0" left="0" bottom="0" right="0"/> | ||
<constraints> | ||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
<properties/> | ||
<border type="none"/> | ||
<children> | ||
<component id="e7465" class="javax.swing.JButton" binding="buttonOK"> | ||
<constraints> | ||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
<properties> | ||
<text value="OK"/> | ||
</properties> | ||
</component> | ||
<component id="5723f" class="javax.swing.JButton" binding="buttonCancel"> | ||
<constraints> | ||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
<properties> | ||
<text value="Cancel"/> | ||
</properties> | ||
</component> | ||
</children> | ||
</grid> | ||
</children> | ||
</grid> | ||
<grid id="e3588" layout-manager="GridLayoutManager" row-count="2" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> | ||
<margin top="0" left="0" bottom="0" right="0"/> | ||
<constraints> | ||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
<properties/> | ||
<border type="none"/> | ||
<children> | ||
<component id="304b7" class="javax.swing.JLabel"> | ||
<constraints> | ||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
<properties> | ||
<text value="Plik wykonywalny NgSpice:"/> | ||
</properties> | ||
</component> | ||
<hspacer id="f93e1"> | ||
<constraints> | ||
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
</hspacer> | ||
<vspacer id="3d3d8"> | ||
<constraints> | ||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
</vspacer> | ||
<component id="e6c91" class="javax.swing.JTextField" binding="txtNgSpiceExe"> | ||
<constraints> | ||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"> | ||
<preferred-size width="150" height="-1"/> | ||
</grid> | ||
</constraints> | ||
<properties/> | ||
</component> | ||
<component id="6197c" class="javax.swing.JButton" binding="cmdNgSpiceExe"> | ||
<constraints> | ||
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
<properties> | ||
<text value="..."/> | ||
</properties> | ||
</component> | ||
</children> | ||
</grid> | ||
</children> | ||
</grid> | ||
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package gui; | ||
|
||
import javax.swing.*; | ||
import javax.swing.filechooser.FileNameExtensionFilter; | ||
import java.awt.event.*; | ||
|
||
public class PreferencesDialog extends JDialog { | ||
private JPanel contentPane; | ||
private JButton buttonOK; | ||
private JButton buttonCancel; | ||
private JTextField txtNgSpiceExe; | ||
private JButton cmdNgSpiceExe; | ||
|
||
public PreferencesDialog() { | ||
setContentPane(contentPane); | ||
setModal(true); | ||
getRootPane().setDefaultButton(buttonOK); | ||
|
||
buttonOK.addActionListener(new ActionListener() { | ||
public void actionPerformed(ActionEvent e) { | ||
onOK(); | ||
} | ||
}); | ||
|
||
buttonCancel.addActionListener(new ActionListener() { | ||
public void actionPerformed(ActionEvent e) { | ||
onCancel(); | ||
} | ||
}); | ||
|
||
// call onCancel() when cross is clicked | ||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); | ||
addWindowListener(new WindowAdapter() { | ||
public void windowClosing(WindowEvent e) { | ||
onCancel(); | ||
} | ||
}); | ||
|
||
// call onCancel() on ESCAPE | ||
contentPane.registerKeyboardAction(new ActionListener() { | ||
public void actionPerformed(ActionEvent e) { | ||
onCancel(); | ||
} | ||
}, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); | ||
cmdNgSpiceExe.addActionListener(new ActionListener() { | ||
@Override | ||
public void actionPerformed(ActionEvent actionEvent) { | ||
JFileChooser fc = new JFileChooser(); | ||
fc.addChoosableFileFilter(new FileNameExtensionFilter("NgSpice executable (*.exe)", "exe")); | ||
if (fc.showOpenDialog(PreferencesDialog.this) == JFileChooser.APPROVE_OPTION) { | ||
txtNgSpiceExe.setText( fc.getSelectedFile().getAbsolutePath() ); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
private void onOK() { | ||
// add your code here | ||
dispose(); | ||
} | ||
|
||
private void onCancel() { | ||
// add your code here if necessary | ||
dispose(); | ||
} | ||
} |