Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>I spent quite a bit of time trying to get to the point of having a SSCCE but was unable to do so</p> </blockquote> <p>.</p> <ul> <li><p>please what??? an <a href="http://sscce.org/" rel="nofollow noreferrer">SSCCE</a> up to 5minutes</p> <hr></li> <li><p>now there are still two questions</p> <ol> <li><p>is there definition for <code>SplitPaneUI</code> too, because <code>if (ui instanceof BasicSplitPaneUI) {</code> can returns pretty the <code>false</code></p></li> <li><p>with description for why reason in there added MouseMotionListener</p></li> </ol></li> </ul> <hr> <p>EDIT_1st.</p> <blockquote> <p>The left side of the JSplitPane is a JTabbedPane with a number of tabs - a very complex layout. When the left side reaches a certain level of complexity, dragging the divider to move the divider location no longer works, but I can still move the divider by explicitly setting the location.</p> </blockquote> <ul> <li><a href="http://exampledepot.8waytrips.com/egs/javax.swing/split_SpWeight.html" rel="nofollow noreferrer">wild shot in the dark == you need to know</a> </li> </ul> <blockquote> <p>Distributing Space When a JSplitPane Container Is Resized The weight of a split pane controls the behavior of the divider when the split pane is resized. If the weight is 0, all extra space is given to the right or bottom component. If the weight is 1, all extra space is given to the left or top component. A weight of .3 specifies that the left or top component gets one-third of the extra space. The weight also determines how the children lose space when the size of the split pane is reduced. For example, a weight of 0 means that the left or top component does not lose any space.</p> <p>The weight also controls the starting location of the divider. For example, if the weight is .5, the divider is placed in the center. COPY</p> </blockquote> <pre><code>// Create a left-right split pane JSplitPane pane = new JSplitPane( JSplitPane.HORIZONTAL_SPLIT, leftComponent, rightComponent); // Get current weight double weight = pane.getResizeWeight(); // 0.0 by default // Keep the size of the right component constant weight = 1D; pane.setResizeWeight(weight); // Split the space evenly weight = .5D; pane.setResizeWeight(weight); </code></pre> <hr> <p>EDIT_2nd.</p> <p>you forgot to tell us that in Nimbus is there awfull flickering with divider, not caused with rest of Standard L&amp;Fs</p> <hr> <p><img src="https://i.stack.imgur.com/lXRxs.jpg" alt="enter image description here"></p> <pre><code>import java.awt.Dimension; import java.awt.EventQueue; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.JTable; import javax.swing.plaf.basic.BasicSplitPaneDivider; import javax.swing.plaf.basic.BasicSplitPaneUI; public class JSplitPaneToy { private JSplitPane sp; public JSplitPaneToy() { sp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, makePanel(), makePanel()); /*SplitPaneUI ui = sp.getUI(); if (ui instanceof BasicSplitPaneUI) { ((BasicSplitPaneUI) ui).getDivider().setBorder(null); }*/ BasicSplitPaneUI l_ui = (BasicSplitPaneUI) sp.getUI(); BasicSplitPaneDivider l_divider = l_ui.getDivider(); l_divider.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseDragged(MouseEvent e) { Dimension l_pane_size = sp.getSize(); if (sp.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) { int l_new_loc = sp.getDividerLocation() + e.getX(); if (l_new_loc &gt;= 0 &amp;&amp; l_new_loc &lt;= l_pane_size.width) { sp.setDividerLocation(l_new_loc); } } else { int l_new_loc = sp.getDividerLocation() + e.getY(); if (l_new_loc &gt;= 0 &amp;&amp; l_new_loc &lt;= l_pane_size.height) { sp.setDividerLocation(l_new_loc); } } } }); sp.setBorder(BorderFactory.createEmptyBorder()); /*sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, makePanel(), sp); ui = sp.getUI(); if (ui instanceof BasicSplitPaneUI) { ((BasicSplitPaneUI) ui).getDivider().setBorder(null); } sp.setBorder(BorderFactory.createEmptyBorder()); sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, makePanel(), sp); ui = sp.getUI(); if (ui instanceof BasicSplitPaneUI) { ((BasicSplitPaneUI) ui).getDivider().setBorder(null); } sp.setBorder(BorderFactory.createEmptyBorder()); sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, makePanel(), sp); ui = sp.getUI(); if (ui instanceof BasicSplitPaneUI) { ((BasicSplitPaneUI) ui).getDivider().setBorder(null); } sp.setBorder(BorderFactory.createEmptyBorder());*/ JFrame frame = new JFrame("JSplitPane Toy"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(sp); frame.pack(); frame.setVisible(true); } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { new JSplitPaneToy(); } }); } private JScrollPane makePanel() { JScrollPane pane = new JScrollPane(new JTable( new Object[][]{{0, 1, 2}, {1, 2, 3}, {2, 3, 4}}, new Object[]{1, 2, 3}) { }); pane.setPreferredSize(new Dimension(200, 100)); return pane; } } </code></pre>
    singulars
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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