Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to Remove white space in a JFrame
    primarykey
    data
    text
    <p>I am developing a GUI in Java. I have several questions that I am looking to get help with, hope fully some of you can help.</p> <p>You might need the below image:</p> <p><img src="https://i.stack.imgur.com/LzNmt.png" alt="enter image description here"></p> <p>1.. The space between entry's: I want it removed. Right now, each entry is a JPanel with a GridLayout of 2,1. Each row has another JPanel (line1 and line2). By default, line 2 is hidden and should only show when the edit button is clicked, then hide when clicked again. I can change the visibility using setVisible(). But it creates that large space.</p> <p><em>[SOLVED]</em> 2.. Line2 has a FlowLayout, how can I get it to left align?</p> <p>3.. Each entry is class (called a "Preset") and is stored in a class variable array called "presetListing". When I click the new branch button, I create a new array with +1 capacity, transfer all the old Presets in and create a new Preset in the last space. What do I need to do to get the new entry to show up in the GUI? I tried adding it to the JPanel and then validate(), didn't work. </p> <p>Hopefully someoene out there will be able to help me, thanks in advance! </p> <p>EDIT: Here is the code from #3:</p> <pre><code>private void newBranch(){ Preset[] tempBranches = new Preset[branches.length + 1]; for (int i = 0; i &lt; branches.length; i++){ tempBranches[i] = branches[i]; } tempBranches[branches.length] = new Preset(); branches = tempBranches; pane = new JPanel(); pane.setLayout(new GridLayout(branches.length, 1)); for (int i = 0; i &lt; branches.length; i++){ pane.add(branches[i]); } scroller = new JScrollPane(pane); this.add(scroller, BorderLayout.CENTER); this.repaint(); this.validate(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload