jscrollpane

JScrollPane is not Working in JPanel

倾然丶 夕夏残阳落幕 提交于 2020-01-30 08:24:06
问题 I have to use JScrollPane in my Project but it is not working. I have pasted my code where I use a JSCrollPane in my main JPanel. frame = new JFrame(); frame.setBounds(100, 100, 1179, 733); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); JScrollPane scrollPane_1 = new JScrollPane(); scrollPane_1.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPane_1.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL

JFrame add scrollbar

杀马特。学长 韩版系。学妹 提交于 2020-01-24 11:59:05
问题 I've tried a few tutorials and had a look at other answers but it still doesn't seem to help me, I want to add a scrollbar to this console-like JTextArea, and keep the property whereby each new line of text will push the rest up. This is what it looks like currently: And the code: Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); int width = 600; int height = 400; JFrame frame = new JFrame("ChanDown"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel

Jquery jscrollpane width to adjust automatically according to content

拟墨画扇 提交于 2020-01-23 03:33:05
问题 I am looking to use jScrollPane on my new website and am having some troubleshooting problems with it. Searched up and down for answers but couldn't find any. Please take a look at the website here: http://www.giamarescotti.com/v2 Instead of specifying a definite width to .scroll-pane, I would like it to expand according to the content because it's impossible for me to keep recalculating the width as I update my website regularly. *Due to being a new user, I am unable to post images and codes

How to draw on JPanel on fixed position?

◇◆丶佛笑我妖孽 提交于 2020-01-21 18:58:08
问题 I have JPanel wrapped in JScrollPane and I want the rectangle to be drawn always on the same position = moving with scrollbars wont affect the visibility of the rectangle. I tried following code: public void paintComponent(Graphics g) { g.setColor(Color.red); g.drawRect(50, (int)getVisibleRect().getY(), 20 , 20); } but it only repaints the rectangle when size of whole JPanel is changed. 回答1: IIRC, JScrollPane will try to minimise the amount of redrawing done scrolling, so it wont always cause

JScrollPanes in JInternalFrames for right to left component orientations - Java bug?

二次信任 提交于 2020-01-17 03:26:33
问题 So I have created some demo code, see below. What I am seeing is that if a JScrollPane is within a JInternalFrame and component orientation is set to right-to-left, when minmising the frame, the scroll bar stays to the left of the content. I would expect, seeing as RtL, that it would stay to the right of the content, which is true if the scroll pane is not added to an internal frame (see both frames - one appears behind the other in the demo). So is this a Java bug or have I forgotten to do

Adding JTable to JScrollPane

China☆狼群 提交于 2020-01-16 01:54:05
问题 I have been making a small application containing JTable . The question is this: when I am adding the JTable to the JScrollPane , it is giving me the error that the table component is added to a parent component more than once. getContentPane().add(new JScrollPane(table)); scrollPane.setViewportView(table); I see the problem but could not solve it. Any suggestions? public thirdFrame() { thirdFrame = new JFrame(); thirdFrame.setFont(new Font("David", Font.BOLD, 17)); thirdFrame.setTitle(

Create Scroll Bar for JFrame

余生长醉 提交于 2020-01-16 01:06:12
问题 Hi I am trying to create Scroll Bar for my JFrame. I created JPanel object and set components into JPanel. Then created a JScrollPane object for the panel. Then add the ScrollPane object to JFrame. I am not seeing any scrollbar. Also I am wondering if there is a option in JPanel that would resize the object inside Jpanel automatically according to the zoom level of the JPanel. Any help would be highly appreciated. public class xmlottgui { private JPanel Container; private JFrame frmCreateXml;

JTextComponent inside JPanel inside JScrollPane

元气小坏坏 提交于 2020-01-15 21:02:01
问题 I recently have had the need to put several Components, a JTextPane among them, inside of a single JScrollPane's viewport view. (See details here, if interested). I put all the Components (two JPanels and the JTextPane) inside of another JPanel, this one having a BorderLayout LayoutManager, and set that JPanel as the ScrollPane's viewport view. What I immediately noticed was: The JTextPane doesn't resize its width according to the width of the JScrollPane anymore, even when the JScrollPane is

JTextComponent inside JPanel inside JScrollPane

↘锁芯ラ 提交于 2020-01-15 20:58:16
问题 I recently have had the need to put several Components, a JTextPane among them, inside of a single JScrollPane's viewport view. (See details here, if interested). I put all the Components (two JPanels and the JTextPane) inside of another JPanel, this one having a BorderLayout LayoutManager, and set that JPanel as the ScrollPane's viewport view. What I immediately noticed was: The JTextPane doesn't resize its width according to the width of the JScrollPane anymore, even when the JScrollPane is

JTextComponent inside JPanel inside JScrollPane

↘锁芯ラ 提交于 2020-01-15 20:56:10
问题 I recently have had the need to put several Components, a JTextPane among them, inside of a single JScrollPane's viewport view. (See details here, if interested). I put all the Components (two JPanels and the JTextPane) inside of another JPanel, this one having a BorderLayout LayoutManager, and set that JPanel as the ScrollPane's viewport view. What I immediately noticed was: The JTextPane doesn't resize its width according to the width of the JScrollPane anymore, even when the JScrollPane is