Results 1 to 9 of 9
  1. #1
    marco.c84 is offline Member
    Join Date
    Mar 2009
    Posts
    6
    Rep Power
    0

    Default Repositioning An unwanted JInternalFrame

    Hello to all.
    We start from what I've done and After from what does not work.
    So, in practice, I created a JScrollPane with an JDesktopPane which in turn contains a JTable and JInternalFrame to a higher level.
    The layout as JDesktopPane uses the FormLayout and JInternalFrame is added with the following CellConstraints:
    Java Code:
    new CellConstraints(1, 1, CellConstraints.LEFT, CellConstraints.TOP)
    Everything works perfectly except that after moving the JInternalFrame within JDesktopPane, they are again placed in their original position every time you go out with the mouse outside the JDesktopPane.
    Why this happen?
    Which method that is called?
    How can I avoid this?

    Thanks to everyone for any reply.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    This is because (as you have been told numerous times in the forums.sun.com and yet refuse to believe) you are changing the JDesktoPane's layout from null to something else. You can ask this question in a thousand fora and it still won't change the problem or its solution. You need help.

  3. #3
    marco.c84 is offline Member
    Join Date
    Mar 2009
    Posts
    6
    Rep Power
    0

    Default

    If I set the null layout does not work no nothing.
    Disappear the JScrollpane and JInternalFrame.

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by marco.c84 View Post
    If I set the null layout does not work no nothing.
    Disappear the JScrollpane and JInternalFrame.
    Without seeing your code, I can't guess why this is so, unless you are not setting the size (often with setBounds) of the JInternalFrame.

  5. #5
    marco.c84 is offline Member
    Join Date
    Mar 2009
    Posts
    6
    Rep Power
    0

    Default

    The code in question is this:
    Java Code:
    JList rowHeader = new JList(lm);
    rowHeader.setBorder(new LineBorder(Color.black, 1, false));
    rowHeader.setFocusable(false);
    rowHeader.setFixedCellHeight(100);
    final JScrollPane scrollPane = new JScrollPane();
    scrollPane.setRowHeaderView(rowHeader);
    scrollPane.setBounds(10, 10, 1237, 539);
    panelApp.add(scrollPane);
    
    desktopPane = new JDesktopPane();
    desktopPane.setLayout(new FormLayout("1150px", "1900px"));
    desktopPane.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
    scrollPane.setViewportView(desktopPane);
    
    final AppointmentTableModel aTm = new AppointmentTableModel(cal.getDate().getTime()); //extends AbstractTableModel
    table = new JTable(aTm);
    table.setShowHorizontalLines(false);
    table.setFocusable(false);
    for (int i = 0; i < 7; i++)
    	table.getColumnModel().getColumn(i).setPreferredWidth(180);
    table.setRowHeight(100);
    table.setRowSelectionAllowed(false);
    table.getTableHeader().setReorderingAllowed(false);
    scrollPane.setColumnHeaderView(table.getTableHeader());
    desktopPane.add(table, new CellConstraints("1, 1, 1, 1, left, fill"));
    
    addAppointmentInternalFrame(System.currentTimeMillis()); //add the JInternalFrame

  6. #6
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    I suggest that you delete this line:
    Java Code:
    desktopPane.setLayout(new FormLayout("1150px", "1900px"));
    and this line:
    Java Code:
    desktopPane.add(table, new CellConstraints("1, 1, 1, 1, left, fill"));
    and that you instead place your JTable into a JScrollPane if desired, place that JScrollPane into a JInternalFrame, set the JInternalFrame's bounds via setBounds to some reasonable size and location and then add the JInternalFrame to the desktopPane container. Hopefully then you'll see what you need to see.

  7. #7
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    For anyone interested, here's a link to the other thread on the forums.sun.com: Swing - JInternalFrame Inside A Strange JDesktoPane

  8. #8
    marco.c84 is offline Member
    Join Date
    Mar 2009
    Posts
    6
    Rep Power
    0

    Default

    The idea of putting the table inside a JInternalFRame is very good.
    Thank you.

  9. #9
    marco.c84 is offline Member
    Join Date
    Mar 2009
    Posts
    6
    Rep Power
    0

    Default

    In this case, but when I select the JInternalFrame that contains the JTable with JSroolPane the normal JInternalFrame disappear under it.

Similar Threads

  1. Problem with JInternalFrame
    By hameem in forum AWT / Swing
    Replies: 1
    Last Post: 12-11-2008, 05:23 PM
  2. [SOLVED] jScrool in JInternalFrame
    By gustio in forum New To Java
    Replies: 2
    Last Post: 07-22-2008, 11:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •