java - GUI doesn't display the background i set for it(compiles) -
I am trying to create a GUI to make a game, this game is irrelevant.
According to me, what I should do is show me a GUI, with one frame, however, only shows the frame, the image is not found anywhere: (
Does anyone tell me Could I have done wrong? Thank you for your time! This example shows you the correct order in which you want to perform operations . In addition, the SwingUtilities.invokeLater () method should start a swing application. It uses EDT, which you can read, another note is that you set the size of the frame, but when it shows that it is too small, the reason is that you have created the
frame.pack ( ) , which will ensure that only the location you really need is used.
import java.awt.BorderLayout; Import javax.swing.JFrame; Import javax.swing.JLabel; Import javax.swing.JPanel; Public class graph {JFrame frame; Public Graph () {frames = new JFrame ("My Applications"); Frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); Frame.setSize (1366770); Frame.setLocationRelativeTo (zero); JAlabelLabel = New JLab ("Some Labels"); Jpegel panel = new zpinal (new border layout ()); Panel.ed (label, border layout.ca); frame.add (panel, BorderLayout.CENTER); Frame.pack (); Frame.setVisible (true); } Public static zero major (string algos []) {SwingUtilities.invokeLater (new runall) {@Override Public run zero () {GraphG = new graph ();}}); }}
Comments
Post a Comment