JSplitPane: how can I close one side of the jsplitpane?

Hi!
I have a jsplitpane component on my frame. I want to close one side of the jsplitpane when my program loads. And after some time I want to open it back..
Do you happen to know how can I do that?

Either you have not read the complete thread or you have not followed instructions correctly. Instead of adding HierarchyListener on JSpliPane, you are playing with divider before realization of split pane on screen.
Here is modified code [This works 100%]:
import java.awt.*;
import java.awt.event.HierarchyEvent;
import java.awt.event.HierarchyListener;
import javax.swing.*;
import javax.swing.plaf.basic.*;
public class MySplit {
    private static void createAndShowGUI() {
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
                new JButton("first"),
                new JButton("second"));
        splitPane.setOneTouchExpandable(true);
        splitPane.setDividerLocation(150);
        splitPane.setPreferredSize(new Dimension(400, 400));
        splitPane.addHierarchyListener(new HierarchyListener() {
            public void hierarchyChanged(HierarchyEvent e) {
                if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) {
                    BasicSplitPaneUI ui = (BasicSplitPaneUI) splitPane.getUI();
                    BasicSplitPaneDivider divider = ui.getDivider();
                    JButton button = (JButton) divider.getComponent(1);
                    button.doClick();
        BasicSplitPaneUI ui = (BasicSplitPaneUI) splitPane.getUI();
        BasicSplitPaneDivider divider = ui.getDivider();
        JButton button = (JButton) divider.getComponent(1);
        button.doClick();*/
        frame.getContentPane().add(splitPane);
        frame.pack();
        frame.setVisible(true);
    public static void main(String[] args) {
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
}Thanks,
Mrityunjoy

Similar Messages

  • I have two Apple ID, how can I delete one and use the email address associates to the main one?

    I have two Apple ID, how can I delete one and use the email address associates to the main one?

    If you abandon one of the Apple IDs you will also basically be abandoning any content that you have acquired with that Apple ID. Content can only be updated and re-downloaded with the Apple ID that was used to buy it. Apple will not combine the content of Apple IDs and Apple will not transfer the content from one Apple ID to another Apple ID.

  • How can I change one section of the document to a landscape orientation and not the whole document?

    How can I change one section of the document to a landscape orientation and not the whole document?

    Page Setup, including page orientation, is done in the File menu. The setting applies to the whole document. As Peter says, you can rotate the contents of a page (not including the text layer of a word processing document).
    As an alternative, you could use Numbers, where Sheets are empty canvases onto which you may place images, charts, tables and text boxes, and where page orientation may be set for individual Sheets. The main tradeoff is that you lose many of the built-in word processing and page layout features of Pages.
    Regards,
    Barry

  • On I-Mac, how can I close all tabs at the same time?

    On I-Mac, how can I close all tabs at the same time?
    I use Mozilla Firefox for internet.

    Not an Apple product, have you visited:
    https://support.mozilla.org/en-US/kb/keyboard-shortcuts-perform-firefox-tasks-qu ickly

  • How can I close Aps accumulated at the bottom of my screen

    How can I close Aps accumulated at the bottom of my screen?

    Hi,
    double tap on the home button. Then slide the page above the icon upwards towards the top of your iPad.

  • How can I close a category in the form central form without closing it as error?

    How can I close a category in the form central form without closing it as error?

    I'm still not sure I follow - let me see if this is right.  You want to have users signing up for something using a FormsCentral form and then when something is full you'd like that section to show as "Closed" or full so nobody else can sign up for that particular event/day/time?  If that is the goal FormsCentral does not have any logic to close certain portions of the form.
    Thanks,
    Josh

  • 2 websites are open simultaneously. How can I close one of the websites to have more space for the otheer websites

    Each time I use Firefox to open a news website A, another news website B appear on the left of A. How can I close A in order to have the full screen for B.

    Do a malware check with some malware scan programs. You need to scan with all programs because each program detects different malware. Make sure that you update each program to get the latest version of the database before doing a scan.
    * http://www.malwarebytes.org/mbam.php - Malwarebytes' Anti-Malware
    * http://www.superantispyware.com/ - SuperAntispyware
    * http://www.microsoft.com/windows/products/winfamily/defender/default.mspx - Windows Defender: Home Page
    * http://www.safer-networking.org/en/index.html - Spybot Search & Destroy
    * http://www.lavasoft.com/products/ad_aware_free.php - Ad-Aware Free
    See also "Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked and Searches are redirected to another site

  • We have had to change to a new router but the Macbook Pro still reverts to the old router.  How can this new one be made the default?

    We have had to change to a new router but the Macbook Pro still reverts to the old one. How can we lose this and make the new router the default?

    Go to "Network" under system preferences and choose "advanced"
    On the Wi-Fi tab you can sort the sequence of the preferred connections.
    Then just move your new router to the top of the list.

  • How can I close one window without closing all open windows?

    If I open more than one window, I can't close just one. When I try to close just one, I'm warned that I'm about to close more than one (all of them) but I'm not told how to close just one.

    Are you sure you aren't getting tabs confused for windows? If you close a window containing multiple tabs, Firefox should give you a warning that you are about to close several tabs. To close a tab do one of the following:
    * click the x at the right end of the tab (when you only have a few tabs open)
    * open the tab you want to close, then click the x that appears
    * right click the tab and select 'Close Tab'
    * open the tab you want to close and press Ctrl+W
    You can close a window using Ctrl+Shift+W.

  • HT204053 It seems as if I have 2 accounts.  I would like to combine one account with the other.  How can I close one apple ID and combine it with the other that I was not aware I had set up???

    I would like to close one account and only use the other.  D

    You can't close or delete accounts (you can only remove any personal info from them and stop using them), and you can't merge accounts or transfer purchases to another account - content will remain tied to the account that downloaded them.

  • When panning full left and right in logic pro 9, how can i stop one side from bleeding into the other?

    I'm creating a Click track for live performance. I Have 3 audio tracks panned full left (-64) and a Click track panned full right (63) but when I play the track they bleed into each other. If anyone knows a way around this that'd be great

    Eddie,
    I just ran a test on my G5 Logic system (Logic 9.02) with an internal RME PCI 8in/8out Audio Card and I get perfect separation bouncing to a stereo audio file using standard panning. Click on one side and a couple of crunchy guitars on the other. Each side is completely separate.
    So, it seems to point to your hardware unless you have some other audio routing that we've missed.
    I'm re-doing my setup so I may try a couple of other tests as I go along.
    pancenter-

  • How can I close a gap on the timeline?

    I am recently moving over to Adobe Premiere CS6 from Final Cut Pro Studio 7 (wasn't feeling X) and I am wondering is there any way to close a gap on the timeline?  I removed some footage and instead having to highlight all of the remaining footage and bring it over, is there a way I can just click a "close gap" type of button similar to Final Cut Pro to resolve this?
    Thank you!

    Hi, I'm trying to the same thing - delete a clip then close the space, and I can delete the clip but it won't close the gap.  I've tried all the ways listed but when I get to the second step either it's not highlighted or nothing happens.
    Thanks,
    Vince
    Delete empty space between clips in the Expert view timeline
    You can quickly delete empty space between clips in the Expert view timeline by using the Delete And Close Gap command. Alternatively, press the Delete or Backspace key. Both techniques shift adjacent clips over to fill the gap.
    In the Expert view timeline, do one of the following:
    Right‑click the empty space, and choose Delete And Close Gap.
    Select the space you want to delete, and press the Delete or Backspace key.Note: If the gap is small and difficult to select, move the current‑time indicator to the gap and click the Zoom In button.

  • How can i use one datatable inside the other?

    Hi all,
    i need help ... i have this page that shows information from a relational table... for example a mapped table "Countries" that has a java.util.Set inside named "Cities" and i would like 2 know how can i do this using jsf...
    The display would be like this:
    Brasil
    Rio de Janeiro
    Sao Paulo
    USA
    New York
    Washington
    New Orleans
    And Goes on... So i guess it would be a dataTable inside the other, right? but i dunno how to do it...
    Thanks for any info. cya

    this is somehow a messy example. But just focus on the var attribute of outer datatable and how value attribute of inner datatable is referencing it.
    <h:dataTable id="table1" value="#{pc_City_state.listofstates.states}" var="varstates" styleClass="dataTable">
                   <h:column id="column1">
                        <f:facet name="header">
                             <h:outputText styleClass="outputText" value="StateName" id="text2"></h:outputText>
                        </f:facet>
                        <h:outputText id="text3" value="#{varstates.stateName}" styleClass="outputText">
                        </h:outputText>
                   </h:column>
                   <h:column id="column3">
    <f:facet name="header">
    </f:facet>
              <h:dataTable id="table2" value="#{varstates.cities}" var="varcities" styleClass="dataTable">
                                       <f:facet name="footer">
                                       </f:facet>
                                       <h:column id="column4">
              <f:facet name="header">
              <h:outputText styleClass="outputText" value="CityName" id="text6"></h:outputText>
              </f:facet>
              <h:outputText id="text7" value="#{varcities.cityName}" styleClass="outputText">
              </h:outputText></h:column>
              </h:dataTable>
    </h:column>
    </h:dataTable>

  • How can i run one procedure at the fix time every day?

    Hi.
    I write a procedure.it can open a text file.Now, I'd like run it every day at 24:00.
    How can i do that?
    thanks alot.

    and on the other, other hand. If you are using Oracle, schedule it in the Oracle job queue. Look into the DBMS_JOB package (DBMS_JOB.SUBMIT more specifically).
    something like this would work:
    variable jobno number;
    variable instno number;
    begin
    select instance_number into :instno from v$instance;
    dbms_job.submit(:jobno, 'statspack.snap;', trunc(sysdate+1), 'trunc(SYSDATE+1)', TRUE, :
    instno);
    commit;
    end;
    That would schedule it at midnight I believe.

  • How can i add one field in the container for the standard task-90310004?

    Hi,
    Please let me know thw steps to add one field in the container for the standard task-90310004.
    Usefull suggestions will be rewarded.
    Regards,
    Neslin.

    <b>Hi,
    Containers are used for holding Application data for Workflow purposes.
    Event container
    Task container
    Workflow container
    Role container
    Binding is the linking of data from one container to the other for making data available all across the workflow.
    But you can get values from one container to another container like this
    Container(Con)
    1. WF Con to Role, Wf con to task con, Wf con to event
    and
    2. Event con to wf con, task con to wof con
    and
    3. Method con to task con
    and
    4. Task con to method con
    So, we don't have direct possible binding from task con to task con.
    Thanks and Regards,
    Prabhakar Dharmala</b>
    Message was edited by:
            Prabhakar Dharmala
        But you can do pass values from first task con to wf con and again from wf con to another task con

Maybe you are looking for

  • Extracting Data from APO PP/DS to BW

    Hi Gurus, I'm trying to extract data from APO PP/DS (SCM 5.1) to BW (BI 7.0). I'm new to SCM and am not sure how the extraction from SCM to BI happens other than that we need to read data from LiveCache. The extractor we are interested are 0APO_PPDS_

  • Getting a new MBP and I have a few questions

    I'm getting a new MacBook Pro, replacing my Late 2008 model (2.8 GHz T9600, 320 GB HD, 4 GB RAM) for this years' late 2011 model, a 2.4 GHz (2760QM) quad-core Intel Core i7 Sandy Bridge, 750 GB, 4 GB RAM. Now, this new computer is basically an early

  • How can I boot linux from usb drive and/or dvd drive on a windows 8 laptop please?

    Hi all, Could someone describe how to set my windows 8 laptop to boot linux from usb and or dvd drive step by step please? I have HP laptop. Thank you.

  • Filename variable changes too fast

    This problem is hard to explain so please bare with me. My app is a file downloader. I loop through a list of filenames and call my download function on each one. Once the download function has been called on item[i], the loop carries on and calls th

  • Multiple process start with terminal?

    How do I open multiple programs at one? I need it to open an executable, leave it running, open another executable. I'm not sure how to do this branch thing in the terminal I want to use this for an .sh script Last edited by caelestis (2009-04-29 22: