0

Frame (GUI) demo from java for those looking.

package components; import java.awt.*; import java.awt.event.*; import javax.swing.*; /* FrameDemo.java requires no other files. */ public class FrameDemo { /** * Create the GUI and show it. For thread safety, * this method should be invoked from the * event-dispatching thread. */ private static void createAndShowGUI() { //Create and set up the window. JFrame frame = new JFrame("FrameDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel emptyLabel = new JLabel(""); emptyLabel.setPreferredSize(new Dimension(175, 100)); frame.getContentPane().add(emptyLabel, BorderLayout.CENTER); //Display the window. frame.pack(); frame.setVisible(true); } public static void main(String[] args) { //Schedule a job for the event-dispatching thread: //creating and showing this application's GUI. javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } }

6th Dec 2018, 3:36 PM
Luis Rosado
Luis Rosado - avatar
5 Answers
+ 4
Luis Rosado Ok, but Q/A section is only for coding/SL practical problems.. You can use your feed section for this. See here https://www.sololearn.com/discuss/1316935/ Happy coding 👍👍👍
6th Dec 2018, 3:45 PM
KrOW
KrOW - avatar
+ 3
👍👍👍👍
6th Dec 2018, 3:47 PM
KrOW
KrOW - avatar
+ 2
What is the question?
6th Dec 2018, 3:39 PM
KrOW
KrOW - avatar
+ 1
will do thank you. i
6th Dec 2018, 3:47 PM
Luis Rosado
Luis Rosado - avatar
0
not a question i was looking for a platform to place a snippet of code i found, iv been looking for a frame code and i found one. just wanted to share. :)
6th Dec 2018, 3:41 PM
Luis Rosado
Luis Rosado - avatar