Hide one side of a JSplitPane by default

Hi everybody,
I am using a JSplitPane and I turned on the "one touch expandable" feature. In addition to this I would like to hide the right side of the JSplitPane by default, i.e. simulate a click on one of the two "one touch expand" buttons. I have tried setting the divider location to 1.0 during creation, but does not work. It somehow respects the preferred size of the right component, so it isn't hidden. The JSplitPane is visible but not showing when I set the divider location to 1.0.
How can I force the JSplitPane to hide the right component?
Best regards,
Jethro

Hang on.
JSplitPane#setDividerLocation(double proportionalLocation) has no effect if the split pane is not realized. However, you can use JSplitPane#setDividerLocation(int location) to solve your problem.
Initially to hide right pane use:
// 10000 is an arbitrary high value.
pane.setDividerLocation(10000);Initially to hide left pane use:
pane.setDividerLocation(0);Here is a working example:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
* Implementation of thread 5367946.
* @author mrityunjoy_saha
* @version 1.0
public class Thread5367946 {
    private JFrame frame = null;
    public static void main(String[] args) {
        Thread5367946 t = new Thread5367946();
        t.process();
    private void process() {
        frame = new JFrame("Thread5367946");
        frame.setLayout(new BorderLayout());
        JPanel panel1=new JPanel();
        JPanel panel2=new JPanel();
        panel1.add(new JLabel("This is left panel"));
        panel2.add(new JLabel("This is right panel."));
        JSplitPane pane=new JSplitPane();
        pane.setOneTouchExpandable(true);
        // Uncomment following line to hide right pane.
        // 10000 is an arbitrary high value.
        pane.setDividerLocation(10000);
        // Uncomment following line to hide left pane
        //pane.setDividerLocation(0);       
        pane.setLeftComponent(panel1);
        pane.setRightComponent(panel2);
        frame.getContentPane().add(pane);
        frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);                
}Thanks,
Mrityunjoy
Edited by: mrityunjoy on 18 Feb, 2009 10:54 PM

Similar Messages

  • 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

  • JSplitPane expand/collapse on one side only

    How would I make my JSplitPane expand and collapse only on one side? When I use the method:
    mySplitPane.setOneTouchExpandable(true);It seems that the splitPane can collapse/expand on both sides. I want my splitPane to collapse/expand only on one side.
    (the divider should only contain one arrow and there should only be one component that is expanding and collapsing)

    relatively simple:
    set your own BasicSplitPaneUI, which sets its own BasicSplitPaneDivider.
    you then override the method (from BasicSplitPaneDivider)
    protected JButton createRightOneTouchButton() //for right
    to disable and hide the button

  • How do I get my printer to print only on one side of the paper?

    I want to print only on one side of the papger.  But machine prints out on both sides.  When I remove the duplexer at back of machine, the paper flies out the back and printing error says no paper.  I'm going nuts.   I am a writer and can only submit material on one side of the paper.   I just got this machine and hate that it has no manual and the manual on line is beyond me.  I need simple easy to understand instructions for my simple brain. thanks

    Hi,
    Follow these steps to disable two sided printing:
    Open the file you would like to print. From the File menu select Print. The Print window appears.
    NOTE: The Print window might be minimized. Click the Show Details button to see all available settings.
    Click the settings drop down, it will usually appear as the name of the program (e.g. TextEdit)
    Will appear as Copies & Pages within Microsoft Office applications.
    Select Layout from the drop-down menu.
    Set the Two-Sided option as Off.
    You may save the settings as a preset by clicking Presets > Save Current Settings as Preset...
    By doing so and completing the print job these settings will remain default till another preset will be used in the future.
    Regards,
    Shlomi
    Say thanks by clicking the Kudos thumb up in the post.
    If my post resolve your problem please mark it as an Accepted Solution

  • Need to hide one of the selction screen block

    Hi Gurus!
    I need to hide one of the block in my selectrion screen and only display one radio button in that selection screen block . Somehow its not hiding the enitre block , so I tried doing the fields invisible but when it is transported it again makes it visible . Is it possible to do it through programming code itself rather than through screen.
    Follwoing is the block that I need to hide.
    SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME TITLE text-004.
    PARAMETERS:
    rb_list RADIOBUTTON GROUP rb1 DEFAULT 'X' USER-COMMAND opt.<<<<<<<<need to hide this
    SELECTION-SCREEN BEGIN OF BLOCK b4i WITH FRAME TITLE text-005 .<<< need to hide this block
    PARAMETERS: p_header AS CHECKBOX MODIF ID b5,
                p_send   AS CHECKBOX MODIF ID b5 USER-COMMAND opt,
                p_overr  TYPE sy-uname MODIF ID b6,
                p_alines AS CHECKBOX MODIF ID b5.
    SELECTION-SCREEN END OF BLOCK b4i .
    PARAMETERS: rb_alv  RADIOBUTTON GROUP rb1 DEFAULT 'X'.<<<< Just need to show this on my selection screen
    SELECTION-SCREEN END OF BLOCK b4.
    In the above code I need to hide the block b4i and the radiobutton rb_list.
    Help will be gretaly appreciated.
    Regards
    Aarav

