jscrollpane

Bottom of JScrollPane is cut off

荒凉一梦 提交于 2019-12-02 16:43:06
问题 I am trying to create a simple email client and the bottom of the body is being cut-off. If I add a horizontal scroll bar, it does not appear, and the bottom of the Vertical scroll bar does not appear either. Here is my code: import java.awt.BorderLayout; import java.awt.Container; import java.awt.FlowLayout; import java.awt.Font; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollBar; import javax.swing.JScrollPane; import javax.swing

Adding a JScrollPane to JDialog

落爺英雄遲暮 提交于 2019-12-02 16:41:46
问题 I have a working JDialog and now I want to add scroll bars to it. The documentation is a bit confusing to me. Do I add the dialog to the JScrollPane or vice-versa? It seems like all the examples have a JPanel in the dialog and the panel is scrollable. I have a dialog that grows dynamically so I want the dialog itself to be scrollable. Can someone point me in the right direction? Reply to Andrew Thompson Thanks for the reply. I let the size be determined by the layout manager at this point. I

JScrollPane in Java

对着背影说爱祢 提交于 2019-12-02 15:51:05
问题 I wrote a little code to see how the scroll Pane functions but my code never worked. here's the code, public Fenetre(){ this.setTitle("Data Simulator"); this.setSize(300, 300); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLocationRelativeTo(null); String hello = "hello"; int number = 69; JPanel content = new JPanel(); content.setBackground(Color.LIGHT_GRAY); //Box imad = Box.createHorizontalBox(); JTextArea textArea = new JTextArea(10, 10); JLabel imad = new JLabel(); imad

How to add scrollbar to panel?

依然范特西╮ 提交于 2019-12-02 15:20:30
问题 I need help. I have one panel which can need to have width 1000px. I need to add lot of buttons with different size ( I add with flow layout and it works fine). Problem is that I have height on screen example 500px but when I add buttons panel has bigger size. How to add scrollbar to panel ? 回答1: Add your panel to scrollpane and add that pane where you are adding your panel instead of panel JScrollPane jScrollPane = new JScrollPane(panel); 来源: https://stackoverflow.com/questions/5790525/how

Text goes outside JTextArea

放肆的年华 提交于 2019-12-02 14:59:33
问题 I am trying to do something in Java which requires me to have a JTextArea in a ScrollPane. Here is how I have defined them: private JTextArea longestparagraph = new JTextArea(); .... JScrollPane scrollpanedreapta = new JScrollPane(longestparagraph, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollpanedreapta.setBorder(BorderFactory.createTitledBorder("Cel mai lung paragraf:")); The problem I'm encountering is that the text doesn't start on a new line when

Loading jScrollPane after initializing Facebook Comments - how?

雨燕双飞 提交于 2019-12-02 14:53:03
问题 Is there an "onComplete" state or similar for the Facebook Comments plugin? I'm trying to add a jScrollPane scrollbar to a content box that has FB Comments inside it. What happens is I get the FB Comments iframe placed on top of the box's content (as if it had an absolute position / was floating. Guessing this has to do with FB Comments initializing after jScrollPane. Edit: Now what I'm really after is combining ColorBox, Facebook Comments and jScrollPane and the headache starts pretty soon:

Java: Can't apply Gridlayout to a Jscrollpane. Get Get java.lang.ClassCastException

拥有回忆 提交于 2019-12-02 13:38:18
问题 I use a Gridlayout to place 4 elements in one Line. First I had a JPanel and everything worked fine. For the case that the number of lines get to big and I have to be able to scroll down, I changed it a bit. Now I have my JPanel with one JScrollPane added on it. I used the same code, now I just add the elements to the viewport of the Jscrollpane , but now I get this exception Get java.lang.ClassCastException: layout of JScrollPane must be a ScrollPaneLayout: at javax.swing.JScrollPane

JScrollPane not appearing on JTextArea

血红的双手。 提交于 2019-12-02 12:51:40
I'm trying to add the JScrollPane to my JTextArea, but somehow, it won't appear. I've tried resizing it according to the dimension of the JTextArea, but it doesn't seem to work. Also, notice that I'm using the null layout because I want the full-on flexibility of displaying certain buttons and panels at a pinpoint location. import java.awt.Dimension; import java.awt.BorderLayout; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JButton; import javax.swing.JScrollPane; import javax.swing.ScrollPaneConstants; import javax.swing.JTextArea; public class PaneTester{ private

Java Textarea ScrollPane

若如初见. 提交于 2019-12-02 12:04:56
I have created a textarea, and i need a scrollbar applied to the textarea when necessary (when the text gets too long down and it cant be read anymore). this is the code i have written, but for some reason, the scrollbar doesnt really come up? final JTextArea textArea = new JTextArea(); textArea.setEditable(false); textArea.setBounds(10, 152, 456, 255); textArea.setBorder(border); textArea.setLineWrap(true); sbrText = new JScrollPane(textArea); sbrText.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); panel_1.add(textArea); see this import javax.swing.*; public class

Adding a JScrollPane to JDialog

女生的网名这么多〃 提交于 2019-12-02 11:38:54
I have a working JDialog and now I want to add scroll bars to it. The documentation is a bit confusing to me. Do I add the dialog to the JScrollPane or vice-versa? It seems like all the examples have a JPanel in the dialog and the panel is scrollable. I have a dialog that grows dynamically so I want the dialog itself to be scrollable. Can someone point me in the right direction? Reply to Andrew Thompson Thanks for the reply. I let the size be determined by the layout manager at this point. I'm not exactly sure yet how big to let it get yet so I have not set any sizes. It just grows as I add