Pack « Layout « Java Swing Q&A





1. How do I use CMFCRebar to produce an acceptable look and feel?    stackoverflow.com

I am trying to use some classes from the MFC Feature Pack to improve the look & feel of my MFC application. In my application, I use one CReBar object to dock ...

2. Equivalent of Swing's pack in C#    stackoverflow.com

I am developing a quick app in C#. One thing that I want to do is the equivalent of Swing's (java) pack(). This is a call that allows me to ...

3. Swing GUI components too tighly packed    stackoverflow.com

In the Java Swing app I made it seems to me that all the component are too tightly packed. In QT one can specify padding and margins for the layout. Is there something ...

4. Java JFrame pack() issue    stackoverflow.com

I am attempting to overlay images on top of a background image using the standard java utilities. See the pictures below... I have code that seems to create the background image (can ...

5. Java JFrame method pack() problem    stackoverflow.com

I have a frame with 4 JPanels and 1 JScrollPane, the 4 panels are in border layout north, east, south, west and the scrollpane in the center. I have been trying to ...

6. Java Pack No Resize    stackoverflow.com

i am learning Java at the moment and have the following question: i am adding my controls to JFrame and then pack() before displaying. this runs the application and all is very nice. i ...

7. How can I "pack()" a printable Java Swing component?    stackoverflow.com

I have implemented a Java Swing component that implements Printable. If I add the component to a JFrame, and do this.pack(); on the JFrame, it prints perfect. But if I don't ...

8. Passing ActionListeners in Java, pack()    stackoverflow.com

Two questions. First question is I'm trying to create a simple form that when you press a button, it adds a Person object to the ArrayList. However, since I ...

9. Question to pack() method    stackoverflow.com

I'm building a GUI application, and within a JFrame i have 2 jcombobox's and a JPanel to view certain data. Now when i call the pack() methode in the main class ...





10. How to make installer pack of Java swing Application Project?    stackoverflow.com

I've created a java project using swing application with JMF. I've tried to convert it into package but it failed. The jar can be created but it won't work in other computer ...

11. SWT Composite needs pack() in 3.6.1    stackoverflow.com

My wizard isn't rendering correctly in Eclipse 3.6.1. It's leading me to wonder: when does one have to use Composite.pack()? Some SWT examples have it, and some don't. How my wizard pages ...

12. How to layout two JSplitPanes with evenly placed dividers when using JFrame.pack()    stackoverflow.com

This code should produce a frame with 2 vertical split panes that should initialise so that the dividers are evenly placed. However, this only works if the frame size is fixed. It seems this ...

13. JFrame's position and pack() in Awesome WM    stackoverflow.com

every time when I call pack() method on JFrame, it moves to the initial position where was when started. When I try to get the location of the JFrame (getLocation, getLocationOnScreen) ...

14. How do I save my JScrollPane position after I do a JFrame.pack()?    stackoverflow.com

I have the following code:

JFrame frame = new JFrame();
JScrollPane scrollPane = new JScrollPane(new panel(with stuff in it));
frame.getContentPane().add(scrollPane);
So the user scrolls a bit and then clicks a link on my panel and ...

15. setSize() v/s setPreferredSize() and pack()    stackoverflow.com

I am not clear about what is the difference between setSize() and setPreferredSize(). what would happen if i use setSize() instead of setPreferredSize().


And what exactly does pack() method do ?

16. Pack, but don't make it smaller    stackoverflow.com

I have JFrame with GridBagLayout. User can resize this window. Also, he can perform some editing actions that change window size. I use pack(); repaint(); now after such actions. But, actually ...





17. Java Swing pack() on a Window un-maximizes it, how to avoid that?    stackoverflow.com

I've a window and since I dinamically change it's children (sometimes I swap JPanels), I found no other solution than calling pack() on the window to get the new element displayed. ...

18. How to make my JComponent conform to JFrame.pack and Layout Managers?    stackoverflow.com

I made a JComponent that displays a rectangle of a specified color. (Haven't found any other way to achieve this effect). Problem is, it doesn't follow JFrame.pack() and Layout Managers as ...

19. JFrame cannot find 'pack' method    stackoverflow.com

I'm taking a beginning Java class and an assignment requires that I write a class to represent a JPanel with buttons to increment and decrement a value and a label to ...

21. Forcing pack in mouse click event    coderanch.com

I have a sqlj file that selects about 40 different counts on tables and views and calls several different stored procedures. I also have a JFrame that has a textField for each count I need to do. When I hit the go button, I call these different methods and assign the count to the proper text field. My problem is that ...

22. Issue with setSize() and pack()    coderanch.com

I'm very new to JAVA... I just wrote an applet whose init method is as follows: public void init() { f = new Frame("INIT"); f.setSize(400,400); f.add(this); // this is to add frame to applet.... f.pack(); f.show(); } When I load this applet in browser or I call init() from main() to just run this program from command prompt mode, the frame ...

24. pack() method in JFrame    coderanch.com

25. Looking for an easy to use and full UI pack    coderanch.com

Hi Scott, Thanks for the prompt reply. Swing is nice. The only matter I'm looking to LwVCL is that it has (like they state, at least) transparent support for J2SE and J2ME (as well as .NET, but actually I don't know why I may need it for). And they are free as well. Does it make any sense? BTW there are ...

26. pack() method    coderanch.com

27. Scroll bar does not retain its position after or before pack    coderanch.com

Hi My Scroll bar does not retain its position after pack in my application. But i need to retain its state. My code snippet is : System.out.println("VAlue--->" + getHXValue()); scrollPane.getHorizontalScrollBar().setValue(getHXValue()); pack(); My VAlue printed is 100. But my positon of scroll bar is at 0 th location. Can any one help me.....

28. What is the use of Jframe.pack()?    coderanch.com

29. SWT table.pack()    coderanch.com

I am trying to create a table object with two columns. The table should be flexible in width, based on the width of the contents of it. I do this using column.pack() and table.pack(). However, the table never "really" packs, there is always some space right to the second column. Also there is some space below the lowest table item, about ...

30. Using frame.pack() for resizing JFrame    java-forums.org

Hi! The problem is connected with using frame.pack(). So, let's say there is JFrame: frame. Depending on the option selected from JComboBox, the content and size of JFrame should change. Everything works perfectly in NetBeans (!!!). However, if I try to run the JAR file outside of NetBenas, then the size of JFrame does not change after selecting different options from ...

31. Two calls to JFrame.pack() required to get desired effect?    java-forums.org

public class TestFrame extends JFrame { private JEditorPane editorPane; public TestFrame() { initialise(); } private void initialise() { Container contentPane = this.getContentPane(); editorPane = new JEditorPane(); editorPane.setContentType("text/html"); contentPane.add(editorPane); this.setVisible(true); this.setDefaultCloseOperation(HIDE_ON_CLOSE); } public void loadResourcePage(String resourcePage) { InputStream input = this.getClass().getResourceAsStream(resourcePage); BufferedReader reader = new BufferedReader(new InputStreamReader(input)); StringBuffer buffer = new StringBuffer(); String line, newLineStr; newLineStr = System.getProperty("line.separator"); try { while ((line ...

32. Fullscreen Games + A JFrame.pack question    forums.oracle.com

Hi, I would like to know where to find resources on the basics of creating Java Games, especially the fullscreen and the buffer parts. And since I'm here, I'd also like to ask something: Doesn't JFrame.pack consider the size of Canvas components? What is the simplest way to set the size of the content part of a JFrame? (JFrame.setSize counts title ...

33. JFrame pack problem    forums.oracle.com

Hi, I have a problem with the method pack on a jframe. I call some methods in this order: this.setUndecorated(true); this.setContentPane(getJPanelMain()); this.setResizable(false); this.setTitle(getFrameTitle()); this.pack(); this.setLocationRelativeTo(null); The application sometimes "hangs" on the pack call, with logging between these rows I see that this is how far I come before it stops. This happens roughly half of the times I try to start, ...

34. JPanel pack () method    forums.oracle.com