Placing a line in a split pane

hi, how can a place a divider that is not resizable, is possible in jsplitpane or there is another way, like jpanel or something... thx

I didn't even know that the dividers were resizable. Is it really?
Maybe you should ask at the Swing forum.

Similar Messages

  • Split pane only shows buttons, not the panes I placed there

    problem: my split pane only shows buttons, not the panes I placed there
    here's my complete code:
    thanks.
    * MLDpane.java
    * Created on July 23, 2003, 3:31 PM
    import javax.swing.*;
    import javax.swing.tree.*;
    * @author  Administrator
    public class MLDPane extends JSplitPane {
        private JScrollPane jScrollPane2 = new JScrollPane();
        private JTextPane ttView = new JTextPane();
        private JScrollPane jScrollPane3 = new JScrollPane();
        private JTree treeView = new JTree();
        private  void init() {
            setDividerSize(5);
            //setPreferredSize(new java.awt.Dimension(600, 302));
            //jScrollPane2.setMinimumSize(new java.awt.Dimension(100, 20));
            //jScrollPane2.setPreferredSize(new java.awt.Dimension(300, 300));
            //ttView.setPreferredSize(new java.awt.Dimension(300, 22));
            jScrollPane2.setViewportView(ttView);
            setLeftComponent(jScrollPane2);
            jScrollPane3.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
            //jScrollPane3.setMinimumSize(new java.awt.Dimension(100, 20));
            //jScrollPane3.setPreferredSize(new java.awt.Dimension(300, 200));
            treeView.setModel(null);
            jScrollPane3.setViewportView(treeView);
            setRightComponent(jScrollPane3);
         public MLDPane() {
        /** Creates a new instance of MLDpane */
         public MLDPane(MedLEEDoc mld) {
            init();
            ttView.setDocument(mld.getTextDoc());
            treeView.setModel(new DefaultTreeModel(mld.getRoot()));
        public static void main(String args[]) {
            JFrame j = new JFrame();
            j.getContentPane().add(new MLDPane());
            j.show();
            //j.setVisible(true);
            //j.setExtendedState(j.MAXIMIZED_BOTH);

    Hi,
    I think you are invoking the default (no argument constructor) instead of the one argument constructor
    try this:
    j.getContentPane().add(new MLDPane(MedLEEDocObject));

  • Design problem(split pane scrollpane Insets)

    hi,
    doing a exam simulator prgm
    design is like,
    Question (text area with scrollpane)
    Answers (checkbox inside panel with scrollpane)
    used split pane between qst and ans but big thick bar comes how to reduce size and it is not
    moving.
    used GridLayout for container and panel.
    PROBLEM is how to leave space qst textarea appears from very left edge of screen how to leave some space
    same prblm for checkbox they to appear extreme left on screen.

    Put those components in a JPanel overwriting the getInsets() method like this:
    JPanel cPane=new JPanel(){
        private final Insets _insets=new Insets(10,10,10,10);
        public Insets getInsets(){
            return _insets;
    };...should do the trick, take a look at the Insets class if you need information on how defining it...

  • Urgent : FB60 line item value splitting

    All,
    My client needs to split the value of line item by the specified percentage.
    When clicking simulate/Post button
    1. The amount of the line item is split by the specified percentage.
    2. The tax amount is split by the specified percentage.
    Does anyone know which user-exit or method i could use to meet this expectation?
    Thanks a lot!
    suresh

    Hi,
        How r u and this is anil.  i doesnt understand the question.
      will  u please clearly mention what do u want so that i can help u
    u rs friend
    anilkumar

  • I get the following message when i try to open ALL my documents : frozen panes and split panes are not supported and were removed. my documents are blank

    i get the following message when i try to open any of my documents : frozen panes and split panes are not supported and were removed. All my documents open blanc!

    Hi Louisa,
    louisa_16_za wrote:
    i work with Numbers on my MiniMac and then save the files as Excel because the university only works with Windows.
    Numbers is not an Excel clone. Importing and exporting between Numbers and Excel will eventually build up glitches.
    If the university only works with 'Windoze' it might be better if you use Excel or a free version of Office (for example, Libre Office or Open Office).
    If your marks depend upon a professor who uses Excel, go with the flow.
    http://www.howtogeek.com/187663/openoffice-vs.-libreoffice-whats-the-difference- and-which-should-you-use/
    Regards,
    Ian

  • Drag and drop icons from onside of the split pane to the other side.

    Hello All,
    I am tring to write a program where i can drag and drop icons from the left side of the split pane to the right side. I have to draw a network on the right side of the split pane from the icons provided on the left side. Putting the icons on the labels donot work as i would like to drag multiple icons from the left side and drop them on the right side. CAn anyone please help me with this.
    Thanks in advance
    smitha

    The other option besides the drag_n_drop support
    http://java.sun.com/docs/books/tutorial/uiswing/dnd/intro.htmlis to make up something on your own. You could use a glasspane (see JRootPane api for overview) as mentioned in the tutorial.
    Here's another variation using an OverlayLayout. One advantage of this approach is that you can localize the overlay component and avoid some work.
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.BufferedImage;
    import java.io.*;
    import javax.imageio.ImageIO;
    import javax.swing.*;
    import javax.swing.event.MouseInputAdapter;
    public class DragRx extends JComponent {
        JPanel rightComponent;
        BufferedImage image;
        Point loc = new Point();
        protected void paintComponent(Graphics g) {
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            if(image != null)
                g2.drawImage(image, loc.x, loc.y, this);
        public void setImage(BufferedImage image) {
            this.image = image;
            repaint();
        public void moveImage(int x, int y) {
            loc.setLocation(x, y);
            repaint();
        public void dropImage(Point p) {
            int w = image.getWidth();
            int h = image.getHeight();
            p = SwingUtilities.convertPoint(this, p, rightComponent);
            JLabel label = new JLabel(new ImageIcon(image));
            rightComponent.add(label);
            label.setBounds(p.x, p.y, w, h);
            setImage(null);
        private JPanel getContent(BufferedImage[] images) {
            JSplitPane splitPane = new JSplitPane();
            splitPane.setLeftComponent(getLeftComponent(images));
            splitPane.setRightComponent(getRightComponent());
            splitPane.setResizeWeight(0.5);
            splitPane.setDividerLocation(225);
            JPanel panel = new JPanel();
            OverlayLayout overlay = new OverlayLayout(panel);
            panel.setLayout(overlay);
            panel.add(this);
            panel.add(splitPane);
            return panel;
        private JPanel getLeftComponent(BufferedImage[] images) {
            JPanel panel = new JPanel(new GridBagLayout());
            GridBagConstraints gbc = new GridBagConstraints();
            gbc.weightx = 1.0;
            gbc.weighty = 1.0;
            for(int j = 0; j < images.length; j++) {
                gbc.gridwidth = (j%2 == 0) ? GridBagConstraints.RELATIVE
                                           : GridBagConstraints.REMAINDER;
                panel.add(new JLabel(new ImageIcon(images[j])), gbc);
            CopyDragHandler handler = new CopyDragHandler(panel, this);
            panel.addMouseListener(handler);
            panel.addMouseMotionListener(handler);
            return panel;
        private JPanel getRightComponent() {
            rightComponent = new JPanel(null);
            MouseInputAdapter mia = new MouseInputAdapter() {
                Component selectedComponent;
                Point offset = new Point();
                boolean dragging = false;
                public void mousePressed(MouseEvent e) {
                    Point p = e.getPoint();
                    for(Component c : rightComponent.getComponents()) {
                        Rectangle r = c.getBounds();
                        if(r.contains(p)) {
                            selectedComponent = c;
                            offset.x = p.x - r.x;
                            offset.y = p.y - r.y;
                            dragging = true;
                            break;
                public void mouseReleased(MouseEvent e) {
                    dragging = false;
                public void mouseDragged(MouseEvent e) {
                    if(dragging) {
                        int x = e.getX() - offset.x;
                        int y = e.getY() - offset.y;
                        selectedComponent.setLocation(x,y);
            rightComponent.addMouseListener(mia);
            rightComponent.addMouseMotionListener(mia);
            return rightComponent;
        public static void main(String[] args) throws IOException {
            String[] ids = { "-c---", "--g--", "---h-", "----t" };
            BufferedImage[] images = new BufferedImage[ids.length];
            for(int j = 0; j < images.length; j++) {
                String path = "images/geek/geek" + ids[j] + ".gif";
                images[j] = ImageIO.read(new File(path));
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.add(new DragRx().getContent(images));
            f.setSize(500,400);
            f.setLocation(200,200);
            f.setVisible(true);
    class CopyDragHandler extends MouseInputAdapter {
        JComponent source;
        DragRx target;
        JLabel selectedLabel;
        Point start;
        Point offset = new Point();
        boolean dragging = false;
        final int MIN_DIST = 5;
        public CopyDragHandler(JComponent c, DragRx dr) {
            source = c;
            target = dr;
        public void mousePressed(MouseEvent e) {
            Point p = e.getPoint();
            Component[] c = source.getComponents();
            for(int j = 0; j < c.length; j++) {
                Rectangle r = c[j].getBounds();
                if(r.contains(p) && c[j] instanceof JLabel) {
                    offset.x = p.x - r.x;
                    offset.y = p.y - r.y;
                    start = p;
                    selectedLabel = (JLabel)c[j];
                    break;
        public void mouseReleased(MouseEvent e) {
            if(dragging && selectedLabel != null) {
                int x = e.getX() - offset.x;
                int y = e.getY() - offset.y;
                target.dropImage(new Point(x,y));
            selectedLabel = null;
            dragging = false;
        public void mouseDragged(MouseEvent e) {
            Point p = e.getPoint();
            if(!dragging && selectedLabel != null
                         && p.distance(start) > MIN_DIST) {
                dragging = true;
                copyAndSend();
            if(dragging) {
                int x = p.x - offset.x;
                int y = p.y - offset.y;
                target.moveImage(x, y);
        private void copyAndSend() {
            ImageIcon icon = (ImageIcon)selectedLabel.getIcon();
            BufferedImage image = copy((BufferedImage)icon.getImage());
            target.setImage(image);
        private BufferedImage copy(BufferedImage src) {
            int w = src.getWidth();
            int h = src.getHeight();
            BufferedImage dst =
                source.getGraphicsConfiguration().createCompatibleImage(w,h);
            Graphics2D g2 = dst.createGraphics();
            g2.drawImage(src,0,0,source);
            g2.dispose();
            return dst;
    }geek images from
    http://java.sun.com/docs/books/tutorial/uiswing/examples/components/index.html

  • Split Pane Problem

    I have a panel with a split pane in it. On the Left hand side there is a Tree and on the right side is a complex tabbed pane.
    (complex meand it includes many panels, more tabbed panes and other components).
    My problem is this. I have given a specific width for the split pane for the tree and at start time it comes corrcetly. But when I move the Split pane left, suddenly it jumps to the left edge of the screen. And then I cant move it forward again. Tree cannot be seen now.
    Why does this happen I just cant figure out.
    Is it because of tabbed panes or something with the split pane.
    Another thing is when I try to move the split pane to the left the movements are not smooth. It kind of do smaller jumps, until it do that big jump to the edge.
    Any help would be greatly appreciated....

    Seeing that your file has a size of 3.5 Mb, I preferred not to download it, but to send you this link.

  • Split Panes, Frame and Resizing

    Hi,
    my user interface is made up of a message panel using the created class SplitPanes2 through the method createSplitPanes called from a class that extends Frame. (will post code if required: lengthy). When the frame is resized/maximized, the splitPanes remain at their preferred size. How can I work on it such that the SplitPanes will resize proportionally too? Please inform me if I have overlooked certain details.
    -cyndi
    public class AppLayout {
         Frame parent;
         public AppLayout() {
         public void createSplitPanes( Panel messagePanel, TextArea messageAreaOut, TextArea messageAreaIn, TextArea messageArea ) {
              Panel splitPane2 = new SplitPane2( messageAreaOut, messageAreaIn, messageArea );
              messagePanel.setLayout( new GridLayout(1, 1));
              messagePanel.add(splitPane2);
         public class SplitPane2 extends Panel {
              public SplitPane2( TextArea messageAreaIn, TextArea messageAreaOut, TextArea messageArea ) {
                   //Create an instance of splitPane
                   splitPane sPane2  = new splitPane( messageAreaOut, messageAreaIn );
                   JSplitPane left    = sPane2.getSplitPane();
                   //XXXX: Bug #4131528, borders on nested split panes accumulate.
                   //Workaround: Set the border on any split pane within
                   //another split pane to null. Components within nested split
                   //panes need to have their own border for this to work well.
                   left.setBorder( null );
                   //Create a split pane and put "left" (a split pane)
                   //and TextArea instance in it.
                   JSplitPane sPane   = new JSplitPane( JSplitPane.HORIZONTAL_SPLIT,
                        left, messageArea );
                   //splitPane.setOneTouchExpandable(true);
                   sPane.setDividerLocation( 150 );
                   sPane.setResizeWeight( 0.5 );
                   //Add the split pane to this frame
                   sPane.setPreferredSize( new Dimension( 400, 430 ) );
                   add( sPane );
              class splitPane {
                   JSplitPane sPane;
                   public splitPane( TextArea messageAreaOut, TextArea messageAreaIn ) {
                        //Read image names from a properties file
                        sPane = new JSplitPane( JSplitPane.VERTICAL_SPLIT,
                             messageAreaIn, messageAreaOut );
                        //splitPane.setOneTouchExpandable(true);
                        sPane.setDividerLocation( 0.5 );
                        sPane.setResizeWeight( 0.5 );
                        //Provide a preferred size for the split pane
                        sPane.setPreferredSize( new Dimension( 150, 350 ) );
                   public JSplitPane getSplitPane() {
                        return sPane;

    Hi, I'm not sure, but I think I had a similar problem. I tried to place a JSplitPane inside a JPanel and then I got the same behaviour as you describe. Unfortunately I didn't find out why that happened. I simply didn't use the JPanel and then it worked as I wanted it to. (Almost) :)

  • Why was the split pane removed from Acrobat?

    I recently upgraded from Acrobat 9 to Acrobat 11, and find that I'm not able to be as productive in 11. It's much harder to perform reviews because the Comment pane is difficult to work with. By default, the Comment pane is too narrow to be useful. If I undock it to try to put it underneath the document, I have to spend time fiddling with my windows to try to get the document the right size so that the undocked Comment pane can appear below it. The split pane was so much easier to work with; I hope that it will be added back in a future release. One other problem is that the scroll bar in the Comment pane is so narrow, it's difficult to click it.
    Can anyone suggest any workarounds to help deal with these new features?

    I tried the Touch Mode, which could probably help if I was viewing PDFs on a tablet, but unfortunately, it didn't do anything to increase the width of the Comment pane scroll bar, which is the UI element that I'm finding too narrow.
    I would have thought that Adobe's main customers would be using review and comment features heavily, so it's disappointing to see these types of UI changes made.
    As a workaround, I'm finding that I can at least split the page text, undock the Comment pane, and have it cover the bottom pane. That's a bit easier than trying to get it to fit under a resized main window. With most software that allows undocking, it usually lets you dock to a different spot, which would have worked fine here for those of us who would like to keep the comments at the bottom of the screen for better readability.

  • Adobe reader XI - Split Pane feature to be implemented?

    Hello,
    is it possible to implement the split pane function in adobe reader?
    We already use the window-> new window feature but it would be great to have the split function so that we can manage only 1 pdf instead of 2, and it is quite more efficient to do cross references.
    Thanks.

    Hello Pat,
    You are absolutely the BEST.
    I followed your two recommendations and now the program is working perfectly. Yes, my Reader XI was version 11.0.10 when I was having the problems.
    I never would have figured out the solution to the problem without your help.  I was very pleased with your follow through. 
    I really appreciate your help.  THANK YOU! – THANK YOU!
    Adobe is a great program – I have used it for years and this is the first time I have had any problem.  
    Kind regards,
    Hartley

  • Can you hide the divider of a split pane ?

    I have a split pane, the application also has menu options that allow the user to turn off one of the panes if they like, this results in the pane disappearing but the splitpane divider still exists.
    Can this be removed, and if not is it acceptable look for the divider to exist when only one side of the splitpane is visible, or do I have to remove the splitpane from its parent and just add the visible component of the splitpane to the parent directly when only one is selected, reversing the code when user wishes to have both visible.

    Thanks that works fine. Although it is a shame there is no splitpane.getDivider() method, I assume there is no explicit guarantee that the LAF being used actually subclasses BasicSplitPaneUI, so I need to make appropriate checks.

  • Textpane does not fill up right comp of split pane

    I am a novice when it comes to swing. So please pardon me if the question I am sking is a bit silly.
    I have a split pane , with a resizable divider. the rightcomponent houses an internal frame used by for a JEditor Pane.
    How do I set the size for any new JEdiorpane , so it takes or fill up the right hand side of the split pane. Bearing in mind that the divider might have been moved so the right component area is not at the preffered size.
    Should I be using a listener to take note of the current size of the split pane component?
    Any advise wil be appreciated.

    Sounds like it might be a sync issue. Have you tried powering the monitor off and then back on with the MBP connected to it? How about just temporarily disconnecting the DVI cable from the desktop PC and using that to plug into the MBP.

  • I can't type in the design portion of split pane view.

    When I try to type in the design portion of split pane, the design pane becomes white and won't except any input.  Basically it is forcing me to do everything in the code portion of the pane.

    It is dreamweaver CC for Mac OS X.  Yes, I have done that.  Here's a picture to illustrate what is happening:
    BEFORE:
    I place my cursor after the last bullet point, "Status" in the design pane.  When I hit Enter on my keyboard to create another bullet point (at least this is how it worked in previous dreamweaver versions) this is what I see:

  • Split Pane Divider and Fixing.

    Hi there fellow swingers. I am having trouble (you could say pane) with a divider.
    I basically want the user to be able to maximise and minimise a split pane but nothing in between.
    so, I want mySplitPane.setOneTouchExpandable(true);but I do not want them to be able to move the split pane by dragging it.
    using mySplitPane.setDividerSize(0); does not work as this will get rid of the scrollpane bar.
    Any help is appricaiated in advance.

    splitPane.setEnabled( false );

  • Split Pane? Freeze Pane?

    Is there a Numbers equivalent to Excel's Split Pane and Freeze Pane commands? ... so, for example, the header row is always visible and scrolling happens to the rows below the header.

    rowster,
    Would you like to try the following? It's quicker to do than to write it all out, so don't be put off by my lengthy step-by-step instructions.
    In Numbers, deselect Show or Hide Print View at the extreme bottom of the window, to hide the Print View page boundaries. Create your blank spreadsheet Table either from scratch or using a Template, and after clicking on the Table to expose the Row and Column Reference Numbers and Letters, drag to the right the 'Handle' at the right hand end of the row of Column Reference Letters which lie along the top of the Table; drag to the right as far as you need to go to add sufficient columns for your needs; the table will scroll to the left if you go off the right hand edge of the window. Do the same to increase the number of Rows by dragging downwards the Handle below the bottom of the column of Row Reference Numbers which are shown down the left hand edge of the Table.
    Enter your data into the Table with any Formatting you require, and make sure you specify a Header and Footer Row and Column in the Table Inspector pane. To do this, select the Table by clicking on it, then click on the Inspector Icon on the Toolbar to open the Inspector pane, and select the Table Icon at the top of the pane. If you want to minimise the size of the Table, auto-adjust the width of the columns and the height of the rows to 'fit' these to the space required by each data. You can also consider reducing the View magnification if this doesn't reduce readability too much.
    With the Table selected, select your paper sheet size and orienatation (Portrait or Landscape) in the Document Inspector and Sheet Inspector panes respectively and also set whether you want successive pages to lie horizontally or vertically adjacent to each other, then click on the Table Icon in the Inspector pane. At the very bottom of the Table Inspector pane, make sure that 'Repeat header cells on each page' is checked.
    Now re-select Show or Hide Print View at the extreme bottom of the window; this will break up the window contents into individual pages corresponding to what you would get if you were to print them. Using the scroll bars at the side and bottom of the window, you can now scroll around the spreadsheet and as you move from one page to another, the Header and Footer Row and Column will always be visible on each page, allowing you to relate data in any cell to these.
    To me, this is the next best thing to Excel's Freeze Panes feature, and in some situations, I think it's preferable.
    The only feature omission is that whilst the row of Column Reference Letters is always visible on every page if the Table is 'selected' by clicking on it, the column of Row Reference Numbers is only visible on the left-most pages; I've used the 'Provide Numbers feedback' feature to request Apple to repeat the column of Row Reference numbers on every page alongside the left-hand Header column.
    Hope this helps,
    Ian Mathieson.
    U.K.

Maybe you are looking for

  • How to get the latest and valid BOM item entry from STPO

    hi, may i know with what condition we can get the latest and valid BOM item entry from STPO table? i have STLNR and IDNRK as a input. But i realized that it would return multiple entry due to the combination of  valid-from and valid till date. can i

  • Working with multiple swing classes

    First off let me preface this by saying that I am relatively new to java and oop and am learning on my own. I wrote a text editor by extending JFrame and then adding all the panels, menu items and the textarea all in the extended class. I have a seco

  • How to send photos embedded in email?  It worked well on version 7.

    I was able to imbed photos in an email easily on version 7.  Version 11 does not allow me to do that without cutting and pasting each individual photo individually, one after another.  What am I doing wrong? Thanks, Tom

  • How to use the camera kit

    Hi does anyone knows how to use the canera kit ? What are the other software that need to download? Thx

  • In Fusion-Order-Demo appln  , not able to find directory  /labs/files

    hi, I'm practicing FOD application(FusionOrderDemo_R1PS2).For writing codes, the pdf (Oracle Fusion Middleare , building Applications with ADF) suggests for taking code from /labs/files directory.but I'm not able to find this directory.Please suggest