Java form custom JFrame class

From , 5 Years ago, written in Java, viewed 241 times.
URL https://pastebin.vip/view/7c590f01
  1. import javax.swing.*;
  2.  
  3. import java.util.concurrent.*;
  4.  
  5. public class SubmitSwingProgram extends JFrame {
  6.  
  7.     JLabel label;
  8.  
  9.     public SubmitSwingProgram() {
  10.  
  11.         super("Hello Swing");
  12.  
  13.         label = new JLabel("A Label");
  14.  
  15.         add(label);
  16.  
  17.         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  18.  
  19.         setSize(300, 100);
  20.  
  21.         setVisible(true);
  22.  
  23.     }
  24.  
  25.     static SubmitSwingProgram ssp;
  26.  
  27.     public static void main(String[] args) throws Exception
  28.  
  29.     {
  30.  
  31.         SwingUtilities.invokeLater(new Runnable() {
  32.  
  33.             public void run() {
  34.                 ssp = new SubmitSwingProgram();
  35.             }
  36.  
  37.         });
  38.  
  39.         TimeUnit.SECONDS.sleep(1);
  40.  
  41.         SwingUtilities.invokeLater(new Runnable() {
  42.  
  43.             public void run() {
  44.  
  45.                 ssp.label.setText("Hey! This is Different!");
  46.  
  47.             }
  48.  
  49.         });
  50.  
  51.     }
  52.  
  53. }

Reply to "Java form custom JFrame class"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website