swing - Contentpanes not working in java -
I can reply early tomorrow (I'm really tired)
did this Was:
This line of code is giving me an error:
win1.getContentPane (). Add (empty label, BorderLayout.CENTER); I have problems with this part:
Empty label This throws an error and it To change win1, which does not show an error, but throws it
Full class:
package examplepackage; // import import java.awt.borderLayout; Import javax.swing.ImageIcon; Import javax.swing.JFrame; Import examplepackage.location.GetFilepath; Public category starter {public static zero main (string [] args) {GetFilepath FP = New GetFilepath (); Jeffram Win 1 = New Jeffram ("Example Window"); win1.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); Win1.getContentPane (). Add (empty label, BorderLayout.CENTER); Win1.pack (); Win1.setSize (600, 800); Win1.setVisible (true); Win1.setLocationRelativeTo (win1); win1.setIconImage (new IMP (FP + "\\ window \\ main"). getImage ()); }}
Then, by example, GetFilePath , Because I do not have access to that source when I compile my code. I ... Error: The symbol can not get win1.getContentPane (). Add (emptyLabel, Border Layout, CA); ^ Symbol: Variable blank label space: class starter originally defined as empty label . It is possible that your IDE is looking for a matching value that can be sent to the law parameter, again depending on the code, which leaves win1 , which clearly works (You can add something in your own or add a window based component to container ) What you need to do and Make an example of some component, such as JLabel , for example ... JLabel empty label = new j Alab (); Win1.getContentPane (). Add (empty label, BorderLayout.CENTER); I also suggest that you have read and make sure that you are starting your UI in the context of the event dispatching thread
Comments
Post a Comment