SerialPortChooser.execute(...) added parent Component parameter

thobaben_diagram
Harald Wolff 2016-11-25 08:28:43 +01:00
parent a14c4bcc45
commit 85c05155bd
1 changed files with 8 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package org.hwo.ui.dialog;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.FlowLayout;
import javax.swing.JButton;
@ -33,12 +34,19 @@ public class SerialPortChooser extends JDialog {
return execute(null);
}
public static NewSerialPort execute(String selectedPortName)
{
return execute(null, selectedPortName);
}
public static NewSerialPort execute(Component parent,String selectedPortName)
{
SerialPortChooser spc = new SerialPortChooser();
if (selectedPortName != null)
spc.setSelectedSerialPort(selectedPortName);
if (parent != null)
spc.setLocationRelativeTo(parent);
spc.setVisible(true);
return spc.getSelectedSerialPort();