    Hi!
    Thanks for the input but addition of that still gives me the first radiobutton 'rb_list 'in my selection screen .
    SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME TITLE text-004 .
    PARAMETERS:rb_list RADIOBUTTON GROUP rb1 MODIF ID rad .<<<<< This is still showing up --want to hide this
    SELECTION-SCREEN  BEGIN OF BLOCK b4i WITH FRAME TITLE text-005 .<<<<< want to hide is block completely
    PARAMETERS: p_header AS CHECKBOX MODIF ID b5 ,
                p_send   AS CHECKBOX MODIF ID b5 USER-COMMAND opt,
                p_overr  TYPE sy-uname MODIF ID b6,
                p_alines AS CHECKBOX MODIF ID b5.
    SELECTION-SCREEN END OF BLOCK b4i .
    PARAMETERS: rb_alv  RADIOBUTTON GROUP rb1 DEFAULT 'X'.<<< Just need to show this param,etere on the screen
    SELECTION-SCREEN END OF BLOCK b4.
    * At Selection screen output
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF rb_list IS INITIAL AND ( screen-group1 = 'B5').
          screen-active = '0'.
          MODIFY SCREEN.
        ELSEIF screen-group1 = 'B5'.
          screen-active = '1'.
          MODIFY SCREEN.
        ENDIF.
        IF p_send IS INITIAL AND screen-group1 = 'B6'.
          screen-active = '0'.
          MODIFY SCREEN.
        ELSEIF screen-group1 = 'B6'.
          screen-active = '1'.
          MODIFY SCREEN.
        ENDIF.
        CHECK screen-group1 = 'RAD' OR
              screen-group1 = 'B4'  OR
              screen-group1 = 'B5'  OR
              screen-group1 = 'B6' OR
        screen-active = 0.
        MODIFY SCREEN.
    Thanks
    Edited by: Aarav  Agnihotri on Sep 29, 2009 6:08 PM

  • Why is the font messed up when i open my home page, letters h, n, d are bold on one side of the letter

    while running foxfire some letters look itialic or are bold on one side of the letter. Letters such as d,h,n. and l.

    By default, Firefox will attempt to use your graphics card processor to improve font rendering. But, due to incompatibility with some graphic card driver software, this can look worse than a plainer rendering. To see whether this is the problem, you can turn off this feature.
    That may require changes to one or both of these settings.
    (1) General hardware acceleration setting
    orange Firefox button (or Tools menu) > Options > Advanced
    On the "General" mini-tab, uncheck the box for "Use hardware acceleration when available"
    That takes effect the next time you exit and restart Firefox.
    (2) Azure setting
    (a) In a new tab, type or paste '''about:config''' in the address bar and press Enter. Click the button promising to be careful.
    (b) In the search box above the list, type or paste '''gfx''' and pause while the list is filtered
    (c) Double-click the '''gfx.content.azure.enabled''' preference to switch it from true to false.
    I don't know whether that kicks in right away or the next time you exit and restart Firefox.

  • How to create more than one SID in .bash_profile

    I Want to create more than one SID in bash_profile without disturbing oracle's default SID i.e orcl and create database with new SID?

    you can create SID.env file or try to use . oraenv
    eg:-
    $ cat uat1.env
    export ORACLE_BASE=/u01/db/db10g
    export ORACLE_HOME=$ORACLE_BASE/10.2.0
    export PATH=$ORACLE_HOME/bin:$PATH
    export ORACLE_SID=UAT1
    export TNS_ADMIN=$ORACLE_HOME/network/admin
    $ . uat1.env
    $ echo $ORACLE_HOME
    /u01/db/db10g/10.2.0
    $ echo $ORACLE_SID
    UAT1else
    $ . oraenv
    ORACLE_SID = [UAT1] ? UAT1

  • "Erased" one side of my XRAID volume.

