-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GUI updates for launching / joining networks
- Loading branch information
Showing
5 changed files
with
92 additions
and
15 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
convex-gui/src/main/java/convex/gui/components/FilePicker.java
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,44 @@ | ||
package convex.gui.components; | ||
|
||
import java.awt.event.ActionEvent; | ||
|
||
import javax.swing.JButton; | ||
import javax.swing.JFileChooser; | ||
import javax.swing.JPanel; | ||
import javax.swing.JTextField; | ||
|
||
import net.miginfocom.swing.MigLayout; | ||
|
||
@SuppressWarnings("serial") | ||
public class FilePicker extends JPanel { | ||
|
||
private String fileName; | ||
|
||
private JTextField fileField; | ||
private JButton button; | ||
|
||
private JFileChooser fileChooser; | ||
|
||
|
||
public FilePicker(String filename) { | ||
this.fileName=filename; | ||
|
||
this.fileChooser=new JFileChooser(); | ||
|
||
setLayout(new MigLayout()); | ||
|
||
fileField=new JTextField(fileName); | ||
add(fileField); | ||
|
||
button=new JButton("..."); | ||
button.addActionListener(this::selectFile); | ||
add(button); | ||
} | ||
|
||
public void selectFile(ActionEvent e) { | ||
int selected=fileChooser.showDialog(this, "Select"); | ||
if (selected==JFileChooser.APPROVE_OPTION) { | ||
fileField.setText(fileChooser.getSelectedFile().getAbsolutePath()); | ||
} | ||
} | ||
} |
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
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