Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Disable resizing of JTextPane

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 19-01-2010
Member
 
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.

Reply With Quote
  #2  
Old 19-01-2010
Member
 
Join Date: Oct 2005
Posts: 2,385
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.
Reply With Quote
  #3  
Old 19-01-2010
Member
 
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.
Reply With Quote
  #4  
Old 19-01-2010
Member
 
Join Date: Oct 2005
Posts: 2,385
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.
Reply With Quote
  #5  
Old 19-01-2010
Member
 
Join Date: May 2008
Posts: 2,373
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.
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
  #6  
Old 19-01-2010
Member
 
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Disable resizing of JTextPane"
Thread Thread Starter Forum Replies Last Post
Automatic resizing of JFrames melston Software Development 2 10-08-2010 12:15 PM
Resizing the layer in Photoshop afidelino Windows Software 5 06-03-2010 05:20 PM
Use of JTextPane class Truster Software Development 4 13-02-2010 09:34 AM
How to disable Web Site window resizing in Mozilla Firefox? Corwinn Technology & Internet 5 22-01-2010 09:48 PM
Import a text file in JTextPane Ash maker Software Development 5 22-01-2010 10:17 AM


All times are GMT +5.5. The time now is 07:55 PM.