|
| ||||||||||
| Tags: gui, java, jtextpane, programming, swing |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| Disable resizing of JTextPane
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
| ||||
| ||||
| 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.
__________________ Grand Theft Auto 4 PC Video Game |
|
#3
| |||
| |||
| 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(); |
|
#4
| ||||
| ||||
| 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.
__________________ Grand Theft Auto 4 PC Video Game |
|
#5
| ||||
| ||||
| 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 |
|
#6
| |||
| |||
| 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. |
![]() |
|
| Thread Tools | Search this Thread |
| |
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 |
| 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 |
| Desktop resizing when using a KVM switch | Benedict | Operating Systems | 3 | 03-12-2009 09:30 AM |