From aec11addb26ab6285b3c3c4d34f4f10a9f0c5c3e Mon Sep 17 00:00:00 2001 From: s441433 Date: Sat, 12 Jan 2019 15:24:55 +0100 Subject: [PATCH] Update StolowkaZPM.java --- apka_StolowkaZPM/src/StolowkaZPM.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/apka_StolowkaZPM/src/StolowkaZPM.java b/apka_StolowkaZPM/src/StolowkaZPM.java index 9da960d..a3e4e17 100644 --- a/apka_StolowkaZPM/src/StolowkaZPM.java +++ b/apka_StolowkaZPM/src/StolowkaZPM.java @@ -6,17 +6,17 @@ import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JPasswordField; import javax.swing.JTextField; - import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.awt.*; import javax.swing.SwingConstants; - - import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import javax.swing.ImageIcon; +import gnu.io.CommPortIdentifier; +import java.util.Enumeration; + public class StolowkaZPM { @@ -25,11 +25,20 @@ public class StolowkaZPM { protected String Dalej; protected String imie; protected static int IDuzytkownika; - + + public void list() { + @SuppressWarnings("rawtypes") + Enumeration ports = CommPortIdentifier.getPortIdentifiers(); + + while(ports.hasMoreElements()) + System.out.println(((CommPortIdentifier)ports.nextElement()).getName()); + } + /** * Launch the application. */ public static void main(String[] args) { + new StolowkaZPM().list(); EventQueue.invokeLater(new Runnable() { public void run() { try {