jscrollpane

Java JTable Column headers not showing

拈花ヽ惹草 提交于 2019-12-18 08:58:28
问题 Hi guys was hoping you could help me out here, my code (Logic-wise) is all good the only problem is that the column headers do not show up in the 2 tables (table and tableS, one for teacher and one for student details) how do i make them show? import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*; public class Display { ArrayList<Student> stud1 = new ArrayList<Student>(); ArrayList<SubjectTeacher> sTeach1 = new ArrayList<SubjectTeacher>(); /

How does one make a component in the .CENTER of a Borderlayout occupy all center space and resize with the app?

别来无恙 提交于 2019-12-18 08:54:39
问题 My app/JFrame, using Borderlayout, has a toolbar at the top or north, a statusbar at the bottom or south and a JPanel.JTabbedPane.JScrollPane.JTable in the center. The JPanel is always a fixed size which is roughly adjustable using the various set*Size() methods applied in various combinations to the various components. But it's always a fixed size and always has east and west gaps. The north and south components stay fixed height and resize horizontally as one would expect. Surely this is

Adding a JScrollPane to a JTable component

拥有回忆 提交于 2019-12-17 20:50:36
问题 I am trying to add a JScrollPane to my JTable , but it doesn't seem to works. I have a JTable with 21 rows and 5 columns, and I'm adding a JScrollPane as per the following code... public Targy_felv() { JScrollPane scrollPane; JFrame frame = new JFrame(); frame.setVisible(true); frame.setSize(600, 300); table = new JTable(); Object o[] = new Object[]{"Tárgynév", "Oktató", "Kredit", "Félév", "Tárgykód"}; table.setModel(new DefaultTableModel(get_Tárgyak(), o)); scrollPane = new JScrollPane();

Custom CellEditor with JScrollPane - start editing issue

北战南征 提交于 2019-12-17 20:33:03
问题 I have a JTable with a custom CellEditor using a JTextArea inside a JScrollPane. It works perfectly when I enter edit mode via mouse clic. However, when I try to type some letter while a cell is focused, nothing happens. The cell gets the "edit mode style" (the background changes), but stays empty... Any idea ? public class MultiLineCellEditor extends DefaultCellEditor { JTextArea textArea; JScrollPane scrollPane; public MultiLineCellEditor( final JTable table ) { super( new JTextField() );

Java :Add scroll into text area

南楼画角 提交于 2019-12-17 18:49:04
问题 How can i add the scroll bar to my text area. i have tried with this code but it's not working. middlePanel=new JPanel(); middlePanel.setBorder(new TitledBorder(new EtchedBorder(), "Display Area")); // create the middle panel components display = new JTextArea(16, 58); display.setEditable(false); // set textArea non-editable scroll = new JScrollPane(display); scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); //Add Textarea in to middle panel middlePanel.add

Java JPanel inside JScrollPane?

有些话、适合烂在心里 提交于 2019-12-17 16:32:58
问题 I have a JFrame, in this JFrame I have a JPanel that I draw on, this Panel can be any size and so I placed it into a JScrollpane to let me scroll when the panel is larger than the window screen size. Unfortunately does not work as I expected: Making the JFrame window smaller than the JPanel size does not show scroll bars The JScrollPane size now seems locked to the size of the JPanel I have added to it, where as before it resized to the bounds of it's JFrame window (it still kinda does this

How to set AUTO-SCROLLING of JTextArea in Java GUI?

Deadly 提交于 2019-12-17 02:44:09
问题 I have embedded a JTextArea on a JScrollPane and am using that JTextArea for output. I want that whenever the ouput goes beyond the size of the JTextArea, the JTextArea scrolls automatically so that user don't have to do manual scroll down to see the recent output. How can I do that? I have already set the autoscroll property of both JTextArea and JScrollPane to true. 回答1: When using JDK1.4.2 (or earlier) the most common suggestion you will find in the forums is to use code like the following

Resizing issue with canvas within jscrollpane within jsplitpane

こ雲淡風輕ζ 提交于 2019-12-16 19:41:29
问题 I'm creating an application using the NetBeans GUI Editor, in which I want to have a JSplitPane , the top component of which will be a Canvas within a JScrollPane and the bottom component will be a JTextArea , or something like that. When I pull the divider downwards, and thus increasing the size of the top component everything seem to resize just fine. The problem appears when I'm trying to push the divider upwards: The divider seems to go beneath the Canvas (and maybe beneath the

Resizing issue with canvas within jscrollpane within jsplitpane

爱⌒轻易说出口 提交于 2019-12-16 19:41:05
问题 I'm creating an application using the NetBeans GUI Editor, in which I want to have a JSplitPane , the top component of which will be a Canvas within a JScrollPane and the bottom component will be a JTextArea , or something like that. When I pull the divider downwards, and thus increasing the size of the top component everything seem to resize just fine. The problem appears when I'm trying to push the divider upwards: The divider seems to go beneath the Canvas (and maybe beneath the

how can i resize a jscrollpane

左心房为你撑大大i 提交于 2019-12-13 18:02:29
问题 Ok so I have this code: //adding the panel which will hold the order table JPanel orderPanel = new JPanel(); right.add(orderPanel); JTable order = new JTable(orderData, orderColumnNames); JScrollPane orderPane = new JScrollPane(order); orderPanel.add(orderPane); And I want to be able to remove this space : I guess the space is made by the JScrollPane but i can't find any method to resize the JScrollPane to the JTable's size 回答1: For the reasons adduced here, don't of invoke setPreferredSize()