I'm trying to stop JPN to make it so small that it closes subcomponents, does it apply Is there anyway to do? After reading, I tried (in jaundh):
frame = Jeffram ('example', size = (200,200)) pan = JPNL () pan.ed (JLab ('beer') ) Pan .add (Get the 'one', methodology = printer) penset minimum size (panel.getPreferredSize ()) frame.add (pan) frame.visible = True Although the panel can still be shrunk, it is cut into its components (Jeffam), even if I apply the minimum size to the frame, how does it stop? (I think the preferred size is what I do not want, which I want with the default layout manager, it seems to be the largest sub-editor, but if I change it like GridBagLayout Feel small to frame 9apply minsize and try)
You can use it on your JFrame ( Sorry java, i'm not familiar with jethon):
frame Set minimum (frame. Jetprincess ()); If your code applies to JFrame the layout manager of the content pane, your code could work. However, by default, you get a border layout which is not if you used the frame. The problem is the minimum size (pan.getpropher size ()); , this will not work because its intestines (ie frame size size) in the size of the frame import javax.swing.JButton; This is a small demo that shows how you can do the minimum size work on the JFRAM:
import javax.swing.JButton; Import javax.swing.JFrame; Import javax.swing.JLabel; Import javax.swing.JPanel; Import javax.swing.SwingUtilities; Public class testimonialsonframe {secure zero initue () {gefrem frame = new jefram ("example"); Frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); Frame.setSize (200, 200); Jepnell pan = new zpn (); Pan.Ed. (New JLABEL ("Some Good Beer")); Pan add (new pocket ("unite")); Frame.add (pan); Frame.setVisible (true); Frame.setMinimumSize (frame.getPreferredSize ()); } Public Static Zero Main (string [] Args) {SwingUtilities.invokeLater (New Runnabal) {@Override Public Zero Run () {New TestMinimumSizeOnFrame (). InitUI ();}}); }}
Comments
Post a Comment