jscrollpane

how do I add a JLabel to a specific location into my ScrollPane?

拥有回忆 提交于 2019-12-13 16:04:43
问题 Im trying to show images and/or labels in my JPanel. The thing is, I want to show many JLabels in custom locations but currently I can only show like 4 labels. I understand I need to use ScrollPane. I have tried using it but its not letting me alocate them with customs locations. (By custom locations I mean using coords to place my label.) Here is the code WITHOUT using ScrollPane: import java.awt.Dimension; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel;

How do I make JScrollPane work properly with nested JPanels?

。_饼干妹妹 提交于 2019-12-13 14:11:59
问题 I'm building a Swing application in Java using NetBeans and I have a problem with layout. My main frame contains a JScrollPane which contains a JPanel called contentPanel which in turn contains a JPanel called listPanel . The listPanel is empty when the program starts, but when the user interacts with the program an unpredictable number of smaller JPanel s are added to it. I've used the NetBeans GUI-builder to snap the top edge of listPanel to the top of contentPanel , and the same with the

How do I dynamically resize a text component in Java Netbeans, when the text has filled the component, instead of it having scroll bars?

♀尐吖头ヾ 提交于 2019-12-13 09:17:31
问题 I've done a ton of research regarding this issue, but I haven't had any luck with anything I've found. It's a major roadblock in the application I'm developing. My application has a Form, which contains a JScrollPane. After adding a JTextArea inside the JScrollPane, I see that when I run the program and type in the JTextArea, it is accompanied by scrollbars when the JTextArea overflows with text. Even if I set the scrollbar policy to 'NEVER', it simply overflows and moves the current text up.

Vertical scrollbar in jTable swing does not appear

一曲冷凌霜 提交于 2019-12-13 06:20:51
问题 I am a bit new to swings, And i was trying to cough up some code involving Jtable. I find that even though i have added the scrollbar policy the vertical scrollbar does not seem to appear. THe code is pretty shabby.(warning u before hand). But could you please indicate where I need to put in the scrollbar policy. I have tried adding it at a lot of places and it just does not seem to appear. the other question is how do i make an empty table. As in every time the process button is clicked, i

Java Swing Scrolling By Dragging the Mouse

社会主义新天地 提交于 2019-12-13 06:16:06
问题 I am trying to create a hand scroller that will scroll as you drag your mouse across a JPanel. So far I cannot get the view to change. Here is my code: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class HandScroller extends JFrame { public static void main(String[] args) { new HandScroller(); } public HandScroller() { setDefaultCloseOperation(EXIT_ON_CLOSE); final JPanel background = new JPanel(); background.add(new JLabel("Hand")); background.add(new JLabel(

JTable doesn't show after adding JScrollPane

萝らか妹 提交于 2019-12-13 06:14:52
问题 This is my code : table = new JTable(tableModel); final TableRowSorter<TableModel> sorter = new TableRowSorter(tableModel); table.setRowSorter(sorter); table.setBounds(122, 47, 162, 204); JScrollPane scroller = new JScrollPane(table); frame.getContentPane().add(scroller); It worked fine until I added JScrollPane. Now it is blank. What am I doing wrong here ? Let me know if you need anything else. 回答1: As @HovercraftFullOfEels wisely points out the call to Component.setBounds() mess the things

Using JTextarea with JTabbedPanel

人走茶凉 提交于 2019-12-13 06:04:31
问题 JTextarea is dynamically created and added to the jTabbed panel using the code: // tabidis is a variable with unique value in each case JScrollPane panel2 = new JScrollPane(); panel2.setName(tabidis); ta = new JTextArea(""); ta.setColumns(30); ta.setRows(20); ta.setEditable(false); panel2.setViewportView(ta); ta.setName(tabidis); jTabbedPane1.add(username4, panel2); When new tabs are added (ta textarea is added along with it), the last tabs textarea recieves all the text. private void

Jquery JScrollPane - Set scroll speed/sensitivity

允我心安 提交于 2019-12-13 05:51:25
问题 I have a relatively simple question, I just can't find the solution for it anywhere. Does anyone know, how to initialize the JScrollPane plugin (plugin website), with a bit more sensitive scroll speed? The default speed is just too slow and sluggish, especially on higher resolution monitors. Example initialization: $('#element').jScrollPane(); 回答1: You are searching for wheelSpeed (default is 18) $('#element').jScrollPane({wheelSpeed: 50}); 回答2: try out this one to: $('.ym-col3').jScrollPane(

How to handle oversized JDialog

岁酱吖の 提交于 2019-12-13 03:52:59
问题 I'm developing a JDialog which will have three sections, one on the top of the other: customer general information, list of customer addresses and list of orders. The list of customer addresses may grow arbitrarily large and this causes the dialog to grow beyond the screen height. Thus, calling pack() before displaying it does not work because the packed dialog height is still too big for the screen height. This calls for a scroll pane. But I would have to set the dialog's preferred size to

JScrollpane loses size after minimize

人走茶凉 提交于 2019-12-13 02:49:53
问题 For some reason the jscrollpane somehow messes up the layout when the window is minimized and then restored. Note that this is not happening if the text in the text area is not longer than the size of the text area (i.e. if it doesnt make a vertical scroll bar appear). Can anyone see what's wrong with it? My code below: super (new GridBagLayout()); textField = new JTextArea(20,80); textField.addKeyListener(null); JScrollPane scrollPane1 = new JScrollPane(textField); textArea = new JTextArea