swing - Window not wanting to run on something that should run in java -


I am working on a program with a friend and do not want to walk because there is only one item error in the program, Window, and this does not show an error or a fix to it.

This is my dirst time on the stack overflow

code:

  package example package; // Import Import java.awt.FlowLayout; Import javax.swing.ImageIcon; Import javax.swing.JFrame; Import examplepackage.GetFilepath; Public category starter {public static zero main (string [] args) {GetFilepath FP = New GetFilepath (); Jeffram Win 1 = New Geoffram ("Windnam"); win1.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); Win1.getContentPane (). Add (Win1, FlowLayout.LEFT, FlowLayout.LEADING); Win1.pack (); Win1.setVisible (true); Win1.setLocationRelativeTo (win1); win1.setIconImage (new IMP (FP + "\\ window \\ main"). getImage ()); }}    

this line:

  win1 getContentPane (). Add (Win1, FlowLayout.LEFT, FlowLayout.LEADING);   

It does not make sense that you are trying to add a component to yourself (??) that can not be done, should not be done, and it looks a bit strange , And even after you are passing in the FlowLayout constant, a addition (...) is not included in the method. There is no connection to the whole thing so get rid of it. It makes me wonder - what are you trying to achieve from this line?


Edit
Your comment shows a link on this tutorial page:

In the page, it shows this code:

  frame.get contentpane (). Add (empty label, border layout .ca);   

Anything that does not look like you line in the BorderLayout.CENTER position adds a JLable to the content of JFrame on the page. This makes sense because the content page uses border layouts by default, and since you are trying to add a component, the JLabel on Jeff's content page. You are trying to add your Jeffraem to your content page on the other side and by doing so, it can never be done using the floatable constants. I'm not sure how you got your code from this recommendation. It still prepares my brain.


Edit 2
Note that the flowout constant is used, but as you are not using them, you use them when creating a floating object , Where you want to specify the status of the layout. For example:

  Flow layout myFlowLayout = New Flow layout (Flow layout. LEFT); JP Penal MyPanel = New Zipel (MyFlow Layout);   

Or similar but more concise code that does the same thing:

  JP Penal MyPlanel = new zpinal (new flow layout (flow layout. LEFT)) ;   

While doing so, you can never add the flow layout. LEFT and Flow layout. On the same line on the line together and you will never use them when adding the container of any flowout-container (or any layout using).

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -