forked from LupusNobilis/java-org.hwo.ui
SerialPortChooser.execute(...) added parent Component parameter
parent
a14c4bcc45
commit
85c05155bd
|
@ -1,6 +1,7 @@
|
||||||
package org.hwo.ui.dialog;
|
package org.hwo.ui.dialog;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Component;
|
||||||
import java.awt.FlowLayout;
|
import java.awt.FlowLayout;
|
||||||
|
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
|
@ -33,12 +34,19 @@ public class SerialPortChooser extends JDialog {
|
||||||
return execute(null);
|
return execute(null);
|
||||||
}
|
}
|
||||||
public static NewSerialPort execute(String selectedPortName)
|
public static NewSerialPort execute(String selectedPortName)
|
||||||
|
{
|
||||||
|
return execute(null, selectedPortName);
|
||||||
|
}
|
||||||
|
public static NewSerialPort execute(Component parent,String selectedPortName)
|
||||||
{
|
{
|
||||||
SerialPortChooser spc = new SerialPortChooser();
|
SerialPortChooser spc = new SerialPortChooser();
|
||||||
|
|
||||||
if (selectedPortName != null)
|
if (selectedPortName != null)
|
||||||
spc.setSelectedSerialPort(selectedPortName);
|
spc.setSelectedSerialPort(selectedPortName);
|
||||||
|
|
||||||
|
if (parent != null)
|
||||||
|
spc.setLocationRelativeTo(parent);
|
||||||
|
|
||||||
spc.setVisible(true);
|
spc.setVisible(true);
|
||||||
|
|
||||||
return spc.getSelectedSerialPort();
|
return spc.getSelectedSerialPort();
|
||||||
|
|
Loading…
Reference in New Issue