    First. I'm an idiot. I know.
    The Setup...
    Xraid @ RAID 50.
    10 drives @ 500 GBs.
    5 on each side.
    3.64 in RAID 50.
    The short version: Within Disk Utility I accidentally "erased" one side of my RAID. I essentially did a quick erase on one of the RAID volumes. I now see one side of my Xraid as "untitled" within my drives. The XRAID volume is still visible within Disk Utilities.
    The long version....
    We were out of space on our Xraid. We use it for video editing, DVD creation, etc. We needed to max it out with four more drives. I rented another Xraid to use as storage during the transfer. I bought four more drives to add to the RAID. I plugged in the rented Xraid and opened Disk Utility. LOTS of partitions showed up. I started clicking and "erase"ing. The third partition I erased was one half of my Xraid configuration. This drive was erased and a new volume showed up as "untitled" on the desktop. My heart beat faster, thoughts of all the hours of video, audio, projects and man hours surged through my head in an instant. I realized what I had done.
    So far I've talked to Apple support who says to call DriveSavers.
    I've talked to DriveSavers. They quoted between $9K - 86K, depending on turn around time, ease of the fix, etc.
    I talked to another company who quoted $3500 - $18,000.
    I have Disk Warrior, Norton System Tools, and Tech Tools in house.
    I am afraid this is going to either cost a huge amount of money or more than likely, we'll need to opt to rebuild everything from scratch. Either way... This *****.
    My fault completely. I know it and I don't know what to do.
    Does anyone have any ideas on how to get this working or others who could solve this issue for a lesser price?

    >I put DiskWarrior into the system, the problem is, all It sees it one half of the raid as a drive called "untitled" because that's how I formatted that drive.
    That's all it will see because it's not performing a deep analysis of the drive. You need to tell it to go look for files.
    As long as you just did a quick erase (and 11 seconds sounds pretty quick to me), the data should still be on the disk, but by default recovery tools will only look at directory information (which is empty) until told otherwise.
    As for the professional companies, no one is going to guarantee recovery since they don't know what's happened to the drives (you could have put them in a microwave oven for all they know). However, I think the chances are high, as long as you don't do anything to these drives in the short-term, and most companies offer a 'no recovery, no fee' (or at least reduced fee), so the cost is minimal if they can't help.

  • Hi, I am using Firefox 5. Suddenly I lost my bookmarks toolbar even though I have selected it to be visible in the view option. But I can still view the bookmarks toolbar in my all-in one side bar

    Hi, I am using Firefox 5. Suddenly I lost my bookmarks toolbar even though I have selected it to be visible in the view option. But I can still view the bookmarks toolbar in my all-in one side bar

    If the menu bar is hidden then press the F10 key or hold down the Alt key to make the menu bar appear.
    Make sure that toolbars like the "Navigation Toolbar" and the "Bookmarks Toolbar" are visible: "View > Toolbars"
    *Open the Customize window via "View > Toolbars > Customize"
    *Check that the "Bookmarks Toolbar items" is on the Bookmarks Toolbar
    *If the "Bookmarks Toolbar items" is not on the Bookmarks Toolbar then drag it back from the toolbar palette in the customize window to the Bookmarks Toolbar
    *If missing items are in the toolbar palette then drag them back from the Customize window on the toolbar
    *If you do not see an item on a toolbar and in the toolbar palette then click the "Restore Default Set" button to restore the default toolbar set up
    *http://kb.mozillazine.org/Toolbar_customization
    *https://support.mozilla.org/kb/Back+and+forward+or+other+toolbar+items+are+missing

  • G570 bought four months back - screen screw has come out from one side

    Hi there,
    I bought Ideapad G570 in June 2012 from Jumbo Electronics in Great India Place, Noida (UP). The Serial No is CBxxxxxxxx. Today I noticed that one of screws (through which lcd screen gets attached to the body) has come out of place and the laptop's screen is kind of hanging from one side. The product quality is pretty bad.
    Anyway, I have got two queries:
    1. How to avail on-site warranty support to get my laptop repaired? 
    2. When I checked about the warranty on your site through my serial no, it showed that my laptop's warranty expirtation date is  2013-04-26, which is less that a year from the date of purchase (3 June 2012). Could somebody explain me that?
    Any help would be much appreciated.
    Thanks
    Moderator Note; s/n edited for member's own protection

