[Solved] How do I make my java program run in the background? [closed]

Look ma, no windows here, just us teddies… public class TestTrayIcon01 { public static void main(String[] args) { new TestTrayIcon01(); } public TestTrayIcon01() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { TrayIcon icon = new TrayIcon(ImageIO.read(getClass().getResource(“/SmallTeddy.png”))); SystemTray tray = SystemTray.getSystemTray(); tray.add(icon); } catch (Exception ex) { ex.printStackTrace(); } JDialog dialog = new … Read more

[Solved] Trying to add an event listener to a JTextField

Since you edited the question and clarified that you are using a JTextField I will reorder the answer: You don’t see any output because the action command has not been set so there is nothing to display. Try using the following in your ActionListener: JTextField textField = (JTextField)e.getSource(); System.out.println( textField.getText() ); Of course this will … Read more