Results 1 to 6 of 6

Thread: Disable resizing of JTextPane

  1. #1
    Join Date
    Dec 2009
    Posts
    263

    Disable resizing of JTextPane

    Hi
    I joined my JPanel into a JScrollPane after I added up the JtextPane, there is no problem but when I enter data into the JTextPane of the JScrollPane JPanel grow automatically. I want to know how to disable resizing of JTextPanel when I try to re-size it. Thank you for your help.

  2. #2
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Disable resizing of JTextPane

    Hello,
    Could you explain it in an understandable and comprehensible way. I am having probelm in understanding your exact problem, I'll admit, but I did not understand much about the organization of your components, the layout used, what are you waiting to see the JScrollPane and so on. How you have arranged your components in your program. What have you changed in your code, so that you want to resize the JTextPane.

  3. #3
    Join Date
    Dec 2009
    Posts
    263

    Re: Disable resizing of JTextPane

    Hello,
    I will not meter my code that exceeds 2000 lines but I will summarize, I'm fine detail and I would be very clear, here is my part of code
    Code:
     JFrame frm = new JFrame();
    JPanel pan = new JPanel();
     JScrollPane jsppan = new JScrollPane();
    jsppan.setBounds(62, 72, 820, 500);
    jsppan.setViewportView(pan);
    pan.setAutoscrolls(false);
    pan.setLayout(null);
    JTextPane txt = new JTextPane();
    txt.setBounds(30,30,100,100);
    pan.add(txt);
    jsppan.setBounds(100,100,600,600);
    JPanel PaneauPrincipal = new JPanel();
    My problem as I told you when I typed in the txt the JspPan re-sizes and I have no idea how it behaves like that.

  4. #4
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Disable resizing of JTextPane

    Hello,
    Stop using the NullLayout it will immediately be better for you. The NullLayout fits very well with the JScrollPane. Also in your case I do not understand the need to insert a JPanel JScrollPane between them and your JTextPane. You should rather put them directly in your JTextPane JScrollPane (but anyway since you're using NullLayout it will not work very well either). The NullLayout is a bad practice swing.

  5. #5
    Join Date
    May 2008
    Posts
    2,389

    Re: Disable resizing of JTextPane

    Hello,
    The the above post mentioned that using the NullLayout is not a good practice, I think he is correct, even I am with him, some time before when I used NullLayout is did gave me some problems. Rather I suggest you to go for manager Layouts as well as FormLayout. The TableLayout, the MigLayout or use correctly layouts provided by Java (BorderLayout, BoxLayout, FlowLayout and the others.

  6. #6
    Join Date
    Dec 2009
    Posts
    263

    Re: Disable resizing of JTextPane

    Hello,
    What you know is in my code that Jtextpane, I can resize and move it that's why I made a setLayout (null) and that is why I work with that, you think setBounds, the FormLayout, the TableLayout are a proper option to use here. But I feel these not work well with my program. Any other alternative will be highly recommended. By the way thanks for your help guys.

Similar Threads

  1. Automatic resizing of JFrames
    By melston in forum Software Development
    Replies: 2
    Last Post: 10-08-2010, 12:15 PM
  2. Resizing the layer in Photoshop
    By afidelino in forum Windows Software
    Replies: 5
    Last Post: 06-03-2010, 06:20 PM
  3. Use of JTextPane class
    By Truster in forum Software Development
    Replies: 4
    Last Post: 13-02-2010, 10:34 AM
  4. How to disable Web Site window resizing in Mozilla Firefox?
    By Corwinn in forum Technology & Internet
    Replies: 5
    Last Post: 22-01-2010, 10:48 PM
  5. Import a text file in JTextPane
    By Ash maker in forum Software Development
    Replies: 5
    Last Post: 22-01-2010, 11:17 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,290,511.86149 seconds with 17 queries