    Hi   deeam99
    The warranty of your system has been updated on the support website . You can directly view details from the below link .
    http://support.lenovo.com/en_US/product-service/warranty-status/default.page?
    I have sent the required details through PM .
    Now you may please contact the Local support for logging a case for the issue and get the required parts replaced
    http://support.lenovo.com/en_US/feedback/detail.page?LegacyDocID=MIGR-76613
    Do letus know if any more help is required
    Hope This Helps
    Cheers!!!
    WW Social Media
    Important Note: If you need help, post your question in the forum, and include your system type, model number and OS. Do not post your serial number.
    Did someone help you today? Press the star on the left to thank them with a Kudo!
    If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"!
    Follow @LenovoForums on Twitter!
    How to send a private message? --> Check out this article.
    English Community   Deutsche Community   Comunidad en Español

  • Real instruments pan to one side.

    on the older (not '08) version of Garageband, when i record 'real' instruments, they always pan to one-side, even though it's shown as them being in the middle, and also even if i pan it to the other side. but software instruments are fine and are panned to the middle..
    so presumably i changed a setting somewhere without realising?

    Chris, similar problem; long time GB user, upgraded to intel machine and '08; in editing existing tracks in new 08 version of GB, can't get them to pan; I searched help and noticed the bit on turning off echo and reverb, which I did. still can't get 'em to pan.......using either pan curves or the knob. Made sure the track was mono.....any ideas? I'd be most grateful.........
    todd

  • Why does my Alesis ioj2 express only come out through one side? When I sing into the microphone, it only comes out one side. I've set everything to stereo and it still has not solved the problem. Please help ASAP.

    Please help with my problem. I need to start recording!!

    Chris Huber wrote:
    Why does my Alesis ioj2 express only come out through one side?
    http://www.bulletsandbones.com/GB/GBFAQ.html#leftspeakeronly
    (Let the page FULLY load. The link to your answer is at the top of your screen)

  • In my iPad mini if I use earphones I can hear from only one side

    In my iPad mini if I use earphones I can hear from only one side  but the earphones work fine with other devices

    Have you tried different headphones in your iPad mini?
    Check in Settings > General > Accessibility if little slider half way down isn't moved to either side towards "L" or "R".
    If it isn't , try to reboot the device, but it's likely that your audio port isn't working correctly. If so, it should definitely be covered by warranty.

  • Macbook 13 inch late 2008 screen not illuminated on one side

    Hi Apple Community,
    I need help! My late 2008 13 inch aluminium Macbook screen has 'died' on one side resulting in one side being noticeably dark. The left side has no problems, only the right side.
    I am a student living in New Zealand where there is no Apple store in the country I can go to. Local service shop says just to look at it and confirm that one side is dark (which any 2 year old cad identify that it is) will cost a ridiculous $100. Estimated cost will be around $1000 to replace screen.
    Has anyone had the same problem and how have you solved it? What is the cost of repair or is there something I can do it help it?
    Macbook specs:
    MacBook, 13inch, Aluminium, Late 2008
    Processor: 2.4 Ghz Intel Core 2 Duo
    Memory: 4 GB
    Software: OS X 10.9.4 (Mavericks)
    I do not have AppleCare
    Thanks!

    Try these folks at www.usedmac.com.  You may have some luck getting technical help from them by email.  It is more difficult by phone.  You can look through the parts list for what they have in stock for your computer model to get an idea of the prices.  You probably won't need any heavy or large parts so some priority mail  service won't break the bank.  Your problem may simply be a cable but even a back light led or controller circuit board should not be too expensive.  It will require some careful work on your part for replacement.
    good luck.

  • HT204053 What are the pros and cons of 1) choosing to use the SAME Apple ID for iCloud services on one side, and purchases on the iTunes Store, App Store, and iBookstore, on the other side; or 2) to have and use two separate Apple Ids for these "two sides

    All is in the title, so I repeat it below with a better identation.
    What are the pros and cons of
    1) choosing to use the SAME
                                                  Apple ID for iCloud services on one side, and
                                                  purchases on the iTunes Store, App Store, and iBookstore, on the other side; or
    2) to have and use two separate Apple Ids for these "two sides"?
    P.S.
    I have loads and loads of free podcasts in iTunes in my iMac, that are certainly more thant the 5 gigas the iCloud provides for free, so I don't want those to go to the cloud. But this is perhaps a different question...
    Also need to mention that I have itunes on a mac, a pc and an iphone.
    Sorry to look so silly with this question, but I don't get the "big picture".

    You need to create a user account for your wife (or yourself depending on who has the current user account). When syncing, each of you should sign in as a separate user, login to iTunes and then sync. I had this problem when my sister got an iPhone. When we did her initial sync, everything on my iPhone showed up on hers. Apple gave me this solution.

Maybe you are looking for