jscrollpane

vertical scroll bar in JTable

此生再无相见时 提交于 2019-12-25 03:27:32
问题 I have one JTable with vertical scroll bar on it,when i added new row the scroll bar will move to the new row. The problem is scrollbar is visible in the frame but i can't scroll it. this is way i created jtable table = new javax.swing.JTable(){ public boolean isCellEditable(int rowIndex, int colIndex) { return false; //Disallow the editing of any cell } }; model = (DefaultTableModel) table.getModel(); table.setRowHeight(20); selectionModel = table.getSelectionModel(); selectionModel

Set the vertical scroll to current position after revalidate

╄→尐↘猪︶ㄣ 提交于 2019-12-25 03:26:33
问题 I know that this question might have been asked before, but I just can't get by head around this, and hopefully we could produce a complete answer to a somewhat tricky interface. The GUI could be described as follows: Application extends JFrame. Application adds a JPanel mPanel. mPanel adds a JScrollPane ml containing a MoviePanel extending JPanel. The JScrollPane ml has vertical scrolling. My goal is that once the content of MoviePanel changes, and a run a revalidate() on it, the scroll pane

JLabel disappears after scrolling

柔情痞子 提交于 2019-12-25 02:59:20
问题 I've got scroll panel which contains ImageIcon . I want to add JLabel with absolute position in px. What I've got: The code: public class HelloWorld { HelloWorld() { JFrame jfrm = new JFrame("Hello, World!"); jfrm.setSize(640, 480); JPanel mapPanel = new JPanel(); mapPanel.setLayout(null); mapPanel.setSize(600,400); jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ImageIcon imageIcon = new ImageIcon("src\\SwingExp\\img\\map.gif"); JScrollPane scrollPane = new JScrollPane(new JLabel

JLabel disappears after scrolling

浪尽此生 提交于 2019-12-25 02:59:13
问题 I've got scroll panel which contains ImageIcon . I want to add JLabel with absolute position in px. What I've got: The code: public class HelloWorld { HelloWorld() { JFrame jfrm = new JFrame("Hello, World!"); jfrm.setSize(640, 480); JPanel mapPanel = new JPanel(); mapPanel.setLayout(null); mapPanel.setSize(600,400); jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ImageIcon imageIcon = new ImageIcon("src\\SwingExp\\img\\map.gif"); JScrollPane scrollPane = new JScrollPane(new JLabel

moving / scrolling up and down on three JTable simultanously.

旧时模样 提交于 2019-12-25 01:13:55
问题 I have three different jtable on three diffenernt jscrollpane - one next to the other. I successfuly written some code that makes them all scroll together when I scroll the mouse wheel. I inherrited JScrollpane and overriden its processMouseWheelEvent methos as follows: public void processMouseWheelEvent(MouseWheelEvent e) { ... if (e.getSource() == this) { for (BTSJScrollPane other : effected) { other.processMouseWheelEvent(e); } } } I have canelled the pageup pagedown using final InputMap

How does one add a JScrollPane to a JPanel

三世轮回 提交于 2019-12-24 23:15:49
问题 I have been searching around for an easy way to implement a JScrollPlane . I am trying to add it to a JPanel , and it will contain a dynamic number of JPanel s (which will be filled with other stuff). Here is my (failing miserably) attempt to make said JScrollPane : final JPanel info = new JPanel(); final JScrollPane infoS = new JScrollPane(info,ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); info.setLayout(new GridLayout(0,1)); info

JScrollPane not appearing?

痞子三分冷 提交于 2019-12-24 19:27:54
问题 Why is my JScrollPane not showing up? if I do it with the table (commented part) it works fine, but when I put it into a scrollpane ( I need too, the data base is really long) it never appears, can anyone help me? :o) Here's the code: JButton btnRefresh = new JButton("Refresh"); btnRefresh.setBounds(130, 35, 80, 30); btnRefresh.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try{ ResultSet r = s.executeQuery("Select * From "+comboBox.getSelectedItem());

JTable which is scrollable horizontally AND grows to fill parent container

妖精的绣舞 提交于 2019-12-24 15:15:37
问题 I want to put a JTable in a JScrollPane and want it to: be scrollable horizontally and vertically (only if it has content that makes it larger than parent container) automatically grow to fill parent container if needed (in both directions) only have either/both scroll bar(s) when needed The JList behaves exactly like this, btw. But I have found no easy way to accomplish all goals simultaneously with a JTable . The easy way to accomplish the first is to disable auto-resizing, but that then

JTextPane is scrolling its parent Scrollpane to the bottom

笑着哭i 提交于 2019-12-24 13:19:09
问题 Here is a littel SSCCE which shows the weird scrolling behaviour. When you start it, it scrolls down to the bottom of the scrollpane. But I want it to stay on top. So far I found out, this only happens with JTextPanes and not even with JTextArea. It also only happens if you are on the EDT. Remove the invokeLater() from the SSCCE and it works as expected. However, that's not a solution (for me). I also tried that, but with no effect: final DefaultCaret caret = (DefaultCaret) tp.getCaret();

JTable: Adding one to a JPanel, and it not displaying itself

ぃ、小莉子 提交于 2019-12-24 12:43:04
问题 It's Monday morning where I am, which means it's time for me to fail at Java Swing! But in all seriousness, I cannot figure out why my dynamically created JTable refuses to show itself once added to a JPanel on a JFrame, and would greatly appreciate any help in isolating this troublesome problem. As you can see from the code, I've called a dozen different methods, but can't seem to get the right one to get it to display...perhaps I am missing one? /* * To change this template, choose Tools |